Bug 1313792 - Handle Int32-Values in RNaNToZero. r=nbp
authorJohannes Schulte <j_schulte@outlook.com>
Mon, 31 Oct 2016 14:48:12 +0100
changeset 321317 82d1209499f2c551d13362f1cf52d291443548bd
parent 321316 f99b99cc076d06251bf16725647d52f65bf17d4d
child 321318 4128e57e39bda4d6fe223e911906c81851d76e70
push id83551
push userryanvm@gmail.com
push dateSun, 06 Nov 2016 20:09:41 +0000
treeherdermozilla-inbound@4128e57e39bd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1313792
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1313792 - Handle Int32-Values in RNaNToZero. r=nbp
js/src/jit/Recover.cpp
--- a/js/src/jit/Recover.cpp
+++ b/js/src/jit/Recover.cpp
@@ -1065,19 +1065,23 @@ RNaNToZero::RNaNToZero(CompactBufferRead
 { }
 
 
 bool
 RNaNToZero::recover(JSContext* cx, SnapshotIterator& iter) const
 {
     RootedValue v(cx, iter.read());
     RootedValue result(cx);
+    MOZ_ASSERT(v.isDouble() || v.isInt32());
 
-    MOZ_ASSERT(v.isDouble());
-    result.setDouble((mozilla::IsNaN(v.toDouble()) || mozilla::IsNegativeZero(v.toDouble())) ? 0.0 : v.toDouble());
+    // x ? x : 0.0
+    if (ToBoolean(v))
+        result = v;
+    else
+        result.setDouble(0.0);
 
     iter.storeInstructionResult(result);
     return true;
 }
 
 bool
 MRegExpMatcher::writeRecoverData(CompactBufferWriter& writer) const
 {