| 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/flow_graph_builder.h" | 5 #include "vm/flow_graph_builder.h" |
| 6 | 6 |
| 7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
| 8 #include "vm/ast_printer.h" | 8 #include "vm/ast_printer.h" |
| 9 #include "vm/bit_vector.h" | 9 #include "vm/bit_vector.h" |
| 10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 "Eliminate type checks when allowed by static type analysis."); | 35 "Eliminate type checks when allowed by static type analysis."); |
| 36 DEFINE_FLAG(bool, print_ast, false, "Print abstract syntax tree."); | 36 DEFINE_FLAG(bool, print_ast, false, "Print abstract syntax tree."); |
| 37 DEFINE_FLAG(bool, print_scopes, false, "Print scopes of local variables."); | 37 DEFINE_FLAG(bool, print_scopes, false, "Print scopes of local variables."); |
| 38 DEFINE_FLAG(bool, support_debugger, true, "Emit code needed for debugging"); | 38 DEFINE_FLAG(bool, support_debugger, true, "Emit code needed for debugging"); |
| 39 DEFINE_FLAG(bool, trace_type_check_elimination, false, | 39 DEFINE_FLAG(bool, trace_type_check_elimination, false, |
| 40 "Trace type check elimination at compile time."); | 40 "Trace type check elimination at compile time."); |
| 41 DEFINE_FLAG(bool, precompile_collect_closures, false, | 41 DEFINE_FLAG(bool, precompile_collect_closures, false, |
| 42 "Collect all closure functions referenced from compiled code."); | 42 "Collect all closure functions referenced from compiled code."); |
| 43 | 43 |
| 44 DECLARE_FLAG(int, optimization_counter_threshold); | 44 DECLARE_FLAG(int, optimization_counter_threshold); |
| 45 DECLARE_FLAG(bool, profile_vm); |
| 45 DECLARE_FLAG(bool, warn_on_javascript_compatibility); | 46 DECLARE_FLAG(bool, warn_on_javascript_compatibility); |
| 46 DECLARE_FLAG(bool, use_field_guards); | 47 DECLARE_FLAG(bool, use_field_guards); |
| 47 | 48 |
| 48 // Quick access to the locally defined zone() method. | 49 // Quick access to the locally defined zone() method. |
| 49 #define Z (zone()) | 50 #define Z (zone()) |
| 50 | 51 |
| 51 // TODO(srdjan): Allow compiler to add constants as they are encountered in | 52 // TODO(srdjan): Allow compiler to add constants as they are encountered in |
| 52 // the compilation. | 53 // the compilation. |
| 53 const double kCommonDoubleConstants[] = | 54 const double kCommonDoubleConstants[] = |
| 54 {-1.0, -0.5, -0.1, 0.0, 0.1, 0.5, 1.0, 2.0, 4.0, 5.0, | 55 {-1.0, -0.5, -0.1, 0.0, 0.1, 0.5, 1.0, 2.0, 4.0, 5.0, |
| (...skipping 4721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4776 exit_ = for_finally_block.exit_; | 4777 exit_ = for_finally_block.exit_; |
| 4777 } | 4778 } |
| 4778 | 4779 |
| 4779 | 4780 |
| 4780 void EffectGraphVisitor::VisitStopNode(StopNode* node) { | 4781 void EffectGraphVisitor::VisitStopNode(StopNode* node) { |
| 4781 AddInstruction(new(Z) StopInstr(node->message())); | 4782 AddInstruction(new(Z) StopInstr(node->message())); |
| 4782 } | 4783 } |
| 4783 | 4784 |
| 4784 | 4785 |
| 4785 FlowGraph* FlowGraphBuilder::BuildGraph() { | 4786 FlowGraph* FlowGraphBuilder::BuildGraph() { |
| 4787 VMTagScope tagScope(Thread::Current()->isolate(), |
| 4788 VMTag::kCompileFlowGraphBuilderTagId, |
| 4789 FLAG_profile_vm); |
| 4786 if (FLAG_print_ast) { | 4790 if (FLAG_print_ast) { |
| 4787 // Print the function ast before IL generation. | 4791 // Print the function ast before IL generation. |
| 4788 AstPrinter::PrintFunctionNodes(parsed_function()); | 4792 AstPrinter::PrintFunctionNodes(parsed_function()); |
| 4789 } | 4793 } |
| 4790 if (FLAG_print_scopes) { | 4794 if (FLAG_print_scopes) { |
| 4791 AstPrinter::PrintFunctionScope(parsed_function()); | 4795 AstPrinter::PrintFunctionScope(parsed_function()); |
| 4792 } | 4796 } |
| 4793 TargetEntryInstr* normal_entry = | 4797 TargetEntryInstr* normal_entry = |
| 4794 new(Z) TargetEntryInstr(AllocateBlockId(), | 4798 new(Z) TargetEntryInstr(AllocateBlockId(), |
| 4795 CatchClauseNode::kInvalidTryIndex); | 4799 CatchClauseNode::kInvalidTryIndex); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4828 Report::MessageF(Report::kBailout, | 4832 Report::MessageF(Report::kBailout, |
| 4829 Script::Handle(function.script()), | 4833 Script::Handle(function.script()), |
| 4830 function.token_pos(), | 4834 function.token_pos(), |
| 4831 "FlowGraphBuilder Bailout: %s %s", | 4835 "FlowGraphBuilder Bailout: %s %s", |
| 4832 String::Handle(function.name()).ToCString(), | 4836 String::Handle(function.name()).ToCString(), |
| 4833 reason); | 4837 reason); |
| 4834 UNREACHABLE(); | 4838 UNREACHABLE(); |
| 4835 } | 4839 } |
| 4836 | 4840 |
| 4837 } // namespace dart | 4841 } // namespace dart |
| OLD | NEW |