Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3209)

Unified Diff: runtime/vm/flow_graph_compiler.cc

Issue 10735071: Introduce Goto instructions to the flow graph. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tweaked instruction numbering. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/flow_graph_compiler.cc
diff --git a/runtime/vm/flow_graph_compiler.cc b/runtime/vm/flow_graph_compiler.cc
index a1b7eca1575517522dd1e059c0f4109f47aff003..2516a942cd032fb77d9afaacdca8c41461d20542 100644
--- a/runtime/vm/flow_graph_compiler.cc
+++ b/runtime/vm/flow_graph_compiler.cc
@@ -118,10 +118,7 @@ void FlowGraphCompiler::VisitBlocks() {
BlockEntryInstr* successor = instr->next()->AsBlockEntry();
ASSERT(successor != NULL);
frame_register_allocator()->Spill();
- // 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)) {
+ if (!IsNextBlock(successor)) {
assembler()->jmp(GetBlockLabel(successor));
}
}
@@ -155,9 +152,10 @@ Label* FlowGraphCompiler::GetBlockLabel(
}
-bool FlowGraphCompiler::IsNextBlock(TargetEntryInstr* block_entry) const {
+bool FlowGraphCompiler::IsNextBlock(BlockEntryInstr* block_entry) const {
intptr_t current_index = reverse_index(current_block()->postorder_number());
- return block_order_[current_index + 1] == block_entry;
+ return (current_index < (block_order().length() - 1)) &&
+ (block_order()[current_index + 1] == block_entry);
}
@@ -604,7 +602,7 @@ void FrameRegisterAllocator::AllocateRegisters(Instruction* instr) {
// If this instruction is call spill everything that was not consumed by
// input locations.
- if (locs->is_call() || instr->IsBranch()) {
+ if (locs->is_call() || instr->IsBranch() || instr->IsGoto()) {
Spill();
}

Powered by Google App Engine
This is Rietveld 408576698