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

Side by Side Diff: vm/compiler.cc

Issue 10635020: Add new files and data structures for the new register allocator. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 6 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 | vm/flow_graph_allocator.h » ('j') | 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_builder.h" 17 #include "vm/flow_graph_builder.h"
17 #include "vm/flow_graph_compiler.h" 18 #include "vm/flow_graph_compiler.h"
18 #include "vm/flow_graph_optimizer.h" 19 #include "vm/flow_graph_optimizer.h"
19 #include "vm/longjump.h" 20 #include "vm/longjump.h"
20 #include "vm/object.h" 21 #include "vm/object.h"
21 #include "vm/object_store.h" 22 #include "vm/object_store.h"
22 #include "vm/opt_code_generator.h" 23 #include "vm/opt_code_generator.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
30 DEFINE_FLAG(bool, disassemble, false, "Disassemble dart code."); 31 DEFINE_FLAG(bool, disassemble, false, "Disassemble dart code.");
31 DEFINE_FLAG(bool, trace_compiler, false, "Trace compiler operations."); 32 DEFINE_FLAG(bool, trace_compiler, false, "Trace compiler operations.");
32 DEFINE_FLAG(int, deoptimization_counter_threshold, 5, 33 DEFINE_FLAG(int, deoptimization_counter_threshold, 5,
33 "How many times we allow deoptimization before we disallow" 34 "How many times we allow deoptimization before we disallow"
34 " certain optimizations"); 35 " certain optimizations");
35 DEFINE_FLAG(bool, use_new_compiler, true, "Use the new compiler backend."); 36 DEFINE_FLAG(bool, use_new_compiler, true, "Use the new compiler backend.");
36 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from new compiler."); 37 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from new compiler.");
38 DECLARE_FLAG(bool, use_ssa);
37 39
38 40
39 // Compile a function. Should call only if the function has not been compiled. 41 // Compile a function. Should call only if the function has not been compiled.
40 // Arg0: function object. 42 // Arg0: function object.
41 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) { 43 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) {
42 ASSERT(arguments.Count() == kCompileFunctionRuntimeEntry.argument_count()); 44 ASSERT(arguments.Count() == kCompileFunctionRuntimeEntry.argument_count());
43 const Function& function = Function::CheckedHandle(arguments.At(0)); 45 const Function& function = Function::CheckedHandle(arguments.At(0));
44 ASSERT(!function.HasCode()); 46 ASSERT(!function.HasCode());
45 const Error& error = Error::Handle(Compiler::CompileFunction(function)); 47 const Error& error = Error::Handle(Compiler::CompileFunction(function));
46 if (!error.IsNull()) { 48 if (!error.IsNull()) {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 // The non-optimizing compiler compiles blocks in reverse postorder, 188 // The non-optimizing compiler compiles blocks in reverse postorder,
187 // because it is a 'natural' order for the human reader of the 189 // because it is a 'natural' order for the human reader of the
188 // generated code. 190 // generated code.
189 intptr_t length = graph_builder.postorder_block_entries().length(); 191 intptr_t length = graph_builder.postorder_block_entries().length();
190 for (intptr_t i = length - 1; i >= 0; --i) { 192 for (intptr_t i = length - 1; i >= 0; --i) {
191 block_order.Add(graph_builder.postorder_block_entries()[i]); 193 block_order.Add(graph_builder.postorder_block_entries()[i]);
192 } 194 }
193 if (optimized) { 195 if (optimized) {
194 FlowGraphOptimizer optimizer(block_order); 196 FlowGraphOptimizer optimizer(block_order);
195 optimizer.ApplyICData(); 197 optimizer.ApplyICData();
198
199 if (FLAG_use_ssa) {
200 // Perform register allocation on the SSA graph.
201 FlowGraphAllocator allocator(block_order);
202 allocator.ResolveConstraints();
203
204 // Temporary bailout until we support code generation from SSA form.
205 graph_builder.Bailout("No SSA code generation support.");
206 }
196 } 207 }
197 } 208 }
198 209
199 Assembler assembler; 210 Assembler assembler;
200 FlowGraphCompiler graph_compiler(&assembler, parsed_function, 211 FlowGraphCompiler graph_compiler(&assembler, parsed_function,
201 block_order, optimized); 212 block_order, optimized);
202 { 213 {
203 TimerScope timer(FLAG_compiler_stats, 214 TimerScope timer(FLAG_compiler_stats,
204 &CompilerStats::graphcompiler_timer, 215 &CompilerStats::graphcompiler_timer,
205 isolate); 216 isolate);
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 isolate->object_store()->clear_sticky_error(); 579 isolate->object_store()->clear_sticky_error();
569 isolate->set_long_jump_base(base); 580 isolate->set_long_jump_base(base);
570 return result.raw(); 581 return result.raw();
571 } 582 }
572 UNREACHABLE(); 583 UNREACHABLE();
573 return Object::null(); 584 return Object::null();
574 } 585 }
575 586
576 587
577 } // namespace dart 588 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | vm/flow_graph_allocator.h » ('j') | vm/flow_graph_allocator.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698