Chromium Code Reviews| Index: runtime/vm/flow_graph_builder.cc |
| diff --git a/runtime/vm/flow_graph_builder.cc b/runtime/vm/flow_graph_builder.cc |
| index 4f387f971414ebb17531c0859d5693006b903521..44a7fafeadf6aa244e62a19037998d976c5e773d 100644 |
| --- a/runtime/vm/flow_graph_builder.cc |
| +++ b/runtime/vm/flow_graph_builder.cc |
| @@ -610,7 +610,41 @@ void EffectGraphVisitor::VisitDoWhileNode(DoWhileNode* node) { |
| void EffectGraphVisitor::VisitForNode(ForNode* node) { |
| - Bailout("EffectGraphVisitor::VisitForNode"); |
| + EffectGraphVisitor for_initializer(owner(), temp_index()); |
| + node->initializer()->Visit(&for_initializer); |
| + Append(for_initializer); |
| + if (!is_open()) return; |
|
srdjan
2012/03/08 17:55:12
Should this be an assert? Can we have initializers
Kevin Millikin (Google)
2012/03/09 08:52:53
Other than the throw in expression context issue t
|
| + |
| + EffectGraphVisitor for_body(owner(), temp_index()); |
| + node->body()->Visit(&for_body); |
| + if (for_body.is_open()) { |
| + EffectGraphVisitor for_increment(owner(), temp_index()); |
| + node->increment()->Visit(&for_increment); |
| + for_body.Append(for_increment); |
| + } |
| + |
| + if (node->condition() != NULL) { |
| + TestGraphVisitor for_test(owner(), temp_index()); |
| + node->condition()->Visit(&for_test); |
| + TieLoop(for_test, for_body); |
| + return; |
| + } |
| + |
| + // Degenerate cases. An absent condition is implicitly true. No |
| + // normal exit from loop => no back edge. |
| + if (!for_body.is_open()) { |
| + Append(for_body); |
| + return; |
| + } |
| + JoinEntryInstr* join = new JoinEntryInstr(); |
| + AddInstruction(join); |
| + if (for_body.is_empty()) { |
| + join->SetSuccessor(join); |
| + } else { |
| + join->SetSuccessor(for_body.entry()); |
| + for_body.exit()->SetSuccessor(join); |
| + } |
| + CloseFragment(); |
| } |