Rather than just infinite looping, or abort compilation on would-be iloops (bug 803470, r=dvander, a=akeybl)
authorMarty Rosenberg <mrosenberg@mozilla.com>
Fri, 16 Nov 2012 09:12:49 -0500
changeset 117436 ba252f7d3be62338ccc606aa769963f8964a7b4e
parent 117435 3b1b34e903f2755f0ca23ab5c48784dfcb466c19
child 117437 f3dcc488f22f3ded3d5ecf6e56822103d4d8c983
push id1885
push usermrosenberg@mozilla.com
push dateSat, 08 Dec 2012 22:14:12 +0000
treeherdermozilla-beta@ba252f7d3be6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander, akeybl
bugs803470
milestone18.0
Rather than just infinite looping, or abort compilation on would-be iloops (bug 803470, r=dvander, a=akeybl)
js/src/ion/RangeAnalysis.cpp
--- a/js/src/ion/RangeAnalysis.cpp
+++ b/js/src/ion/RangeAnalysis.cpp
@@ -452,17 +452,19 @@ PopFromWorklist(MDefinitionVector &workl
     def->setNotInWorklist();
     return def;
 }
 
 
 bool
 RangeAnalysis::analyze()
 {
+    int numBlocks = 0;
     for (PostorderIterator i(graph_.poBegin()); i != graph_.poEnd(); i++) {
+        numBlocks++;
         MBasicBlock *curBlock = *i;
         if (!curBlock->isLoopHeader())
             continue;
         for (MPhiIterator pi(curBlock->phisBegin()); pi != curBlock->phisEnd(); pi++)
             if (!pi->initCounts())
                 return false;
     }
 
@@ -488,16 +490,18 @@ RangeAnalysis::analyze()
             IonSpew(IonSpew_Range, "Range changed; adding consumers");
             IonSpew(IonSpew_Range, "New range for %d is: (%d, %d)", def->id(), def->range()->lower(), def->range()->upper());
             for (MUseDefIterator use(def); use; use++) {
                 if(!AddToWorklist(worklist, use.def()))
                     return false;
             }
         }
         iters++;
+        if (iters >= numBlocks * 100)
+            return false;
     }
     // Cleanup (in case we stopped due to MAX_ITERS)
     for(size_t i = 0; i < worklist.length(); i++)
         worklist[i]->setNotInWorklist();
 
 
 #ifdef DEBUG
     for (ReversePostorderIterator block(graph_.rpoBegin()); block != graph_.rpoEnd(); block++) {