Bug 1329933 - IonMonkey: Add 0 to the range if NaN is in the input range. r=nbp, a=jcristau
authorHannes Verschore <hv1989@gmail.com>
Mon, 16 Jan 2017 12:51:26 +0100
changeset 353646 3cfe2b9f1e9447f4c9a8af911f5d58f18d63a94b
parent 353645 a66dd0e983f270e62cb78c748905e08f2f21fce1
child 353647 dcb1213212c1c75c0530b70162553619c45b7800
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, jcristau
bugs1329933
milestone52.0a2
Bug 1329933 - IonMonkey: Add 0 to the range if NaN is in the input range. r=nbp, a=jcristau
js/src/jit/RangeAnalysis.cpp
--- a/js/src/jit/RangeAnalysis.cpp
+++ b/js/src/jit/RangeAnalysis.cpp
@@ -1213,18 +1213,24 @@ Range::sign(TempAllocator& alloc, const 
                             NegativeZeroFlag(op->canBeNegativeZero()),
                             0);
 }
 
 Range*
 Range::NaNToZero(TempAllocator& alloc, const Range *op)
 {
     Range* copy = new(alloc) Range(*op);
-    if (copy->canBeNaN())
+    if (copy->canBeNaN()) {
         copy->max_exponent_ = Range::IncludesInfinity;
+        if (!copy->canBeZero()) {
+            Range zero;
+            zero.setDoubleSingleton(0);
+            copy->unionWith(&zero);
+        }
+    }
     copy->refineToExcludeNegativeZero();
     return copy;
 }
 
 bool
 Range::negativeZeroMul(const Range* lhs, const Range* rhs)
 {
     // The result can only be negative zero if both sides are finite and they