Bug 951668 - IonCaches: Use icRestoreLive. r=efaust

This commit is contained in:
Nicolas B. Pierron 2013-12-19 01:59:13 -08:00
parent 81dc7a8df4
commit c847871494
2 changed files with 15 additions and 33 deletions

View File

@ -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<uint32_t> initialStack = masm.framePushed();
if (callNative) {
JS_ASSERT(shape->hasGetterValue() && shape->getterValue().isObject() &&
shape->getterValue().toObject().is<JSFunction>());
@ -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<uint32_t> 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<uint32_t> 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<uint32_t> initialStack = masm.framePushed();
if (callNative) {
JS_ASSERT(shape->hasSetterValue() && shape->setterObject() &&
shape->setterObject()->is<JSFunction>());
@ -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;
}

View File

@ -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);
}
};