| 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_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/il_printer.h" |
| 21 #include "vm/longjump.h" | 21 #include "vm/longjump.h" |
| 22 #include "vm/object.h" | 22 #include "vm/object.h" |
| 23 #include "vm/object_store.h" | 23 #include "vm/object_store.h" |
| 24 #include "vm/os.h" | 24 #include "vm/os.h" |
| 25 #include "vm/parser.h" | 25 #include "vm/parser.h" |
| 26 #include "vm/scanner.h" | 26 #include "vm/scanner.h" |
| 27 #include "vm/symbols.h" |
| 27 #include "vm/timer.h" | 28 #include "vm/timer.h" |
| 28 | 29 |
| 29 namespace dart { | 30 namespace dart { |
| 30 | 31 |
| 31 DEFINE_FLAG(bool, disassemble, false, "Disassemble dart code."); | 32 DEFINE_FLAG(bool, disassemble, false, "Disassemble dart code."); |
| 32 DEFINE_FLAG(bool, trace_compiler, false, "Trace compiler operations."); | 33 DEFINE_FLAG(bool, trace_compiler, false, "Trace compiler operations."); |
| 33 DEFINE_FLAG(int, deoptimization_counter_threshold, 5, | 34 DEFINE_FLAG(int, deoptimization_counter_threshold, 5, |
| 34 "How many times we allow deoptimization before we disallow" | 35 "How many times we allow deoptimization before we disallow" |
| 35 " certain optimizations"); | 36 " certain optimizations"); |
| 36 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler."); | 37 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler."); |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 isolate->set_long_jump_base(&jump); | 433 isolate->set_long_jump_base(&jump); |
| 433 if (setjmp(*jump.Set()) == 0) { | 434 if (setjmp(*jump.Set()) == 0) { |
| 434 if (FLAG_trace_compiler) { | 435 if (FLAG_trace_compiler) { |
| 435 OS::Print("compiling expression: "); | 436 OS::Print("compiling expression: "); |
| 436 AstPrinter::PrintNode(fragment); | 437 AstPrinter::PrintNode(fragment); |
| 437 } | 438 } |
| 438 | 439 |
| 439 // Create a dummy function object for the code generator. | 440 // Create a dummy function object for the code generator. |
| 440 const char* kEvalConst = "eval_const"; | 441 const char* kEvalConst = "eval_const"; |
| 441 const Function& func = Function::Handle(Function::New( | 442 const Function& func = Function::Handle(Function::New( |
| 442 String::Handle(String::NewSymbol(kEvalConst)), | 443 String::Handle(Symbols::New(kEvalConst)), |
| 443 RawFunction::kConstImplicitGetter, | 444 RawFunction::kConstImplicitGetter, |
| 444 true, // static function. | 445 true, // static function. |
| 445 false, // not const function. | 446 false, // not const function. |
| 446 fragment->token_pos())); | 447 fragment->token_pos())); |
| 447 | 448 |
| 448 func.set_result_type(Type::Handle(Type::DynamicType())); | 449 func.set_result_type(Type::Handle(Type::DynamicType())); |
| 449 func.set_num_fixed_parameters(0); | 450 func.set_num_fixed_parameters(0); |
| 450 func.set_num_optional_parameters(0); | 451 func.set_num_optional_parameters(0); |
| 451 | 452 |
| 452 // The function needs to be associated with a named Class: the interface | 453 // The function needs to be associated with a named Class: the interface |
| (...skipping 29 matching lines...) Expand all Loading... |
| 482 isolate->object_store()->clear_sticky_error(); | 483 isolate->object_store()->clear_sticky_error(); |
| 483 isolate->set_long_jump_base(base); | 484 isolate->set_long_jump_base(base); |
| 484 return result.raw(); | 485 return result.raw(); |
| 485 } | 486 } |
| 486 UNREACHABLE(); | 487 UNREACHABLE(); |
| 487 return Object::null(); | 488 return Object::null(); |
| 488 } | 489 } |
| 489 | 490 |
| 490 | 491 |
| 491 } // namespace dart | 492 } // namespace dart |
| OLD | NEW |