Bug 505003 - TM: Different values for modulo of negative number (-2 % 2). r=graydon.

--HG--
extra : rebase_source : 73987a251e045b77ddc1cf1eb7c1516da46b2b9f
This commit is contained in:
Jason Orendorff 2009-10-23 13:15:10 -05:00
parent 33d1a6f258
commit 12f2581e38
2 changed files with 8 additions and 1 deletions

View File

@ -8156,7 +8156,7 @@ TraceRecorder::alu(LOpcode v, jsdouble v0, jsdouble v1, LIns* s0, LIns* s1)
* If the result is zero, we must exit if the lhs is negative since
* the result is -0 in this case, which is not in the integer domain.
*/
guard(false, lir->ins2i(LIR_lt, d1, 0), exit);
guard(false, lir->ins2i(LIR_lt, d0, 0), exit);
branch->setTarget(lir->ins0(LIR_label));
break;
}

View File

@ -0,0 +1,7 @@
function f(v, e) {
for (var i = 0; i < 9; i++)
v %= e;
return v;
}
f(0, 1);
assertEq(f(-2, 2), -0);