diff --git a/js/src/jit/IonCaches.cpp b/js/src/jit/IonCaches.cpp index 87a7027a74f0..c9cef98722a0 100644 --- a/js/src/jit/IonCaches.cpp +++ b/js/src/jit/IonCaches.cpp @@ -844,7 +844,6 @@ EmitGetterCall(JSContext *cx, MacroAssembler &masm, void *returnAddr) { JS_ASSERT(output.hasValue()); - // saveLive() MacroAssembler::AfterICSaveLive aic = masm.icSaveLive(liveRegs); // Remaining registers should basically be free, but we need to use |object| still @@ -865,9 +864,6 @@ EmitGetterCall(JSContext *cx, MacroAssembler &masm, bool callNative = IsCacheableGetPropCallNative(obj, holder, shape); JS_ASSERT_IF(!callNative, IsCacheableGetPropCallPropertyOp(obj, holder, shape)); - // TODO: ensure stack is aligned? - DebugOnly initialStack = masm.framePushed(); - if (callNative) { JS_ASSERT(shape->hasGetterValue() && shape->getterValue().isObject() && shape->getterValue().toObject().is()); @@ -967,11 +963,7 @@ EmitGetterCall(JSContext *cx, MacroAssembler &masm, masm.adjustStack(IonOOLPropertyOpExitFrameLayout::Size()); } - JS_ASSERT(masm.framePushed() == initialStack); - - // restoreLive() - masm.PopRegsInMask(liveRegs); - + masm.icRestoreLive(liveRegs, aic); return true; } @@ -1287,7 +1279,6 @@ EmitCallProxyGet(JSContext *cx, MacroAssembler &masm, IonCache::StubAttacher &at TypedOrValueRegister output, jsbytecode *pc, void *returnAddr) { JS_ASSERT(output.hasValue()); - // saveLive() MacroAssembler::AfterICSaveLive aic = masm.icSaveLive(liveRegs); // Remaining registers should be free, but we need to use |object| still @@ -1304,7 +1295,6 @@ EmitCallProxyGet(JSContext *cx, MacroAssembler &masm, IonCache::StubAttacher &at Register scratch = regSet.takeGeneral(); - DebugOnly initialStack = masm.framePushed(); void *getFunction = JSOp(*pc) == JSOP_CALLPROP ? JS_FUNC_TO_DATA_PTR(void *, Proxy::callProp) : JS_FUNC_TO_DATA_PTR(void *, Proxy::get); @@ -1350,11 +1340,8 @@ EmitCallProxyGet(JSContext *cx, MacroAssembler &masm, IonCache::StubAttacher &at // masm.leaveExitFrame & pop locals masm.adjustStack(IonOOLProxyExitFrameLayout::Size()); - JS_ASSERT(masm.framePushed() == initialStack); - - // restoreLive() - masm.PopRegsInMask(liveRegs); + masm.icRestoreLive(liveRegs, aic); return true; } @@ -2069,7 +2056,6 @@ EmitCallProxySet(JSContext *cx, MacroAssembler &masm, IonCache::StubAttacher &at HandleId propId, RegisterSet liveRegs, Register object, ConstantOrRegister value, void *returnAddr, bool strict) { - // saveLive() MacroAssembler::AfterICSaveLive aic = masm.icSaveLive(liveRegs); // Remaining registers should be free, but we need to use |object| still @@ -2087,8 +2073,6 @@ EmitCallProxySet(JSContext *cx, MacroAssembler &masm, IonCache::StubAttacher &at Register scratch = regSet.takeGeneral(); - DebugOnly initialStack = masm.framePushed(); - // Push stubCode for marking. attacher.pushStubCodePointer(masm); @@ -2127,11 +2111,8 @@ EmitCallProxySet(JSContext *cx, MacroAssembler &masm, IonCache::StubAttacher &at // masm.leaveExitFrame & pop locals masm.adjustStack(IonOOLProxyExitFrameLayout::Size()); - JS_ASSERT(masm.framePushed() == initialStack); - - // restoreLive() - masm.PopRegsInMask(liveRegs); + masm.icRestoreLive(liveRegs, aic); return true; } @@ -2272,7 +2253,6 @@ GenerateCallSetter(JSContext *cx, IonScript *ion, MacroAssembler &masm, // Good to go for invoking setter. - // saveLive() MacroAssembler::AfterICSaveLive aic = masm.icSaveLive(liveRegs); // Remaining registers should basically be free, but we need to use |object| still @@ -2294,9 +2274,6 @@ GenerateCallSetter(JSContext *cx, IonScript *ion, MacroAssembler &masm, bool callNative = IsCacheableSetPropCallNative(obj, holder, shape); JS_ASSERT_IF(!callNative, IsCacheableSetPropCallPropertyOp(obj, holder, shape)); - // Ensure stack is aligned. - DebugOnly initialStack = masm.framePushed(); - if (callNative) { JS_ASSERT(shape->hasSetterValue() && shape->setterObject() && shape->setterObject()->is()); @@ -2395,11 +2372,7 @@ GenerateCallSetter(JSContext *cx, IonScript *ion, MacroAssembler &masm, masm.adjustStack(IonOOLPropertyOpExitFrameLayout::Size()); } - JS_ASSERT(masm.framePushed() == initialStack); - - // restoreLive() - masm.PopRegsInMask(liveRegs); - + masm.icRestoreLive(liveRegs, aic); return true; } diff --git a/js/src/jit/IonMacroAssembler.h b/js/src/jit/IonMacroAssembler.h index 3a8293b168ae..bc46edf5c36a 100644 --- a/js/src/jit/IonMacroAssembler.h +++ b/js/src/jit/IonMacroAssembler.h @@ -1319,13 +1319,21 @@ class MacroAssembler : public MacroAssemblerSpecific public: class AfterICSaveLive { friend class MacroAssembler; - AfterICSaveLive() + AfterICSaveLive(uint32_t initialStack) +#ifdef JS_DEBUG + : initialStack(initialStack) +#endif {} + +#ifdef JS_DEBUG + public: + uint32_t initialStack; +#endif }; AfterICSaveLive icSaveLive(RegisterSet &liveRegs) { PushRegsInMask(liveRegs); - return AfterICSaveLive(); + return AfterICSaveLive(framePushed()); } bool icBuildOOLFakeExitFrame(void *fakeReturnAddr, AfterICSaveLive &aic) { @@ -1333,6 +1341,7 @@ class MacroAssembler : public MacroAssemblerSpecific } void icRestoreLive(RegisterSet &liveRegs, AfterICSaveLive &aic) { + JS_ASSERT(framePushed() == aic.initialStack); PopRegsInMask(liveRegs); } };