Bug 1313792 - Handle Int32-Values in RNaNToZero. r=nbp
authorJohannes Schulte <j_schulte@outlook.com>
Mon, 31 Oct 2016 14:48:12 +0100
changeset 351376 82d1209499f2c551d13362f1cf52d291443548bd
parent 351375 f99b99cc076d06251bf16725647d52f65bf17d4d
child 351377 4128e57e39bda4d6fe223e911906c81851d76e70
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1313792
milestone52.0a1
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
 {