Bug 1077720 - IonMonkey: Add a method for clearing the SuccessorWithPhis field r=nbp
--- 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;
}