Bug 888568 - Range analysis, Handle int32 infinities on MAbs. r=mjrosenb
authorNicolas B. Pierron <nicolas.b.pierron@mozilla.com>
Tue, 02 Jul 2013 17:38:42 -0700
changeset 137230 7af58b3b21ef1bcdc9f1f9eccec0793db92e0273
parent 137229 b0f2330ed678b42c001afe86b85e8a9a63d6ef88
child 137231 170101f09b3cc68a607b0315c6cd9ffa9e7a45a0
push id30451
push usernpierron@mozilla.com
push dateWed, 03 Jul 2013 00:44:27 +0000
treeherdermozilla-inbound@7af58b3b21ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmjrosenb
bugs888568
milestone25.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 888568 - Range analysis, Handle int32 infinities on MAbs. r=mjrosenb
js/src/ion/RangeAnalysis.cpp
js/src/jit-test/tests/ion/bug888568.js
--- a/js/src/ion/RangeAnalysis.cpp
+++ b/js/src/ion/RangeAnalysis.cpp
@@ -677,18 +677,23 @@ MRsh::computeRange()
 void
 MAbs::computeRange()
 {
     if (specialization_ != MIRType_Int32 && specialization_ != MIRType_Double)
         return;
 
     Range other(getOperand(0));
 
-    Range *range = new Range(0,
-                             Max(Abs<int64_t>(other.lower()), Abs<int64_t>(other.upper())),
+    int64_t max = 0;
+    if (other.isInt32())
+        max = Max(Abs<int64_t>(other.lower()), Abs<int64_t>(other.upper()));
+    else
+        max = RANGE_INF_MAX;
+
+    Range *range = new Range(0, max,
                              other.isDecimal(),
                              other.exponent());
     setRange(range);
 }
 
 void
 MAdd::computeRange()
 {
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/ion/bug888568.js
@@ -0,0 +1,5 @@
+function f() {
+    return (42.0 + Math.abs(1.0e60)) | 0;
+}
+assertEq(f(), 0);
+assertEq(f(), 0);