| 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/code_generator.h" | 10 #include "vm/code_generator.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 "Do conditional constant propagation/unreachable code elimination."); | 41 "Do conditional constant propagation/unreachable code elimination."); |
| 42 DEFINE_FLAG(bool, common_subexpression_elimination, true, | 42 DEFINE_FLAG(bool, common_subexpression_elimination, true, |
| 43 "Do common subexpression elimination."); | 43 "Do common subexpression elimination."); |
| 44 DEFINE_FLAG(bool, loop_invariant_code_motion, true, | 44 DEFINE_FLAG(bool, loop_invariant_code_motion, true, |
| 45 "Do loop invariant code motion."); | 45 "Do loop invariant code motion."); |
| 46 DEFINE_FLAG(bool, propagate_types, true, "Do static type propagation."); | 46 DEFINE_FLAG(bool, propagate_types, true, "Do static type propagation."); |
| 47 DEFINE_FLAG(bool, allocation_sinking, true, | 47 DEFINE_FLAG(bool, allocation_sinking, true, |
| 48 "attempt to sink temporary allocations to side exits"); | 48 "attempt to sink temporary allocations to side exits"); |
| 49 DEFINE_FLAG(int, deoptimization_counter_threshold, 16, | 49 DEFINE_FLAG(int, deoptimization_counter_threshold, 16, |
| 50 "How many times we allow deoptimization before we disallow optimization."); | 50 "How many times we allow deoptimization before we disallow optimization."); |
| 51 DEFINE_FLAG(int, deoptimization_counter_licm_threshold, 8, |
| 52 "How many times we allow deoptimization before we disable LICM."); |
| 51 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); | 53 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); |
| 52 DEFINE_FLAG(bool, range_analysis, true, "Enable range analysis"); | 54 DEFINE_FLAG(bool, range_analysis, true, "Enable range analysis"); |
| 53 DEFINE_FLAG(bool, verify_compiler, false, | 55 DEFINE_FLAG(bool, verify_compiler, false, |
| 54 "Enable compiler verification assertions"); | 56 "Enable compiler verification assertions"); |
| 55 DECLARE_FLAG(bool, print_flow_graph); | 57 DECLARE_FLAG(bool, print_flow_graph); |
| 56 DECLARE_FLAG(bool, print_flow_graph_optimized); | 58 DECLARE_FLAG(bool, print_flow_graph_optimized); |
| 57 DECLARE_FLAG(bool, trace_failed_optimization_attempts); | 59 DECLARE_FLAG(bool, trace_failed_optimization_attempts); |
| 58 | 60 |
| 59 // Compile a function. Should call only if the function has not been compiled. | 61 // Compile a function. Should call only if the function has not been compiled. |
| 60 // Arg0: function object. | 62 // Arg0: function object. |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 395 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
| 394 // Do another round of CSE to take secondary effects into account: | 396 // Do another round of CSE to take secondary effects into account: |
| 395 // e.g. when eliminating dependent loads (a.x[0] + a.x[0]) | 397 // e.g. when eliminating dependent loads (a.x[0] + a.x[0]) |
| 396 // TODO(fschneider): Change to a one-pass optimization pass. | 398 // TODO(fschneider): Change to a one-pass optimization pass. |
| 397 DominatorBasedCSE::Optimize(flow_graph); | 399 DominatorBasedCSE::Optimize(flow_graph); |
| 398 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 400 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
| 399 } | 401 } |
| 400 } | 402 } |
| 401 if (FLAG_loop_invariant_code_motion && | 403 if (FLAG_loop_invariant_code_motion && |
| 402 (function.deoptimization_counter() < | 404 (function.deoptimization_counter() < |
| 403 (FLAG_deoptimization_counter_threshold - 1))) { | 405 FLAG_deoptimization_counter_licm_threshold)) { |
| 404 LICM licm(flow_graph); | 406 LICM licm(flow_graph); |
| 405 licm.Optimize(); | 407 licm.Optimize(); |
| 406 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 408 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
| 407 } | 409 } |
| 408 flow_graph->RemoveRedefinitions(); | 410 flow_graph->RemoveRedefinitions(); |
| 409 | 411 |
| 410 if (FLAG_range_analysis) { | 412 if (FLAG_range_analysis) { |
| 411 if (FLAG_propagate_types) { | 413 if (FLAG_propagate_types) { |
| 412 // Propagate types after store-load-forwarding. Some phis may have | 414 // Propagate types after store-load-forwarding. Some phis may have |
| 413 // become smi phis that can be processed by range analysis. | 415 // become smi phis that can be processed by range analysis. |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 Object::Handle(isolate->object_store()->sticky_error()); | 879 Object::Handle(isolate->object_store()->sticky_error()); |
| 878 isolate->object_store()->clear_sticky_error(); | 880 isolate->object_store()->clear_sticky_error(); |
| 879 isolate->set_long_jump_base(base); | 881 isolate->set_long_jump_base(base); |
| 880 return result.raw(); | 882 return result.raw(); |
| 881 } | 883 } |
| 882 UNREACHABLE(); | 884 UNREACHABLE(); |
| 883 return Object::null(); | 885 return Object::null(); |
| 884 } | 886 } |
| 885 | 887 |
| 886 } // namespace dart | 888 } // namespace dart |
| OLD | NEW |