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

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

Issue 10696151: Skeleton of a linear scan register allocator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address comments 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 | « no previous file | runtime/vm/flow_graph_allocator.h » ('j') | runtime/vm/flow_graph_allocator.h » ('J')
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/compiler.h" 5 #include "vm/compiler.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/ast_printer.h" 8 #include "vm/ast_printer.h"
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/code_patcher.h" 10 #include "vm/code_patcher.h"
11 #include "vm/dart_entry.h" 11 #include "vm/dart_entry.h"
12 #include "vm/debugger.h" 12 #include "vm/debugger.h"
13 #include "vm/disassembler.h" 13 #include "vm/disassembler.h"
14 #include "vm/exceptions.h" 14 #include "vm/exceptions.h"
15 #include "vm/flags.h" 15 #include "vm/flags.h"
16 #include "vm/flow_graph_allocator.h" 16 #include "vm/flow_graph_allocator.h"
17 #include "vm/flow_graph_builder.h" 17 #include "vm/flow_graph_builder.h"
18 #include "vm/flow_graph_compiler.h" 18 #include "vm/flow_graph_compiler.h"
19 #include "vm/flow_graph_optimizer.h" 19 #include "vm/flow_graph_optimizer.h"
20 #include "vm/il_printer.h"
20 #include "vm/longjump.h" 21 #include "vm/longjump.h"
21 #include "vm/object.h" 22 #include "vm/object.h"
22 #include "vm/object_store.h" 23 #include "vm/object_store.h"
23 #include "vm/os.h" 24 #include "vm/os.h"
24 #include "vm/parser.h" 25 #include "vm/parser.h"
25 #include "vm/scanner.h" 26 #include "vm/scanner.h"
26 #include "vm/timer.h" 27 #include "vm/timer.h"
27 28
28 namespace dart { 29 namespace dart {
29 30
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 intptr_t length = graph_builder.postorder_block_entries().length(); 162 intptr_t length = graph_builder.postorder_block_entries().length();
162 for (intptr_t i = length - 1; i >= 0; --i) { 163 for (intptr_t i = length - 1; i >= 0; --i) {
163 block_order.Add(graph_builder.postorder_block_entries()[i]); 164 block_order.Add(graph_builder.postorder_block_entries()[i]);
164 } 165 }
165 if (optimized) { 166 if (optimized) {
166 FlowGraphOptimizer optimizer(block_order); 167 FlowGraphOptimizer optimizer(block_order);
167 optimizer.ApplyICData(); 168 optimizer.ApplyICData();
168 169
169 if (use_ssa) { 170 if (use_ssa) {
170 // Perform register allocation on the SSA graph. 171 // Perform register allocation on the SSA graph.
171 FlowGraphAllocator allocator(graph_builder.postorder_block_entries(), 172 FlowGraphAllocator allocator(block_order, &graph_builder);
172 graph_builder.current_ssa_temp_index()); 173 allocator.AllocateRegisters();
173 allocator.ResolveConstraints();
174 allocator.AnalyzeLiveness();
175
176 // Temporary bailout until we support code generation from SSA form.
177 graph_builder.Bailout("No SSA code generation support.");
178 } 174 }
179 } 175 }
180 } 176 }
181 177
182 bool is_leaf = false; 178 bool is_leaf = false;
183 if (optimized) { 179 if (optimized) {
184 FlowGraphAnalyzer analyzer(block_order); 180 FlowGraphAnalyzer analyzer(block_order);
185 analyzer.Analyze(); 181 analyzer.Analyze();
186 is_leaf = analyzer.is_leaf(); 182 is_leaf = analyzer.is_leaf();
187 } 183 }
188 Assembler assembler; 184 Assembler assembler;
189 FlowGraphCompiler graph_compiler(&assembler, parsed_function, 185 FlowGraphCompiler graph_compiler(&assembler,
190 block_order, optimized, is_leaf); 186 parsed_function,
187 block_order,
188 optimized,
189 optimized && use_ssa,
190 is_leaf);
191 { 191 {
192 TimerScope timer(FLAG_compiler_stats, 192 TimerScope timer(FLAG_compiler_stats,
193 &CompilerStats::graphcompiler_timer, 193 &CompilerStats::graphcompiler_timer,
194 isolate); 194 isolate);
195 graph_compiler.CompileGraph(); 195 graph_compiler.CompileGraph();
196 } 196 }
197 { 197 {
198 TimerScope timer(FLAG_compiler_stats, 198 TimerScope timer(FLAG_compiler_stats,
199 &CompilerStats::codefinalizer_timer, 199 &CompilerStats::codefinalizer_timer,
200 isolate); 200 isolate);
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 isolate->object_store()->clear_sticky_error(); 476 isolate->object_store()->clear_sticky_error();
477 isolate->set_long_jump_base(base); 477 isolate->set_long_jump_base(base);
478 return result.raw(); 478 return result.raw();
479 } 479 }
480 UNREACHABLE(); 480 UNREACHABLE();
481 return Object::null(); 481 return Object::null();
482 } 482 }
483 483
484 484
485 } // namespace dart 485 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_allocator.h » ('j') | runtime/vm/flow_graph_allocator.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698