Bug 736012 - Unwind current frame on failure to enter jit code from loop header (r=bhackett)

--HG--
extra : rebase_source : 5dcfb53368a6f816b44d26cf43b564f1525d74bb
This commit is contained in:
Luke Wagner 2012-03-16 10:04:17 -07:00
parent aaef82ac19
commit 6c8e2f8935
4 changed files with 29 additions and 6 deletions

View File

@ -0,0 +1,8 @@
evaluate("\
function fatty() {\
try { fatty(); } catch (e) {\
for each (foo in [1]) {}\
}\
}\
fatty();\
");

View File

@ -463,7 +463,7 @@ js::RunScript(JSContext *cx, JSScript *script, StackFrame *fp)
return false;
if (status == mjit::Compile_Okay)
return mjit::JaegerShot(cx, false);
return mjit::JaegerStatusToSuccess(mjit::JaegerShot(cx, false));
#endif
return Interpret(cx, fp);
@ -1744,8 +1744,9 @@ check_backedge:
void *ncode =
script->nativeCodeForPC(regs.fp()->isConstructing(), regs.pc);
JS_ASSERT(ncode);
mjit::JaegerStatus status =
mjit::JaegerShotAtSafePoint(cx, ncode, true);
mjit::JaegerStatus status = mjit::JaegerShotAtSafePoint(cx, ncode, true);
if (status == mjit::Jaeger_ThrowBeforeEnter)
goto error;
CHECK_PARTIAL_METHODJIT(status);
interpReturnOK = (status == mjit::Jaeger_Returned);
if (entryFrame != regs.fp())
@ -2728,7 +2729,7 @@ BEGIN_CASE(JSOP_FUNCALL)
if (status == mjit::Compile_Okay) {
mjit::JaegerStatus status = mjit::JaegerShot(cx, true);
CHECK_PARTIAL_METHODJIT(status);
interpReturnOK = (status == mjit::Jaeger_Returned);
interpReturnOK = mjit::JaegerStatusToSuccess(status);
CHECK_INTERRUPT_HANDLER();
goto jit_return;
}

View File

@ -1106,7 +1106,7 @@ CheckStackAndEnterMethodJIT(JSContext *cx, StackFrame *fp, void *code, bool part
Value *stackLimit = cx->stack.space().getStackLimit(cx, REPORT_ERROR);
if (!stackLimit)
return Jaeger_Throwing;
return Jaeger_ThrowBeforeEnter;
return EnterMethodJIT(cx, fp, code, stackLimit, partial);
}

View File

@ -454,9 +454,23 @@ enum JaegerStatus
* The trap has been reinstalled, but should not execute again when
* resuming execution.
*/
Jaeger_UnfinishedAtTrap = 3
Jaeger_UnfinishedAtTrap = 3,
/*
* An exception was thrown before entering jit code, so the caller should
* 'goto error'.
*/
Jaeger_ThrowBeforeEnter = 4
};
static inline bool
JaegerStatusToSuccess(JaegerStatus status)
{
JS_ASSERT(status != Jaeger_Unfinished);
JS_ASSERT(status != Jaeger_UnfinishedAtTrap);
return status == Jaeger_Returned;
}
/*
* Method JIT compartment data. Currently, there is exactly one per
* JS compartment. It would be safe for multiple JS compartments to