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

Unified Diff: runtime/vm/flow_graph_compiler.cc

Issue 10805008: Revert "Revert "Introduce Goto instructions to the flow graph."" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/flow_graph_compiler_ia32.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_compiler.cc
diff --git a/runtime/vm/flow_graph_compiler.cc b/runtime/vm/flow_graph_compiler.cc
index c3360848eb2b68f7ea38dc6d964807670fb22cd9..5dfa90245e5316210e587be25c16ef365079abeb 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);
}
@@ -605,7 +603,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();
}
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/flow_graph_compiler_ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698