mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Fixed breaks in switch statements causing premature end-of-traces (bug 456345, r=gal,brendan).
This commit is contained in:
parent
c184542b3b
commit
a53ee95a20
@ -4622,7 +4622,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
|||||||
ale = NULL;
|
ale = NULL;
|
||||||
while (!STMT_IS_LOOP(stmt) && stmt->type != STMT_SWITCH)
|
while (!STMT_IS_LOOP(stmt) && stmt->type != STMT_SWITCH)
|
||||||
stmt = stmt->down;
|
stmt = stmt->down;
|
||||||
noteType = SRC_BREAK;
|
noteType = (stmt->type == STMT_SWITCH) ? SRC_NULL : SRC_BREAK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EmitGoto(cx, cg, stmt, &stmt->breaks, ale, noteType) < 0)
|
if (EmitGoto(cx, cg, stmt, &stmt->breaks, ale, noteType) < 0)
|
||||||
|
@ -1832,7 +1832,7 @@ TraceRecorder::closeLoop(Fragmento* fragmento)
|
|||||||
}
|
}
|
||||||
compile(fragmento);
|
compile(fragmento);
|
||||||
|
|
||||||
debug_only_v(printf("recording completed at %s:%u@%u\n", cx->fp->script->filename,
|
debug_only_v(printf("recording completed at %s:%u@%u via closeLoop\n", cx->fp->script->filename,
|
||||||
js_PCToLineNumber(cx, cx->fp->script, cx->fp->regs->pc),
|
js_PCToLineNumber(cx, cx->fp->script, cx->fp->regs->pc),
|
||||||
cx->fp->regs->pc - cx->fp->script->code););
|
cx->fp->regs->pc - cx->fp->script->code););
|
||||||
}
|
}
|
||||||
@ -1844,6 +1844,10 @@ TraceRecorder::endLoop(Fragmento* fragmento)
|
|||||||
SideExit *exit = snapshot(LOOP_EXIT);
|
SideExit *exit = snapshot(LOOP_EXIT);
|
||||||
fragment->lastIns = lir->insGuard(LIR_x, lir->insImm(1), exit);
|
fragment->lastIns = lir->insGuard(LIR_x, lir->insImm(1), exit);
|
||||||
compile(fragmento);
|
compile(fragmento);
|
||||||
|
|
||||||
|
debug_only_v(printf("recording completed at %s:%u@%u via endLoop\n", cx->fp->script->filename,
|
||||||
|
js_PCToLineNumber(cx, cx->fp->script, cx->fp->regs->pc),
|
||||||
|
cx->fp->regs->pc - cx->fp->script->code););
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Emit code to adjust the stack to match the inner tree's stack expectations. */
|
/* Emit code to adjust the stack to match the inner tree's stack expectations. */
|
||||||
@ -1890,7 +1894,6 @@ TraceRecorder::prepareTreeCall(Fragment* inner)
|
|||||||
void
|
void
|
||||||
TraceRecorder::emitTreeCall(Fragment* inner, GuardRecord* lr)
|
TraceRecorder::emitTreeCall(Fragment* inner, GuardRecord* lr)
|
||||||
{
|
{
|
||||||
JS_ASSERT(lr->exit->exitType == LOOP_EXIT && !lr->calldepth);
|
|
||||||
TreeInfo* ti = (TreeInfo*)inner->vmprivate;
|
TreeInfo* ti = (TreeInfo*)inner->vmprivate;
|
||||||
/* Invoke the inner tree. */
|
/* Invoke the inner tree. */
|
||||||
LIns* args[] = { INS_CONSTPTR(inner), lirbuf->state }; /* reverse order */
|
LIns* args[] = { INS_CONSTPTR(inner), lirbuf->state }; /* reverse order */
|
||||||
@ -2446,6 +2449,8 @@ js_ExecuteTree(JSContext* cx, Fragment** treep, uintN& inlineCallCount,
|
|||||||
lr = u.func(&state, NULL);
|
lr = u.func(&state, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
JS_ASSERT(lr->exit->exitType != LOOP_EXIT || !lr->calldepth);
|
||||||
|
|
||||||
if (!onTrace)
|
if (!onTrace)
|
||||||
tm->onTrace = false;
|
tm->onTrace = false;
|
||||||
|
|
||||||
|
@ -1583,6 +1583,32 @@ function testMatchStringObject() {
|
|||||||
testMatchStringObject.expected = null;
|
testMatchStringObject.expected = null;
|
||||||
test(testMatchStringObject);
|
test(testMatchStringObject);
|
||||||
|
|
||||||
|
function innerSwitch(k)
|
||||||
|
{
|
||||||
|
var m = 0;
|
||||||
|
|
||||||
|
switch (k)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
m = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
function testInnerSwitchBreak()
|
||||||
|
{
|
||||||
|
var r = new Array(5);
|
||||||
|
for (var i = 0; i < 5; i++)
|
||||||
|
{
|
||||||
|
r[i] = innerSwitch(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return r.join(",");
|
||||||
|
}
|
||||||
|
testInnerSwitchBreak.expected = "1,1,1,1,1";
|
||||||
|
test(testInnerSwitchBreak);
|
||||||
|
|
||||||
/* Keep these at the end so that we can see the summary after the trace-debug spew. */
|
/* Keep these at the end so that we can see the summary after the trace-debug spew. */
|
||||||
print("\npassed:", passes.length && passes.join(","));
|
print("\npassed:", passes.length && passes.join(","));
|
||||||
print("\nFAILED:", fails.length && fails.join(","));
|
print("\nFAILED:", fails.length && fails.join(","));
|
||||||
|
Loading…
Reference in New Issue
Block a user