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

Side by Side Diff: runtime/vm/flow_graph_compiler.cc

Issue 10808008: 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX.
6 6
7 #include "vm/flow_graph_compiler.h" 7 #include "vm/flow_graph_compiler.h"
8 8
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/debugger.h" 10 #include "vm/debugger.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 ASSERT(instr->locs() != NULL); 111 ASSERT(instr->locs() != NULL);
112 EmitInstructionPrologue(instr); 112 EmitInstructionPrologue(instr);
113 pending_deoptimization_env_ = instr->env(); 113 pending_deoptimization_env_ = instr->env();
114 instr->EmitNativeCode(this); 114 instr->EmitNativeCode(this);
115 } 115 }
116 } 116 }
117 if (instr->next() != NULL) { 117 if (instr->next() != NULL) {
118 BlockEntryInstr* successor = instr->next()->AsBlockEntry(); 118 BlockEntryInstr* successor = instr->next()->AsBlockEntry();
119 ASSERT(successor != NULL); 119 ASSERT(successor != NULL);
120 frame_register_allocator()->Spill(); 120 frame_register_allocator()->Spill();
121 if (!IsNextBlock(successor)) { 121 // The block ended with a "goto". We can fall through if it is the
122 // next block in the list. Otherwise, we need a jump.
123 if ((i == block_order().length() - 1) ||
124 (block_order()[i + 1] != successor)) {
122 assembler()->jmp(GetBlockLabel(successor)); 125 assembler()->jmp(GetBlockLabel(successor));
123 } 126 }
124 } 127 }
125 } 128 }
126 } 129 }
127 130
128 131
129 void FlowGraphCompiler::Bailout(const char* reason) { 132 void FlowGraphCompiler::Bailout(const char* reason) {
130 const char* kFormat = "FlowGraphCompiler Bailout: %s %s."; 133 const char* kFormat = "FlowGraphCompiler Bailout: %s %s.";
131 const char* function_name = parsed_function().function().ToCString(); 134 const char* function_name = parsed_function().function().ToCString();
(...skipping 13 matching lines...) Expand all
145 } 148 }
146 149
147 150
148 Label* FlowGraphCompiler::GetBlockLabel( 151 Label* FlowGraphCompiler::GetBlockLabel(
149 BlockEntryInstr* block_entry) const { 152 BlockEntryInstr* block_entry) const {
150 intptr_t block_index = block_entry->postorder_number(); 153 intptr_t block_index = block_entry->postorder_number();
151 return &block_info_[block_index]->label; 154 return &block_info_[block_index]->label;
152 } 155 }
153 156
154 157
155 bool FlowGraphCompiler::IsNextBlock(BlockEntryInstr* block_entry) const { 158 bool FlowGraphCompiler::IsNextBlock(TargetEntryInstr* block_entry) const {
156 intptr_t current_index = reverse_index(current_block()->postorder_number()); 159 intptr_t current_index = reverse_index(current_block()->postorder_number());
157 return (current_index < (block_order().length() - 1)) && 160 return block_order_[current_index + 1] == block_entry;
158 (block_order()[current_index + 1] == block_entry);
159 } 161 }
160 162
161 163
162 void FlowGraphCompiler::GenerateDeferredCode() { 164 void FlowGraphCompiler::GenerateDeferredCode() {
163 for (intptr_t i = 0; i < deopt_stubs_.length(); i++) { 165 for (intptr_t i = 0; i < deopt_stubs_.length(); i++) {
164 deopt_stubs_[i]->GenerateCode(this); 166 deopt_stubs_[i]->GenerateCode(this);
165 } 167 }
166 } 168 }
167 169
168 170
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 reg = AllocateFreeRegister(blocked_registers); 598 reg = AllocateFreeRegister(blocked_registers);
597 } 599 }
598 locs->set_in(i, Location::RegisterLocation(reg)); 600 locs->set_in(i, Location::RegisterLocation(reg));
599 } 601 }
600 602
601 Pop(reg, instr->InputAt(i)); 603 Pop(reg, instr->InputAt(i));
602 } 604 }
603 605
604 // If this instruction is call spill everything that was not consumed by 606 // If this instruction is call spill everything that was not consumed by
605 // input locations. 607 // input locations.
606 if (locs->is_call() || instr->IsBranch() || instr->IsGoto()) { 608 if (locs->is_call() || instr->IsBranch()) {
607 Spill(); 609 Spill();
608 } 610 }
609 611
610 // Allocate all unallocated temp locations. 612 // Allocate all unallocated temp locations.
611 for (intptr_t i = 0; i < locs->temp_count(); i++) { 613 for (intptr_t i = 0; i < locs->temp_count(); i++) {
612 Location loc = locs->temp(i); 614 Location loc = locs->temp(i);
613 if (loc.IsUnallocated()) { 615 if (loc.IsUnallocated()) {
614 ASSERT(loc.policy() == Location::kRequiresRegister); 616 ASSERT(loc.policy() == Location::kRequiresRegister);
615 loc = Location::RegisterLocation( 617 loc = Location::RegisterLocation(
616 AllocateFreeRegister(blocked_registers)); 618 AllocateFreeRegister(blocked_registers));
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 return; 793 return;
792 } 794 }
793 } 795 }
794 796
795 // This move is not blocked. 797 // This move is not blocked.
796 EmitMove(index); 798 EmitMove(index);
797 } 799 }
798 800
799 801
800 } // namespace dart 802 } // namespace dart
OLDNEW
« 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