Bug 1008106 - IonMonkey: Set has-bounds flags after Range::refineInt32BoundsByExponent r=nbp
authorDan Gohman <sunfish@mozilla.com>
Tue, 13 May 2014 20:58:33 -0700
changeset 183051 d6bd79de08f43940eec337b1cc227a531002497f
parent 183050 2e915549578de537e776742455f447d9d6824887
child 183052 370d74cb269d7dbeed3dfc0832385dffa8ef1602
push id43454
push userdgohman@mozilla.com
push dateWed, 14 May 2014 04:01:59 +0000
treeherdermozilla-inbound@d6bd79de08f4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1008106
milestone32.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 1008106 - IonMonkey: Set has-bounds flags after Range::refineInt32BoundsByExponent r=nbp
js/src/jit/RangeAnalysis.cpp
js/src/jit/RangeAnalysis.h
--- a/js/src/jit/RangeAnalysis.cpp
+++ b/js/src/jit/RangeAnalysis.cpp
@@ -448,17 +448,19 @@ Range::intersect(TempAllocator &alloc, c
     // When intersecting F[0,2] (< pow(2, 0+1)) with a range like F[2,4],
     // the naive intersection is I[2,2], but since the max exponent tells us
     // that the value is always less than 2, the intersection is actually empty.
     if (lhs->canHaveFractionalPart_ != rhs->canHaveFractionalPart_ ||
         (lhs->canHaveFractionalPart_ &&
          newHasInt32LowerBound && newHasInt32UpperBound &&
          newLower == newUpper))
     {
-        refineInt32BoundsByExponent(newExponent, &newLower, &newUpper);
+        refineInt32BoundsByExponent(newExponent,
+                                    &newLower, &newHasInt32LowerBound,
+                                    &newUpper, &newHasInt32UpperBound);
 
         // If we're intersecting two ranges that don't overlap, this could also
         // push the bounds past each other, since the actual intersection is
         // the empty set.
         if (newLower > newUpper) {
             *emptyRange = true;
             return nullptr;
         }
@@ -2108,17 +2110,19 @@ Range::wrapAroundToInt32()
 {
     if (!hasInt32Bounds()) {
         setInt32(JSVAL_INT_MIN, JSVAL_INT_MAX);
     } else if (canHaveFractionalPart()) {
         canHaveFractionalPart_ = false;
 
         // Clearing the fractional field may provide an opportunity to refine
         // lower_ or upper_.
-        refineInt32BoundsByExponent(max_exponent_, &lower_, &upper_);
+        refineInt32BoundsByExponent(max_exponent_,
+                                    &lower_, &hasInt32LowerBound_,
+                                    &upper_, &hasInt32UpperBound_);
 
         assertInvariants();
     }
 }
 
 void
 Range::wrapAroundToShiftCount()
 {
--- a/js/src/jit/RangeAnalysis.h
+++ b/js/src/jit/RangeAnalysis.h
@@ -272,22 +272,27 @@ class Range : public TempObject {
     // containing only integers, the old max_exponent_ value may imply a better
     // lower and/or upper bound than was previously available, because they no
     // longer need to be conservative about fractional offsets and the ends of
     // the range.
     //
     // Given an exponent value and pointers to the lower and upper bound values,
     // this function refines the lower and upper bound values to the tighest
     // bound for integer values implied by the exponent.
-    static void refineInt32BoundsByExponent(uint16_t e, int32_t *l, int32_t *h) {
+    static void refineInt32BoundsByExponent(uint16_t e,
+                                            int32_t *l, bool *lb,
+                                            int32_t *h, bool *hb)
+    {
        if (e < MaxInt32Exponent) {
            // pow(2, max_exponent_+1)-1 to compute a maximum absolute value.
            int32_t limit = (uint32_t(1) << (e + 1)) - 1;
            *h = Min(*h, limit);
            *l = Max(*l, -limit);
+           *hb = true;
+           *lb = true;
        }
     }
 
     // If the value of any of the fields implies a stronger possible value for
     // any other field, update that field to the stronger value. The range must
     // be completely valid before and it is guaranteed to be kept valid.
     void optimize() {
         assertInvariants();