Bug 1077720 - IonMonkey: Add a method for clearing the SuccessorWithPhis field r=nbp
authorDan Gohman <sunfish@mozilla.com>
Wed, 08 Oct 2014 15:04:12 -0700
changeset 209489 49aafe51147f82cfadccdfe86ff761f2f4e9bbc0
parent 209488 c4a22f350c13ca4f2607b3873f80e4ede17f791c
child 209490 e377dd82cb72280b3f8161f8c776adfd6a9986e3
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersnbp
bugs1077720
milestone35.0a1
Bug 1077720 - IonMonkey: Add a method for clearing the SuccessorWithPhis field r=nbp
js/src/jit/MIRGraph.cpp
js/src/jit/MIRGraph.h
--- a/js/src/jit/MIRGraph.cpp
+++ b/js/src/jit/MIRGraph.cpp
@@ -887,17 +887,17 @@ MBasicBlock::discardAllInstructionsStart
 
 void
 MBasicBlock::discardAllPhiOperands()
 {
     for (MPhiIterator iter = phisBegin(); iter != phisEnd(); iter++)
         iter->removeAllOperands();
 
     for (MBasicBlock **pred = predecessors_.begin(); pred != predecessors_.end(); pred++)
-        (*pred)->setSuccessorWithPhis(nullptr, 0);
+        (*pred)->clearSuccessorWithPhis();
 }
 
 void
 MBasicBlock::discardAllPhis()
 {
     discardAllPhiOperands();
     phis_.clear();
 }
@@ -987,17 +987,17 @@ MBasicBlock::discardPhiAt(MPhiIterator &
 
     at->removeAllOperands();
     at->setDiscarded();
 
     MPhiIterator result = phis_.removeAt(at);
 
     if (phis_.empty()) {
         for (MBasicBlock **pred = predecessors_.begin(); pred != predecessors_.end(); pred++)
-            (*pred)->setSuccessorWithPhis(nullptr, 0);
+            (*pred)->clearSuccessorWithPhis();
     }
     return result;
 }
 
 void
 MBasicBlock::flagOperandsOfPrunedBranches(MInstruction *ins)
 {
     // Find the previous resume point which would be used for bailing out.
@@ -1355,17 +1355,17 @@ MBasicBlock::removePredecessorWithoutPhi
     if (isLoopHeader() && hasUniqueBackedge() && backedge() == pred)
         clearLoopHeader();
 
     // Adjust phis.  Note that this can leave redundant phis behind.
     // Don't adjust successorWithPhis() if we haven't constructed this
     // information yet.
     if (pred->successorWithPhis()) {
         MOZ_ASSERT(pred->positionInPhiSuccessor() == predIndex);
-        pred->setSuccessorWithPhis(nullptr, 0);
+        pred->clearSuccessorWithPhis();
         for (size_t j = predIndex+1; j < numPredecessors(); j++)
             getPredecessor(j)->setSuccessorWithPhis(this, j - 1);
     }
 
     // Remove from pred list.
     predecessors_.erase(predecessors_.begin() + predIndex);
 }
 
--- a/js/src/jit/MIRGraph.h
+++ b/js/src/jit/MIRGraph.h
@@ -561,16 +561,19 @@ class MBasicBlock : public TempObject, p
     uint32_t positionInPhiSuccessor() const {
         MOZ_ASSERT(successorWithPhis());
         return positionInPhiSuccessor_;
     }
     void setSuccessorWithPhis(MBasicBlock *successor, uint32_t id) {
         successorWithPhis_ = successor;
         positionInPhiSuccessor_ = id;
     }
+    void clearSuccessorWithPhis() {
+        successorWithPhis_ = nullptr;
+    }
     size_t numSuccessors() const;
     MBasicBlock *getSuccessor(size_t index) const;
     size_t getSuccessorIndex(MBasicBlock *) const;
     size_t getPredecessorIndex(MBasicBlock *) const;
 
     void setLoopDepth(uint32_t loopDepth) {
         loopDepth_ = loopDepth;
     }