mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 23:05:42 +00:00
Bug 789300 - Properly detect NaN truthiness. r=dvander
This commit is contained in:
parent
b6f4fdb364
commit
142a8f21e6
@ -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.
|
||||
|
4
js/src/jit-test/tests/ion/bug789300.js
Normal file
4
js/src/jit-test/tests/ion/bug789300.js
Normal file
@ -0,0 +1,4 @@
|
||||
function f() {
|
||||
return (NaN ? 4 : 5);
|
||||
}
|
||||
assertEq(f(), 5);
|
Loading…
Reference in New Issue
Block a user