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

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: Rewrite a comment that was word salad. 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 546c55c091dbc774747545bd377385268cfe3958..6735b9c94b500c89886c51c83846fd9b5bbdfb55 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) &&
srdjan 2012/07/12 16:42:26 Add parenthesis
+ (block_order()[current_index + 1] == block_entry);
}

Powered by Google App Engine
This is Rietveld 408576698