diff --git a/js/src/jit-test/tests/basic/bug657975.js b/js/src/jit-test/tests/basic/bug657975.js index 659aab5b38d..c734b39be56 100644 --- a/js/src/jit-test/tests/basic/bug657975.js +++ b/js/src/jit-test/tests/basic/bug657975.js @@ -37,3 +37,10 @@ function f6() { } trap(f6, 10, '') f6() + +// bug 658491 +function f7() { + try { y = w; } catch(y) {} +} +trap(f7, 16, '') +f7() diff --git a/js/src/methodjit/Compiler.cpp b/js/src/methodjit/Compiler.cpp index ea2b906346c..1710fb2f024 100644 --- a/js/src/methodjit/Compiler.cpp +++ b/js/src/methodjit/Compiler.cpp @@ -1510,6 +1510,17 @@ mjit::Compiler::generateMethod() SPEW_OPCODE(); JS_ASSERT(frame.stackDepth() == opinfo->stackDepth); + // If this is an exception entry point, then jsl_InternalThrow has set + // VMFrame::fp to the correct fp for the entry point. We need to copy + // that value here to FpReg so that FpReg also has the correct sp. + // Otherwise, we would simply be using a stale FpReg value. + // Additionally, we check the interrupt flag to allow interrupting + // deeply nested exception handling. + if (op == JSOP_ENTERBLOCK && analysis->getCode(PC).exceptionEntry) { + masm.loadPtr(FrameAddress(VMFrame::offsetOfFp), JSFrameReg); + interruptCheckHelper(); + } + if (trap) { prepareStubCall(Uses(0)); masm.move(Imm32(trap), Registers::ArgReg1); @@ -6661,17 +6672,6 @@ mjit::Compiler::jumpAndTrace(Jump j, jsbytecode *target, Jump *slow, bool *tramp void mjit::Compiler::enterBlock(JSObject *obj) { - // If this is an exception entry point, then jsl_InternalThrow has set - // VMFrame::fp to the correct fp for the entry point. We need to copy - // that value here to FpReg so that FpReg also has the correct sp. - // Otherwise, we would simply be using a stale FpReg value. - // Additionally, we check the interrupt flag to allow interrupting - // deeply nested exception handling. - if (analysis->getCode(PC).exceptionEntry) { - masm.loadPtr(FrameAddress(VMFrame::offsetOfFp), JSFrameReg); - interruptCheckHelper(); - } - /* For now, don't bother doing anything for this opcode. */ frame.syncAndForgetEverything(); masm.move(ImmPtr(obj), Registers::ArgReg1);