Bug 894582 - IonMonkey: Constant fold arithm operations with double output that fits in int32. r=jandem

This commit is contained in:
Hannes Verschore 2013-07-19 16:21:05 -04:00
parent 9f146077b1
commit 0d2f2c46c9

View File

@ -122,6 +122,11 @@ EvaluateConstantOperands(MBinaryInstruction *ins, bool *ptypeChange = NULL)
MOZ_ASSUME_UNREACHABLE("NYI");
}
// setNumber eagerly transforms a number to int32.
// Transform back to double, if the output type is double.
if (ins->type() == MIRType_Double && ret.isInt32())
ret.setDouble(ret.toNumber());
if (ins->type() != MIRTypeFromValue(ret)) {
if (ptypeChange)
*ptypeChange = true;