mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 866050 - Fix UsesBeforeIonRecompile. r=bhackett
--HG-- extra : rebase_source : 6f4cfa4561b1c8af0b28a10604ddb43824553310
This commit is contained in:
parent
dc3195c132
commit
9c5c6ca881
@ -435,7 +435,23 @@ EmitLoopEntry(JSContext *cx, BytecodeEmitter *bce, ParseNode *nextpn)
|
||||
return false;
|
||||
}
|
||||
|
||||
return Emit1(cx, bce, JSOP_LOOPENTRY) >= 0;
|
||||
/*
|
||||
* Calculate loop depth. Note that this value is just a hint, so
|
||||
* give up for deeply nested loops.
|
||||
*/
|
||||
uint32_t loopDepth = 0;
|
||||
StmtInfoBCE *stmt = bce->topStmt;
|
||||
while (stmt) {
|
||||
if (stmt->isLoop()) {
|
||||
loopDepth++;
|
||||
if (loopDepth >= 5)
|
||||
break;
|
||||
}
|
||||
stmt = stmt->down;
|
||||
}
|
||||
|
||||
JS_ASSERT(loopDepth > 0);
|
||||
return Emit2(cx, bce, JSOP_LOOPENTRY, uint8_t(loopDepth)) >= 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -4530,11 +4546,13 @@ EmitDo(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
||||
ptrdiff_t top = EmitLoopHead(cx, bce, pn->pn_left);
|
||||
if (top < 0)
|
||||
return false;
|
||||
if (!EmitLoopEntry(cx, bce, NULL))
|
||||
return false;
|
||||
|
||||
StmtInfoBCE stmtInfo(cx);
|
||||
PushStatementBCE(bce, &stmtInfo, STMT_DO_LOOP, top);
|
||||
|
||||
if (!EmitLoopEntry(cx, bce, NULL))
|
||||
return false;
|
||||
|
||||
if (!EmitTree(cx, bce, pn->pn_left))
|
||||
return false;
|
||||
|
||||
|
@ -2497,17 +2497,15 @@ ion::UsesBeforeIonRecompile(JSScript *script, jsbytecode *pc)
|
||||
JS_ASSERT(pc == script->code || JSOp(*pc) == JSOP_LOOPENTRY);
|
||||
|
||||
uint32_t minUses = js_IonOptions.usesBeforeCompile;
|
||||
if (JSOp(*pc) != JSOP_LOOPENTRY || !script->hasAnalysis() || js_IonOptions.eagerCompilation)
|
||||
return minUses;
|
||||
|
||||
analyze::LoopAnalysis *loop = script->analysis()->getLoop(pc);
|
||||
if (!loop)
|
||||
if (JSOp(*pc) != JSOP_LOOPENTRY || js_IonOptions.eagerCompilation)
|
||||
return minUses;
|
||||
|
||||
// It's more efficient to enter outer loops, rather than inner loops, via OSR.
|
||||
// To accomplish this, we use a slightly higher threshold for inner loops.
|
||||
// Note that we use +1 to prefer non-OSR over OSR.
|
||||
return minUses + (loop->depth + 1) * 100;
|
||||
// Note that the loop depth is always > 0 so we will prefer non-OSR over OSR.
|
||||
uint32_t loopDepth = GET_UINT8(pc);
|
||||
JS_ASSERT(loopDepth > 0);
|
||||
return minUses + loopDepth * 100;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -536,8 +536,12 @@ OPDEF(JSOP_TOID, 225, "toid", NULL, 1, 1, 1, 0, JOF_BYTE)
|
||||
/* Push the implicit 'this' value for calls to the associated name. */
|
||||
OPDEF(JSOP_IMPLICITTHIS, 226, "implicitthis", "", 5, 0, 1, 0, JOF_ATOM)
|
||||
|
||||
/* This opcode is the target of the entry jump for some loop. */
|
||||
OPDEF(JSOP_LOOPENTRY, 227, "loopentry", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
/*
|
||||
* This opcode is the target of the entry jump for some loop. The uint8 argument
|
||||
* is the loop depth. This value starts at 1 and is just a hint: deeply
|
||||
* nested loops all have the same value.
|
||||
*/
|
||||
OPDEF(JSOP_LOOPENTRY, 227, "loopentry", NULL, 2, 0, 0, 0, JOF_UINT8)
|
||||
|
||||
/* Notes the point at which a value is pushed as an argument. */
|
||||
OPDEF(JSOP_NOTEARG, 228, "notearg", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
|
@ -26,7 +26,7 @@ namespace js {
|
||||
* and saved versions. If deserialization fails, the data should be
|
||||
* invalidated if possible.
|
||||
*/
|
||||
static const uint32_t XDR_BYTECODE_VERSION = uint32_t(0xb973c0de - 142);
|
||||
static const uint32_t XDR_BYTECODE_VERSION = uint32_t(0xb973c0de - 143);
|
||||
|
||||
class XDRBuffer {
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user