Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_index_table.h" | 10 #include "vm/code_index_table.h" |
| 11 #include "vm/code_patcher.h" | 11 #include "vm/code_patcher.h" |
| 12 #include "vm/dart_entry.h" | 12 #include "vm/dart_entry.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_builder.h" | 16 #include "vm/flow_graph_builder.h" |
| 17 #include "vm/flow_graph_compiler.h" | |
| 17 #include "vm/longjump.h" | 18 #include "vm/longjump.h" |
| 18 #include "vm/object.h" | 19 #include "vm/object.h" |
| 19 #include "vm/object_store.h" | 20 #include "vm/object_store.h" |
| 20 #include "vm/opt_code_generator.h" | 21 #include "vm/opt_code_generator.h" |
| 21 #include "vm/os.h" | 22 #include "vm/os.h" |
| 22 #include "vm/parser.h" | 23 #include "vm/parser.h" |
| 23 #include "vm/scanner.h" | 24 #include "vm/scanner.h" |
| 24 #include "vm/timer.h" | 25 #include "vm/timer.h" |
| 25 | 26 |
| 26 namespace dart { | 27 namespace dart { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 TIMERSCOPE(time_compilation); | 116 TIMERSCOPE(time_compilation); |
| 116 ParsedFunction parsed_function(function); | 117 ParsedFunction parsed_function(function); |
| 117 const char* function_fullname = function.ToFullyQualifiedCString(); | 118 const char* function_fullname = function.ToFullyQualifiedCString(); |
| 118 if (FLAG_trace_compiler) { | 119 if (FLAG_trace_compiler) { |
| 119 OS::Print("Compiling %sfunction: '%s' @ token %d\n", | 120 OS::Print("Compiling %sfunction: '%s' @ token %d\n", |
| 120 (optimized ? "optimized " : ""), | 121 (optimized ? "optimized " : ""), |
| 121 function_fullname, | 122 function_fullname, |
| 122 function.token_index()); | 123 function.token_index()); |
| 123 } | 124 } |
| 124 Parser::ParseFunction(&parsed_function); | 125 Parser::ParseFunction(&parsed_function); |
| 125 if (FLAG_use_new_compiler) { | 126 if (FLAG_use_new_compiler) { |
|
srdjan
2012/02/24 23:13:02
ASSERT(!optimized).
Kevin Millikin (Google)
2012/02/27 08:22:07
Done.
| |
| 126 LongJump* old_base = isolate->long_jump_base(); | 127 LongJump* old_base = isolate->long_jump_base(); |
| 127 LongJump bailout_jump; | 128 LongJump bailout_jump; |
| 128 isolate->set_long_jump_base(&bailout_jump); | 129 isolate->set_long_jump_base(&bailout_jump); |
| 129 if (setjmp(*bailout_jump.Set()) == 0) { | 130 if (setjmp(*bailout_jump.Set()) == 0) { |
| 130 FlowGraphBuilder graph_builder(parsed_function); | 131 FlowGraphBuilder graph_builder(parsed_function); |
| 131 graph_builder.BuildGraph(); | 132 graph_builder.BuildGraph(); |
| 133 | |
| 134 // Try to compile on x64 (only for now). | |
| 135 #ifdef TARGET_ARCH_X64 | |
| 136 Assembler assembler; | |
| 137 FlowGraphCompiler graph_compiler(&assembler, | |
| 138 parsed_function, | |
| 139 graph_builder.blocks()); | |
| 140 graph_compiler.CompileGraph(); | |
|
srdjan
2012/02/24 23:13:02
It would be better to implement "dummy" FlowGraphC
Kevin Millikin (Google)
2012/02/27 08:22:07
Agreed. Done.
| |
| 141 #endif | |
| 142 | |
| 132 } else { | 143 } else { |
| 133 // We bailed out. | 144 // We bailed out. |
| 134 Error& bailout_error = Error::Handle( | 145 Error& bailout_error = Error::Handle( |
| 135 isolate->object_store()->sticky_error()); | 146 isolate->object_store()->sticky_error()); |
| 136 isolate->object_store()->clear_sticky_error(); | 147 isolate->object_store()->clear_sticky_error(); |
| 137 if (FLAG_trace_bailout) { | 148 if (FLAG_trace_bailout) { |
| 138 OS::Print("%s\n", bailout_error.ToErrorCString()); | 149 OS::Print("%s\n", bailout_error.ToErrorCString()); |
| 139 } | 150 } |
| 140 } | 151 } |
| 141 isolate->set_long_jump_base(old_base); | 152 isolate->set_long_jump_base(old_base); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 361 } else { | 372 } else { |
| 362 result = isolate->object_store()->sticky_error(); | 373 result = isolate->object_store()->sticky_error(); |
| 363 isolate->object_store()->clear_sticky_error(); | 374 isolate->object_store()->clear_sticky_error(); |
| 364 } | 375 } |
| 365 isolate->set_long_jump_base(base); | 376 isolate->set_long_jump_base(base); |
| 366 return result.raw(); | 377 return result.raw(); |
| 367 } | 378 } |
| 368 | 379 |
| 369 | 380 |
| 370 } // namespace dart | 381 } // namespace dart |
| OLD | NEW |