| Index: runtime/vm/flow_graph_compiler.cc
|
| diff --git a/runtime/vm/flow_graph_compiler.cc b/runtime/vm/flow_graph_compiler.cc
|
| index 329204c6f984e1b1f8cdaf5cc49e370d5c54bb5d..ab31e943ccd049516ce48b17aa8bec12cbfc41d5 100644
|
| --- a/runtime/vm/flow_graph_compiler.cc
|
| +++ b/runtime/vm/flow_graph_compiler.cc
|
| @@ -93,22 +93,23 @@ void FlowGraphCompiler::VisitBlocks() {
|
| ASSERT(frame_register_allocator()->IsSpilled());
|
| assembler()->Comment("B%d", i);
|
| // Compile the block entry.
|
| - set_current_block(block_order()[i]);
|
| - current_block()->PrepareEntry(this);
|
| - Instruction* instr = current_block()->next();
|
| + BlockEntryInstr* entry = block_order()[i];
|
| + set_current_block(entry);
|
| + entry->PrepareEntry(this);
|
| // Compile all successors until an exit, branch, or a block entry.
|
| - while ((instr != NULL) && !instr->IsBlockEntry()) {
|
| + Instruction* instr = entry;
|
| + for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) {
|
| + instr = it.Current();
|
| if (FLAG_code_comments) EmitComment(instr);
|
| ASSERT(instr->locs() != NULL);
|
| EmitInstructionPrologue(instr);
|
| instr->EmitNativeCode(this);
|
| - instr = instr->next();
|
| }
|
| - BlockEntryInstr* successor =
|
| - (instr == NULL) ? NULL : instr->AsBlockEntry();
|
| - if (successor != NULL) {
|
| + if (instr->next() != NULL) {
|
| + BlockEntryInstr* successor = instr->next()->AsBlockEntry();
|
| + ASSERT(successor != NULL);
|
| frame_register_allocator()->Spill();
|
| - // Block ended with a "goto". We can fall through if it is the
|
| + // The block ended with a "goto". We can fall through if it is the
|
| // next block in the list. Otherwise, we need a jump.
|
| if ((i == block_order().length() - 1) ||
|
| (block_order()[i + 1] != successor)) {
|
|
|