| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_inliner.h" | 5 #include "vm/flow_graph_inliner.h" |
| 6 | 6 |
| 7 #include "vm/block_scheduler.h" | 7 #include "vm/block_scheduler.h" |
| 8 #include "vm/compiler.h" | 8 #include "vm/compiler.h" |
| 9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
| 10 #include "vm/flow_graph.h" | 10 #include "vm/flow_graph.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 "default 10%: calls above-equal 10% of max-count are inlined."); | 52 "default 10%: calls above-equal 10% of max-count are inlined."); |
| 53 DEFINE_FLAG(int, inlining_recursion_depth_threshold, 1, | 53 DEFINE_FLAG(int, inlining_recursion_depth_threshold, 1, |
| 54 "Inline recursive function calls up to threshold recursion depth."); | 54 "Inline recursive function calls up to threshold recursion depth."); |
| 55 DEFINE_FLAG(int, max_inlined_per_depth, 500, | 55 DEFINE_FLAG(int, max_inlined_per_depth, 500, |
| 56 "Max. number of inlined calls per depth"); | 56 "Max. number of inlined calls per depth"); |
| 57 DEFINE_FLAG(bool, print_inlining_tree, false, "Print inlining tree"); | 57 DEFINE_FLAG(bool, print_inlining_tree, false, "Print inlining tree"); |
| 58 DEFINE_FLAG(bool, enable_inlining_annotations, false, | 58 DEFINE_FLAG(bool, enable_inlining_annotations, false, |
| 59 "Enable inlining annotations"); | 59 "Enable inlining annotations"); |
| 60 | 60 |
| 61 DECLARE_FLAG(bool, compiler_stats); | 61 DECLARE_FLAG(bool, compiler_stats); |
| 62 DECLARE_FLAG(int, deoptimization_counter_threshold); | 62 DECLARE_FLAG(int, max_deoptimization_counter_threshold); |
| 63 DECLARE_FLAG(bool, polymorphic_with_deopt); | 63 DECLARE_FLAG(bool, polymorphic_with_deopt); |
| 64 DECLARE_FLAG(bool, print_flow_graph); | 64 DECLARE_FLAG(bool, print_flow_graph); |
| 65 DECLARE_FLAG(bool, print_flow_graph_optimized); | 65 DECLARE_FLAG(bool, print_flow_graph_optimized); |
| 66 DECLARE_FLAG(bool, verify_compiler); | 66 DECLARE_FLAG(bool, verify_compiler); |
| 67 | 67 |
| 68 // Quick access to the current zone. | 68 // Quick access to the current zone. |
| 69 #define Z (zone()) | 69 #define Z (zone()) |
| 70 | 70 |
| 71 #define TRACE_INLINING(statement) \ | 71 #define TRACE_INLINING(statement) \ |
| 72 do { \ | 72 do { \ |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 if (!Compiler::always_optimize() && | 632 if (!Compiler::always_optimize() && |
| 633 function.ic_data_array() == Object::null()) { | 633 function.ic_data_array() == Object::null()) { |
| 634 TRACE_INLINING(THR_Print(" Bailout: not compiled yet\n")); | 634 TRACE_INLINING(THR_Print(" Bailout: not compiled yet\n")); |
| 635 PRINT_INLINING_TREE("Not compiled", | 635 PRINT_INLINING_TREE("Not compiled", |
| 636 &call_data->caller, &function, call_data->call); | 636 &call_data->caller, &function, call_data->call); |
| 637 return false; | 637 return false; |
| 638 } | 638 } |
| 639 | 639 |
| 640 // Abort if this function has deoptimized too much. | 640 // Abort if this function has deoptimized too much. |
| 641 if (function.deoptimization_counter() >= | 641 if (function.deoptimization_counter() >= |
| 642 FLAG_deoptimization_counter_threshold) { | 642 FLAG_max_deoptimization_counter_threshold) { |
| 643 function.set_is_inlinable(false); | 643 function.set_is_inlinable(false); |
| 644 TRACE_INLINING(THR_Print(" Bailout: deoptimization threshold\n")); | 644 TRACE_INLINING(THR_Print(" Bailout: deoptimization threshold\n")); |
| 645 PRINT_INLINING_TREE("Deoptimization threshold exceeded", | 645 PRINT_INLINING_TREE("Deoptimization threshold exceeded", |
| 646 &call_data->caller, &function, call_data->call); | 646 &call_data->caller, &function, call_data->call); |
| 647 return false; | 647 return false; |
| 648 } | 648 } |
| 649 | 649 |
| 650 const char* kNeverInlineAnnotation = "NeverInline"; | 650 const char* kNeverInlineAnnotation = "NeverInline"; |
| 651 if (FLAG_enable_inlining_annotations && | 651 if (FLAG_enable_inlining_annotations && |
| 652 HasAnnotation(function, kNeverInlineAnnotation)) { | 652 HasAnnotation(function, kNeverInlineAnnotation)) { |
| (...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1912 intptr_t FlowGraphInliner::NextInlineId(const Function& function, | 1912 intptr_t FlowGraphInliner::NextInlineId(const Function& function, |
| 1913 intptr_t parent_id) { | 1913 intptr_t parent_id) { |
| 1914 const intptr_t id = inline_id_to_function_->length(); | 1914 const intptr_t id = inline_id_to_function_->length(); |
| 1915 inline_id_to_function_->Add(&function); | 1915 inline_id_to_function_->Add(&function); |
| 1916 caller_inline_id_->Add(parent_id); | 1916 caller_inline_id_->Add(parent_id); |
| 1917 return id; | 1917 return id; |
| 1918 } | 1918 } |
| 1919 | 1919 |
| 1920 | 1920 |
| 1921 } // namespace dart | 1921 } // namespace dart |
| OLD | NEW |