[INFER] Fix constant double RHS in >>>, bug 617433.

This commit is contained in:
Brian Hackett 2010-12-07 13:53:45 -08:00
parent 218d38d4e2
commit cc2da1d24f
2 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,12 @@
// don't crash
function foo(x) {
(x >>> 3.14);
(x >>> true);
(x >>> (0/0));
(x >>> 100);
(x >>> -10);
(x >>> (1/0));
(x >>> (void 0));
}
foo(10);

View File

@ -279,6 +279,10 @@ mjit::Compiler::jsop_bitop(JSOp op)
return;
}
/* Convert a double RHS to integer if it's constant for the test below. */
if (rhs->isConstant() && rhs->getValue().isDouble())
rhs->convertConstantDoubleToInt32(cx);
/* We only want to handle integers here. */
if ((lhs->isNotType(JSVAL_TYPE_INT32) && lhs->isNotType(JSVAL_TYPE_DOUBLE)) ||
(rhs->isNotType(JSVAL_TYPE_INT32) && rhs->isNotType(JSVAL_TYPE_DOUBLE)) ||