From 7fee422d04692257e5af5b332dd3a4553fa0d8da Mon Sep 17 00:00:00 2001 From: Blake Kaplan Date: Fri, 13 Feb 2009 13:44:12 -0800 Subject: [PATCH] Bug 478314 - Eagerly call f2i to root out constant values. r=gal --HG-- extra : rebase_source : cef514efb5b94f9974f918b118548e0d6fa06ee3 --- js/src/jstracer.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/js/src/jstracer.cpp b/js/src/jstracer.cpp index bf95a453eb51..c039e1b71d30 100644 --- a/js/src/jstracer.cpp +++ b/js/src/jstracer.cpp @@ -5024,12 +5024,12 @@ JS_REQUIRES_STACK LIns* TraceRecorder::tableswitch() { jsval& v = stackval(-1); - LIns* v_ins = get(&v); - /* no need to guard if condition is constant */ - if (v_ins->isconst() || v_ins->isconstq()) + if (!isNumber(v)) return NULL; - if (!isNumber(v)) + /* no need to guard if condition is constant */ + LIns* v_ins = f2i(get(&v)); + if (v_ins->isconst() || v_ins->isconstq()) return NULL; jsbytecode* pc = cx->fp->regs->pc; @@ -5067,7 +5067,7 @@ TraceRecorder::tableswitch() si->count = high + 1 - low; si->table = 0; si->index = (uint32) -1; - LIns* diff = lir->ins2(LIR_sub, f2i(v_ins), lir->insImm(low)); + LIns* diff = lir->ins2(LIR_sub, v_ins, lir->insImm(low)); LIns* cmp = lir->ins2(LIR_ult, diff, lir->insImm(si->count)); lir->insGuard(LIR_xf, cmp, snapshot(DEFAULT_EXIT)); lir->insStore(diff, lir->insImmPtr(&si->index), lir->insImm(0));