Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 2f5fa20ec4c3024a854dccc912402e1f91d95b52..7550809ae105f2a6c2e598ef191a93884767ff9c 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -1250,16 +1250,20 @@ void HStackCheckEliminator::Process() { |
if (block->IsLoopHeader()) { |
HBasicBlock* back_edge = block->loop_information()->GetLastBackEdge(); |
HBasicBlock* dominator = back_edge; |
- bool back_edge_dominated_by_call = false; |
- while (dominator != block && !back_edge_dominated_by_call) { |
+ while (true) { |
HInstruction* instr = dominator->first(); |
- while (instr != NULL && !back_edge_dominated_by_call) { |
+ while (instr != NULL) { |
if (instr->IsCall()) { |
RemoveStackCheck(back_edge); |
- back_edge_dominated_by_call = true; |
+ break; |
} |
instr = instr->next(); |
} |
+ |
+ // Done when the loop header is processed. |
+ if (dominator == block) break; |
+ |
+ // Move up the dominator tree. |
dominator = dominator->dominator(); |
} |
} |