Bug 916413 - Odinmonkey: Disable attempts to hoist bounds checks when compiling asm.js code as it is not applicable. r=luke
authorDouglas Crosher <dtc-moz@scieneer.com>
Sat, 14 Sep 2013 16:31:46 +1000
changeset 161359 6bfcffd02d97ef9cb013dc0c459d3d5d449a9b14
parent 161358 06f35795582a074630fd284ddd3c8e415f70ca9a
child 161360 d63424e06b3e161bf5baa141d0e1494f6c5a65de
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs916413
milestone27.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 916413 - Odinmonkey: Disable attempts to hoist bounds checks when compiling asm.js code as it is not applicable. r=luke
js/src/jit/RangeAnalysis.cpp
--- a/js/src/jit/RangeAnalysis.cpp
+++ b/js/src/jit/RangeAnalysis.cpp
@@ -1283,43 +1283,45 @@ RangeAnalysis::analyzeLoop(MBasicBlock *
 #endif
 
     // Try to compute symbolic bounds for the phi nodes at the head of this
     // loop, expressed in terms of the iteration bound just computed.
 
     for (MPhiIterator iter(header->phisBegin()); iter != header->phisEnd(); iter++)
         analyzeLoopPhi(header, iterationBound, *iter);
 
-    // Try to hoist any bounds checks from the loop using symbolic bounds.
+    if (!mir->compilingAsmJS()) {
+        // Try to hoist any bounds checks from the loop using symbolic bounds.
 
-    Vector<MBoundsCheck *, 0, IonAllocPolicy> hoistedChecks;
+        Vector<MBoundsCheck *, 0, IonAllocPolicy> hoistedChecks;
 
-    for (ReversePostorderIterator iter(graph_.rpoBegin(header)); iter != graph_.rpoEnd(); iter++) {
-        MBasicBlock *block = *iter;
-        if (!block->isMarked())
-            continue;
+        for (ReversePostorderIterator iter(graph_.rpoBegin(header)); iter != graph_.rpoEnd(); iter++) {
+            MBasicBlock *block = *iter;
+            if (!block->isMarked())
+                continue;
 
-        for (MDefinitionIterator iter(block); iter; iter++) {
-            MDefinition *def = *iter;
-            if (def->isBoundsCheck() && def->isMovable()) {
-                if (tryHoistBoundsCheck(header, def->toBoundsCheck()))
-                    hoistedChecks.append(def->toBoundsCheck());
+            for (MDefinitionIterator iter(block); iter; iter++) {
+                MDefinition *def = *iter;
+                if (def->isBoundsCheck() && def->isMovable()) {
+                    if (tryHoistBoundsCheck(header, def->toBoundsCheck()))
+                        hoistedChecks.append(def->toBoundsCheck());
+                }
             }
         }
-    }
 
-    // Note: replace all uses of the original bounds check with the
-    // actual index. This is usually done during bounds check elimination,
-    // but in this case it's safe to do it here since the load/store is
-    // definitely not loop-invariant, so we will never move it before
-    // one of the bounds checks we just added.
-    for (size_t i = 0; i < hoistedChecks.length(); i++) {
-        MBoundsCheck *ins = hoistedChecks[i];
-        ins->replaceAllUsesWith(ins->index());
-        ins->block()->discard(ins);
+        // Note: replace all uses of the original bounds check with the
+        // actual index. This is usually done during bounds check elimination,
+        // but in this case it's safe to do it here since the load/store is
+        // definitely not loop-invariant, so we will never move it before
+        // one of the bounds checks we just added.
+        for (size_t i = 0; i < hoistedChecks.length(); i++) {
+            MBoundsCheck *ins = hoistedChecks[i];
+            ins->replaceAllUsesWith(ins->index());
+            ins->block()->discard(ins);
+        }
     }
 
     graph_.unmarkBlocks();
 }
 
 LoopIterationBound *
 RangeAnalysis::analyzeLoopIterationCount(MBasicBlock *header,
                                          MTest *test, BranchDirection direction)