Bug 994444. (r=nbp)

This commit is contained in:
Shu-yu Guo 2014-04-14 22:00:07 -07:00
parent 50d14afe31
commit 1634f6b64b

View File

@ -392,6 +392,17 @@ GetStubReturnAddress(JSContext *cx, jsbytecode *pc)
return cx->compartment()->jitCompartment()->baselineCallReturnAddr(); return cx->compartment()->jitCompartment()->baselineCallReturnAddr();
} }
static inline jsbytecode *
GetNextNonLoopEntryPc(jsbytecode *pc)
{
JSOp op = JSOp(*pc);
if (op == JSOP_GOTO)
return pc + GET_JUMP_OFFSET(pc);
if (op == JSOP_LOOPENTRY || op == JSOP_NOP || op == JSOP_LOOPHEAD)
return GetNextPc(pc);
return pc;
}
// For every inline frame, we write out the following data: // For every inline frame, we write out the following data:
// //
// | ... | // | ... |
@ -783,16 +794,18 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC,
// If we are resuming at a LOOPENTRY op, resume at the next op to avoid // If we are resuming at a LOOPENTRY op, resume at the next op to avoid
// a bailout -> enter Ion -> bailout loop with --ion-eager. See also // a bailout -> enter Ion -> bailout loop with --ion-eager. See also
// ThunkToInterpreter. // ThunkToInterpreter.
//
// The algorithm below is the "tortoise and the hare" algorithm. See bug
// 994444 for more explanation.
if (!resumeAfter) { if (!resumeAfter) {
jsbytecode *fasterPc = pc;
while (true) { while (true) {
op = JSOp(*pc); pc = GetNextNonLoopEntryPc(pc);
if (op == JSOP_GOTO) fasterPc = GetNextNonLoopEntryPc(GetNextNonLoopEntryPc(fasterPc));
pc += GET_JUMP_OFFSET(pc); if (fasterPc == pc)
else if (op == JSOP_LOOPENTRY || op == JSOP_NOP || op == JSOP_LOOPHEAD)
pc = GetNextPc(pc);
else
break; break;
} }
op = JSOp(*pc);
} }
uint32_t pcOff = script->pcToOffset(pc); uint32_t pcOff = script->pcToOffset(pc);