Bug 1258397 - Reorder Instruction: Renumber all instructions including the entry blocks. r=bhackett
authorNicolas B. Pierron <nicolas.b.pierron@mozilla.com>
Wed, 30 Mar 2016 12:03:44 +0000
changeset 291061 e7c33724ab9f175ba97ffb3ecdc5ca33c7570848
parent 291060 15a3458b4d114f6494370c5eae2583e77e6c73f5
child 291062 2fb51f179164d21bc4f2c3952d28225bd2099bfa
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbhackett
bugs1258397
milestone48.0a1
Bug 1258397 - Reorder Instruction: Renumber all instructions including the entry blocks. r=bhackett
js/src/jit/InstructionReordering.cpp
--- a/js/src/jit/InstructionReordering.cpp
+++ b/js/src/jit/InstructionReordering.cpp
@@ -48,33 +48,34 @@ jit::ReorderInstructions(MIRGenerator* m
 {
     // Renumber all instructions in the graph as we go.
     size_t nextId = 0;
 
     // List of the headers of any loops we are in.
     Vector<MBasicBlock*, 4, SystemAllocPolicy> loopHeaders;
 
     for (ReversePostorderIterator block(graph.rpoBegin()); block != graph.rpoEnd(); block++) {
+        // Renumber all definitions inside the basic blocks.
+        for (MPhiIterator iter(block->phisBegin()); iter != block->phisEnd(); iter++)
+            iter->setId(nextId++);
+
+        for (MInstructionIterator iter(block->begin()); iter != block->end(); iter++)
+            iter->setId(nextId++);
+
         // Don't reorder instructions within entry blocks, which have special requirements.
         if (*block == graph.entryBlock() || *block == graph.osrBlock())
             continue;
 
         if (block->isLoopHeader()) {
             if (!loopHeaders.append(*block))
                 return false;
         }
 
         MBasicBlock* innerLoop = loopHeaders.empty() ? nullptr : loopHeaders.back();
 
-        for (MPhiIterator iter(block->phisBegin()); iter != block->phisEnd(); iter++)
-            iter->setId(nextId++);
-
-        for (MInstructionIterator iter(block->begin()); iter != block->end(); iter++)
-            iter->setId(nextId++);
-
         MInstruction* top = block->safeInsertTop();
         MInstructionReverseIterator rtop = ++block->rbegin(top);
         for (MInstructionIterator iter(block->begin(top)); iter != block->end(); ) {
             MInstruction* ins = *iter;
 
             // Filter out some instructions which are never reordered.
             if (ins->isEffectful() ||
                 !ins->isMovable() ||