| 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" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 namespace dart { | 32 namespace dart { |
| 33 | 33 |
| 34 DEFINE_FLAG(bool, disassemble, false, "Disassemble dart code."); | 34 DEFINE_FLAG(bool, disassemble, false, "Disassemble dart code."); |
| 35 DEFINE_FLAG(bool, disassemble_optimized, false, "Disassemble optimized code."); | 35 DEFINE_FLAG(bool, disassemble_optimized, false, "Disassemble optimized code."); |
| 36 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler."); | 36 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler."); |
| 37 DEFINE_FLAG(bool, trace_compiler, false, "Trace compiler operations."); | 37 DEFINE_FLAG(bool, trace_compiler, false, "Trace compiler operations."); |
| 38 DEFINE_FLAG(bool, cp, true, | 38 DEFINE_FLAG(bool, cp, true, |
| 39 "Do conditional constant propagation/unreachable code elimination."); | 39 "Do conditional constant propagation/unreachable code elimination."); |
| 40 DEFINE_FLAG(bool, cse, true, "Do common subexpression elimination."); | 40 DEFINE_FLAG(bool, cse, true, "Do common subexpression elimination."); |
| 41 DEFINE_FLAG(bool, licm, true, "Do loop invariant code motion."); | 41 DEFINE_FLAG(bool, licm, true, "Do loop invariant code motion."); |
| 42 DEFINE_FLAG(bool, propagate_types, true, "Do static type propagation."); |
| 42 DEFINE_FLAG(int, deoptimization_counter_threshold, 5, | 43 DEFINE_FLAG(int, deoptimization_counter_threshold, 5, |
| 43 "How many times we allow deoptimization before we disallow" | 44 "How many times we allow deoptimization before we disallow" |
| 44 " certain optimizations"); | 45 " certain optimizations"); |
| 45 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); | 46 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); |
| 46 DECLARE_FLAG(bool, print_flow_graph); | 47 DECLARE_FLAG(bool, print_flow_graph); |
| 47 | 48 |
| 48 | 49 |
| 49 // Compile a function. Should call only if the function has not been compiled. | 50 // Compile a function. Should call only if the function has not been compiled. |
| 50 // Arg0: function object. | 51 // Arg0: function object. |
| 51 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) { | 52 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 175 |
| 175 // Inlining (mutates the flow graph) | 176 // Inlining (mutates the flow graph) |
| 176 if (FLAG_use_inlining) { | 177 if (FLAG_use_inlining) { |
| 177 FlowGraphInliner inliner(flow_graph); | 178 FlowGraphInliner inliner(flow_graph); |
| 178 inliner.Inline(); | 179 inliner.Inline(); |
| 179 // Verify that the use lists are still valid. | 180 // Verify that the use lists are still valid. |
| 180 DEBUG_ASSERT(flow_graph->ValidateUseLists()); | 181 DEBUG_ASSERT(flow_graph->ValidateUseLists()); |
| 181 } | 182 } |
| 182 | 183 |
| 183 // Propagate types and eliminate more type tests. | 184 // Propagate types and eliminate more type tests. |
| 184 FlowGraphTypePropagator propagator(flow_graph); | 185 if (FLAG_propagate_types) { |
| 185 propagator.PropagateTypes(); | 186 FlowGraphTypePropagator propagator(flow_graph); |
| 187 propagator.PropagateTypes(); |
| 188 } |
| 186 | 189 |
| 187 // Verify that the use lists are still valid. | 190 // Verify that the use lists are still valid. |
| 188 DEBUG_ASSERT(flow_graph->ValidateUseLists()); | 191 DEBUG_ASSERT(flow_graph->ValidateUseLists()); |
| 189 | 192 |
| 190 // Propagate sminess from CheckSmi to phis. | 193 // Propagate sminess from CheckSmi to phis. |
| 191 optimizer.PropagateSminess(); | 194 optimizer.PropagateSminess(); |
| 192 | 195 |
| 193 // Do optimizations that depend on the propagated type information. | 196 // Do optimizations that depend on the propagated type information. |
| 194 optimizer.OptimizeComputations(); | 197 optimizer.OptimizeComputations(); |
| 195 | 198 |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 result = isolate->object_store()->sticky_error(); | 562 result = isolate->object_store()->sticky_error(); |
| 560 isolate->object_store()->clear_sticky_error(); | 563 isolate->object_store()->clear_sticky_error(); |
| 561 isolate->set_long_jump_base(base); | 564 isolate->set_long_jump_base(base); |
| 562 return result.raw(); | 565 return result.raw(); |
| 563 } | 566 } |
| 564 UNREACHABLE(); | 567 UNREACHABLE(); |
| 565 return Object::null(); | 568 return Object::null(); |
| 566 } | 569 } |
| 567 | 570 |
| 568 } // namespace dart | 571 } // namespace dart |
| OLD | NEW |