Bug 891070 - IonMonkey: RangeAnalysis simplifications. r=nbp

This commit is contained in:
Dan Gohman 2013-07-08 20:26:27 -07:00
parent 611cee8e51
commit fed7d5f0ff
2 changed files with 9 additions and 8 deletions

View File

@ -609,6 +609,9 @@ class MIRGraph
ReversePostorderIterator rpoBegin() {
return blocks_.begin();
}
ReversePostorderIterator rpoBegin(MBasicBlock *at) {
return blocks_.begin(at);
}
ReversePostorderIterator rpoEnd() {
return blocks_.end();
}

View File

@ -1044,6 +1044,8 @@ RangeAnalysis::markBlocksInLoopBody(MBasicBlock *header, MBasicBlock *current)
void
RangeAnalysis::analyzeLoop(MBasicBlock *header)
{
JS_ASSERT(header->hasUniqueBackedge());
// Try to compute an upper bound on the number of times the loop backedge
// will be taken. Look for tests that dominate the backedge and which have
// an edge leaving the loop body.
@ -1097,17 +1099,14 @@ RangeAnalysis::analyzeLoop(MBasicBlock *header)
// Try to compute symbolic bounds for the phi nodes at the head of this
// loop, expressed in terms of the iteration bound just computed.
for (MDefinitionIterator iter(header); iter; iter++) {
MDefinition *def = *iter;
if (def->isPhi())
analyzeLoopPhi(header, iterationBound, def->toPhi());
}
for (MPhiIterator iter(header->phisBegin()); iter != header->phisEnd(); iter++)
analyzeLoopPhi(header, iterationBound, *iter);
// Try to hoist any bounds checks from the loop using symbolic bounds.
Vector<MBoundsCheck *, 0, IonAllocPolicy> hoistedChecks;
for (ReversePostorderIterator iter(graph_.rpoBegin()); iter != graph_.rpoEnd(); iter++) {
for (ReversePostorderIterator iter(graph_.rpoBegin(header)); iter != graph_.rpoEnd(); iter++) {
MBasicBlock *block = *iter;
if (!block->isMarked())
continue;
@ -1258,8 +1257,7 @@ RangeAnalysis::analyzeLoopPhi(MBasicBlock *header, LoopIterationBound *loopBound
// but is required to change at most N and be either nondecreasing or
// nonincreasing.
if (phi->numOperands() != 2)
return;
JS_ASSERT(phi->numOperands() == 2);
MBasicBlock *preLoop = header->loopPredecessor();
JS_ASSERT(!preLoop->isMarked() && preLoop->successorWithPhis() == header);