If the result of a demoted multiplication is 0, must undemote or we lose -0 (498549, r=dvander).

This commit is contained in:
Andreas Gal 2009-06-17 08:06:21 +01:00
Родитель d7f40bae65
Коммит af1e4816cd
1 изменённых файлов: 8 добавлений и 2 удалений

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

@ -5867,6 +5867,8 @@ TraceRecorder::alu(LOpcode v, jsdouble v0, jsdouble v1, LIns* s0, LIns* s1)
break; break;
case LIR_fmul: case LIR_fmul:
r = v0 * v1; r = v0 * v1;
if (r == 0.0)
goto out;
break; break;
#ifdef NANOJIT_IA32 #ifdef NANOJIT_IA32
case LIR_fdiv: case LIR_fdiv:
@ -5958,8 +5960,12 @@ TraceRecorder::alu(LOpcode v, jsdouble v0, jsdouble v1, LIns* s0, LIns* s1)
* that will inform the oracle and cause a non-demoted trace to be * that will inform the oracle and cause a non-demoted trace to be
* attached that uses floating-point math for this operation. * attached that uses floating-point math for this operation.
*/ */
if (!result->isconst() && (!overflowSafe(v, d0) || !overflowSafe(v, d1))) if (!result->isconst() && (!overflowSafe(v, d0) || !overflowSafe(v, d1))) {
guard(false, lir->ins1(LIR_ov, result), OVERFLOW_EXIT); exit = snapshot(OVERFLOW_EXIT);
guard(false, lir->ins1(LIR_ov, result), exit);
if (v == LIR_mul) // make sure we don't lose a -0
guard(false, lir->ins_eq0(result), exit);
}
break; break;
} }
JS_ASSERT_IF(d0->isconst() && d1->isconst(), JS_ASSERT_IF(d0->isconst() && d1->isconst(),