| 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 | 8 |
| 9 #include "vm/ast_printer.h" | 9 #include "vm/ast_printer.h" |
| 10 #include "vm/block_scheduler.h" | 10 #include "vm/block_scheduler.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "vm/object.h" | 27 #include "vm/object.h" |
| 28 #include "vm/object_store.h" | 28 #include "vm/object_store.h" |
| 29 #include "vm/os.h" | 29 #include "vm/os.h" |
| 30 #include "vm/parser.h" | 30 #include "vm/parser.h" |
| 31 #include "vm/scanner.h" | 31 #include "vm/scanner.h" |
| 32 #include "vm/symbols.h" | 32 #include "vm/symbols.h" |
| 33 #include "vm/timer.h" | 33 #include "vm/timer.h" |
| 34 | 34 |
| 35 namespace dart { | 35 namespace dart { |
| 36 | 36 |
| 37 DEFINE_FLAG(bool, allocation_sinking, true, |
| 38 "Attempt to sink temporary allocations to side exits"); |
| 39 DEFINE_FLAG(bool, common_subexpression_elimination, true, |
| 40 "Do common subexpression elimination."); |
| 41 DEFINE_FLAG(bool, constant_propagation, true, |
| 42 "Do conditional constant propagation/unreachable code elimination."); |
| 43 DEFINE_FLAG(int, deoptimization_counter_threshold, 16, |
| 44 "How many times we allow deoptimization before we disallow optimization."); |
| 37 DEFINE_FLAG(bool, disassemble, false, "Disassemble dart code."); | 45 DEFINE_FLAG(bool, disassemble, false, "Disassemble dart code."); |
| 38 DEFINE_FLAG(bool, disassemble_optimized, false, "Disassemble optimized code."); | 46 DEFINE_FLAG(bool, disassemble_optimized, false, "Disassemble optimized code."); |
| 39 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler."); | |
| 40 DEFINE_FLAG(bool, trace_compiler, false, "Trace compiler operations."); | |
| 41 DEFINE_FLAG(bool, constant_propagation, true, | |
| 42 "Do conditional constant propagation/unreachable code elimination."); | |
| 43 DEFINE_FLAG(bool, common_subexpression_elimination, true, | |
| 44 "Do common subexpression elimination."); | |
| 45 DEFINE_FLAG(bool, loop_invariant_code_motion, true, | 47 DEFINE_FLAG(bool, loop_invariant_code_motion, true, |
| 46 "Do loop invariant code motion."); | 48 "Do loop invariant code motion."); |
| 47 DEFINE_FLAG(bool, allocation_sinking, true, | |
| 48 "Attempt to sink temporary allocations to side exits"); | |
| 49 DEFINE_FLAG(int, deoptimization_counter_threshold, 16, | |
| 50 "How many times we allow deoptimization before we disallow optimization."); | |
| 51 DEFINE_FLAG(bool, print_flow_graph, false, "Print the IR flow graph."); | 49 DEFINE_FLAG(bool, print_flow_graph, false, "Print the IR flow graph."); |
| 52 DEFINE_FLAG(bool, print_flow_graph_optimized, false, | 50 DEFINE_FLAG(bool, print_flow_graph_optimized, false, |
| 53 "Print the IR flow graph when optimizing."); | 51 "Print the IR flow graph when optimizing."); |
| 54 DEFINE_FLAG(bool, range_analysis, true, "Enable range analysis"); | 52 DEFINE_FLAG(bool, range_analysis, true, "Enable range analysis"); |
| 55 DEFINE_FLAG(bool, reorder_basic_blocks, true, "Enable basic-block reordering."); | 53 DEFINE_FLAG(bool, reorder_basic_blocks, true, "Enable basic-block reordering."); |
| 54 DEFINE_FLAG(bool, trace_compiler, false, "Trace compiler operations."); |
| 55 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler."); |
| 56 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); | 56 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); |
| 57 DEFINE_FLAG(bool, verify_compiler, false, | 57 DEFINE_FLAG(bool, verify_compiler, false, |
| 58 "Enable compiler verification assertions"); | 58 "Enable compiler verification assertions"); |
| 59 |
| 59 DECLARE_FLAG(bool, trace_failed_optimization_attempts); | 60 DECLARE_FLAG(bool, trace_failed_optimization_attempts); |
| 60 | 61 |
| 61 // Compile a function. Should call only if the function has not been compiled. | 62 // Compile a function. Should call only if the function has not been compiled. |
| 62 // Arg0: function object. | 63 // Arg0: function object. |
| 63 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) { | 64 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) { |
| 64 const Function& function = Function::CheckedHandle(arguments.ArgAt(0)); | 65 const Function& function = Function::CheckedHandle(arguments.ArgAt(0)); |
| 65 ASSERT(!function.HasCode()); | 66 ASSERT(!function.HasCode()); |
| 66 const Error& error = Error::Handle(Compiler::CompileFunction(function)); | 67 const Error& error = Error::Handle(Compiler::CompileFunction(function)); |
| 67 if (!error.IsNull()) { | 68 if (!error.IsNull()) { |
| 68 Exceptions::PropagateError(error); | 69 Exceptions::PropagateError(error); |
| (...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 const Object& result = | 945 const Object& result = |
| 945 Object::Handle(isolate->object_store()->sticky_error()); | 946 Object::Handle(isolate->object_store()->sticky_error()); |
| 946 isolate->object_store()->clear_sticky_error(); | 947 isolate->object_store()->clear_sticky_error(); |
| 947 return result.raw(); | 948 return result.raw(); |
| 948 } | 949 } |
| 949 UNREACHABLE(); | 950 UNREACHABLE(); |
| 950 return Object::null(); | 951 return Object::null(); |
| 951 } | 952 } |
| 952 | 953 |
| 953 } // namespace dart | 954 } // namespace dart |
| OLD | NEW |