| 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/compiler.h" | 7 #include "vm/compiler.h" |
| 8 #include "vm/flags.h" | 8 #include "vm/flags.h" |
| 9 #include "vm/flow_graph.h" | 9 #include "vm/flow_graph.h" |
| 10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 "Always inline functions containing threshold or fewer calls."); | 30 "Always inline functions containing threshold or fewer calls."); |
| 31 DEFINE_FLAG(int, inlining_constant_arguments_count, 1, | 31 DEFINE_FLAG(int, inlining_constant_arguments_count, 1, |
| 32 "Inline function calls with sufficient constant arguments " | 32 "Inline function calls with sufficient constant arguments " |
| 33 "and up to the increased threshold on instructions"); | 33 "and up to the increased threshold on instructions"); |
| 34 DEFINE_FLAG(int, inlining_constant_arguments_size_threshold, 60, | 34 DEFINE_FLAG(int, inlining_constant_arguments_size_threshold, 60, |
| 35 "Inline function calls with sufficient constant arguments " | 35 "Inline function calls with sufficient constant arguments " |
| 36 "and up to the increased threshold on instructions"); | 36 "and up to the increased threshold on instructions"); |
| 37 DEFINE_FLAG(int, inlining_hotness, 10, | 37 DEFINE_FLAG(int, inlining_hotness, 10, |
| 38 "Inline only hotter calls, in percents (0 .. 100); " | 38 "Inline only hotter calls, in percents (0 .. 100); " |
| 39 "default 10%: calls above-equal 10% of max-count are inlined."); | 39 "default 10%: calls above-equal 10% of max-count are inlined."); |
| 40 DEFINE_FLAG(bool, inline_recursive, true, |
| 41 "Inline recursive calls."); |
| 40 | 42 |
| 41 DECLARE_FLAG(bool, print_flow_graph); | 43 DECLARE_FLAG(bool, print_flow_graph); |
| 42 DECLARE_FLAG(bool, print_flow_graph_optimized); | 44 DECLARE_FLAG(bool, print_flow_graph_optimized); |
| 43 DECLARE_FLAG(int, deoptimization_counter_threshold); | 45 DECLARE_FLAG(int, deoptimization_counter_threshold); |
| 44 DECLARE_FLAG(bool, verify_compiler); | 46 DECLARE_FLAG(bool, verify_compiler); |
| 45 DECLARE_FLAG(bool, compiler_stats); | 47 DECLARE_FLAG(bool, compiler_stats); |
| 46 | 48 |
| 47 #define TRACE_INLINING(statement) \ | 49 #define TRACE_INLINING(statement) \ |
| 48 do { \ | 50 do { \ |
| 49 if (FLAG_trace_inlining) statement; \ | 51 if (FLAG_trace_inlining) statement; \ |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 "code size: %"Pd", " | 388 "code size: %"Pd", " |
| 387 "call sites: %"Pd", " | 389 "call sites: %"Pd", " |
| 388 "const args: %"Pd"\n", | 390 "const args: %"Pd"\n", |
| 389 function.optimized_instruction_count(), | 391 function.optimized_instruction_count(), |
| 390 function.optimized_call_site_count(), | 392 function.optimized_call_site_count(), |
| 391 constant_arguments)); | 393 constant_arguments)); |
| 392 return false; | 394 return false; |
| 393 } | 395 } |
| 394 | 396 |
| 395 // Abort if this is a recursive occurrence. | 397 // Abort if this is a recursive occurrence. |
| 396 if (IsCallRecursive(function, call)) { | 398 if (!FLAG_inline_recursive && IsCallRecursive(function, call)) { |
| 397 function.set_is_inlinable(false); | 399 function.set_is_inlinable(false); |
| 398 TRACE_INLINING(OS::Print(" Bailout: recursive function\n")); | 400 TRACE_INLINING(OS::Print(" Bailout: recursive function\n")); |
| 399 return false; | 401 return false; |
| 400 } | 402 } |
| 401 | 403 |
| 402 // Abort if the callee has an intrinsic translation. | 404 // Abort if the callee has an intrinsic translation. |
| 403 if (Intrinsifier::CanIntrinsify(function)) { | 405 if (Intrinsifier::CanIntrinsify(function)) { |
| 404 function.set_is_inlinable(false); | 406 function.set_is_inlinable(false); |
| 405 TRACE_INLINING(OS::Print(" Bailout: can intrinsify\n")); | 407 TRACE_INLINING(OS::Print(" Bailout: can intrinsify\n")); |
| 406 return false; | 408 return false; |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 OS::Print("After Inlining of %s\n", flow_graph_-> | 885 OS::Print("After Inlining of %s\n", flow_graph_-> |
| 884 parsed_function().function().ToFullyQualifiedCString()); | 886 parsed_function().function().ToFullyQualifiedCString()); |
| 885 FlowGraphPrinter printer(*flow_graph_); | 887 FlowGraphPrinter printer(*flow_graph_); |
| 886 printer.PrintBlocks(); | 888 printer.PrintBlocks(); |
| 887 } | 889 } |
| 888 } | 890 } |
| 889 } | 891 } |
| 890 } | 892 } |
| 891 | 893 |
| 892 } // namespace dart | 894 } // namespace dart |
| OLD | NEW |