- Support JSOP_CONDSWITCH's JSOP_CASE and extended-jump-offset JSOP_CASEX variants properly.

- Fix sleep-deprived constant conditions due to failure to test flags & CMP_TRY_BRANCH_AFTER_COND!
- Use new TraceRecorder::fuseIf that Andreas added in a few more places where the previous try-branch-after-cond logic was open-coded.
This commit is contained in:
Brendan Eich 2008-08-30 00:01:59 -07:00
Родитель dfb59b7796
Коммит 0c0d3b46d2
2 изменённых файлов: 22 добавлений и 15 удалений

Просмотреть файл

@ -2856,6 +2856,11 @@ TraceRecorder::cmp(LOpcode op, int flags)
ABORT_TRACE("unsupported operand types for cmp");
}
if (flags & CMP_CASE) {
guard(cond, x, BRANCH_EXIT);
return true;
}
/* The interpreter fuses comparisons and the following branch,
so we have to do that here as well. */
if (flags & CMP_TRY_BRANCH_AFTER_COND)
@ -2886,12 +2891,15 @@ TraceRecorder::equal(int flags)
if (!negate)
x = lir->ins_eq0(x);
if (flags & CMP_CASE) {
guard(cond, x, BRANCH_EXIT);
return true;
}
/* The interpreter fuses comparisons and the following branch,
so we have to do that here as well. */
if (CMP_TRY_BRANCH_AFTER_COND) {
if (cx->fp->regs->pc[1] == JSOP_IFEQ || cx->fp->regs->pc[1] == JSOP_IFNE)
guard(cond, x, BRANCH_EXIT);
}
if (flags & CMP_TRY_BRANCH_AFTER_COND)
fuseIf(cx->fp->regs->pc + 1, cond, x);
/* We update the stack after the guard. This is safe since
the guard bails out at the comparison and the interpreter
@ -2907,12 +2915,15 @@ TraceRecorder::equal(int flags)
if (negate)
x = lir->ins_eq0(x);
if (flags & CMP_CASE) {
guard(cond, x, BRANCH_EXIT);
return true;
}
/* The interpreter fuses comparisons and the following branch,
so we have to do that here as well. */
if (CMP_TRY_BRANCH_AFTER_COND) {
if (cx->fp->regs->pc[1] == JSOP_IFEQ || cx->fp->regs->pc[1] == JSOP_IFNE)
guard(cond, x, BRANCH_EXIT);
}
if (flags & CMP_TRY_BRANCH_AFTER_COND)
fuseIf(cx->fp->regs->pc + 1, cond, x);
/* We update the stack after the guard. This is safe since
the guard bails out at the comparison and the interpreter
@ -5245,11 +5256,7 @@ TraceRecorder::record_JSOP_CONDSWITCH()
bool
TraceRecorder::record_JSOP_CASE()
{
#if 0
return equal() && ifop();
#else
return false;
#endif
return equal(CMP_CASE);
}
bool
@ -5432,7 +5439,7 @@ TraceRecorder::record_JSOP_GOSUBX()
bool
TraceRecorder::record_JSOP_CASEX()
{
return equal() && ifop();
return equal(CMP_CASE);
}
bool

Просмотреть файл

@ -279,7 +279,7 @@ class TraceRecorder {
bool incElem(jsint incr, bool pre = true);
bool incName(jsint incr, bool pre = true);
enum { CMP_NEGATE = 1, CMP_TRY_BRANCH_AFTER_COND = 2 };
enum { CMP_NEGATE = 1, CMP_TRY_BRANCH_AFTER_COND = 2, CMP_CASE = 4 };
bool cmp(nanojit::LOpcode op, int flags = 0);
bool equal(int flags = 0);