Bug 1329933 - IonMonkey: add 0 to the range if NaN is in the input range, r=nbp
authorHannes Verschore <hv1989@gmail.com>
Mon, 16 Jan 2017 12:51:26 +0100
changeset 357604 1ec74b000805b9cc0756487b58ac17ad233e4219
parent 357603 22426fbd559b7df850195ffa77af54cbec582eb6
child 357605 f329799b4fae58129f88797ec4ade91b9d7cb9cb
push id10621
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 16:02:43 +0000
treeherdermozilla-aurora@dca7b42e6c67 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1329933
milestone53.0a1
Bug 1329933 - IonMonkey: add 0 to the range if NaN is in the input range, r=nbp
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