Bug 789300 - Properly detect NaN truthiness. r=dvander

This commit is contained in:
Sean Stangl 2012-09-18 14:18:38 -07:00
parent b6f4fdb364
commit 142a8f21e6
2 changed files with 6 additions and 2 deletions

View File

@ -330,8 +330,8 @@ LIRGenerator::visitTest(MTest *test)
// Constant Double operand.
if (opd->type() == MIRType_Double && opd->isConstant()) {
double dbl = opd->toConstant()->value().toDouble();
return add(new LGoto(dbl ? ifTrue : ifFalse));
bool result = ToBoolean(opd->toConstant()->value());
return add(new LGoto(result ? ifTrue : ifFalse));
}
// Constant Int32 operand.

View File

@ -0,0 +1,4 @@
function f() {
return (NaN ? 4 : 5);
}
assertEq(f(), 5);