Bug 866866 - Inspect phis at the start of loop header rather than trailing values, r=dvander.
authorBrian Hackett <bhackett1024@gmail.com>
Wed, 01 May 2013 18:06:01 -0600
changeset 130575 0a050b75a9af850ef89307e9839e9d54afd424c0
parent 130574 cdfa3301b1725d0545fd1cfa7f82b84eb46d48ae
child 130576 b035b05f6a18d709a24aea791bbbcace8115d621
push id1579
push userphilringnalda@gmail.com
push dateSat, 04 May 2013 04:38:04 +0000
treeherderfx-team@a56432a42a41 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
bugs866866
milestone23.0a1
Bug 866866 - Inspect phis at the start of loop header rather than trailing values, r=dvander.
js/src/ion/IonBuilder.cpp
--- a/js/src/ion/IonBuilder.cpp
+++ b/js/src/ion/IonBuilder.cpp
@@ -900,24 +900,28 @@ IonBuilder::maybeAddOsrTypeBarriers()
     // the types in the preheader.
 
     MBasicBlock *osrBlock = graph().osrBlock();
     MBasicBlock *preheader = osrBlock->getSuccessor(0);
     MBasicBlock *header = preheader->getSuccessor(0);
     static const size_t OSR_PHI_POSITION = 1;
     JS_ASSERT(preheader->getPredecessor(OSR_PHI_POSITION) == osrBlock);
 
-    for (uint32_t i = info().startArgSlot(); i < osrBlock->stackDepth(); i++) {
+    MPhiIterator headerPhi = header->phisBegin();
+    while (headerPhi != header->phisEnd() && headerPhi->slot() < info().startArgSlot())
+        headerPhi++;
+
+    for (uint32_t i = info().startArgSlot(); i < osrBlock->stackDepth(); i++, headerPhi++) {
         MInstruction *def = osrBlock->getSlot(i)->toOsrValue();
 
-        MDefinition *headerValue = header->getSlot(i);
+        JS_ASSERT(headerPhi->slot() == i);
         MPhi *preheaderPhi = preheader->getSlot(i)->toPhi();
 
-        MIRType type = headerValue->type();
-        types::StackTypeSet *typeSet = headerValue->resultTypeSet();
+        MIRType type = headerPhi->type();
+        types::StackTypeSet *typeSet = headerPhi->resultTypeSet();
 
         if (!addOsrValueTypeBarrier(i, &def, type, typeSet))
             return false;
 
         preheaderPhi->replaceOperand(OSR_PHI_POSITION, def);
         preheaderPhi->setResultType(type);
         preheaderPhi->setResultTypeSet(typeSet);
     }