| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 DEFINE_FLAG(int, inlining_constant_arguments_size_threshold, 60, | 44 DEFINE_FLAG(int, inlining_constant_arguments_size_threshold, 60, |
| 45 "Inline function calls with sufficient constant arguments " | 45 "Inline function calls with sufficient constant arguments " |
| 46 "and up to the increased threshold on instructions"); | 46 "and up to the increased threshold on instructions"); |
| 47 DEFINE_FLAG(int, inlining_hotness, 10, | 47 DEFINE_FLAG(int, inlining_hotness, 10, |
| 48 "Inline only hotter calls, in percents (0 .. 100); " | 48 "Inline only hotter calls, in percents (0 .. 100); " |
| 49 "default 10%: calls above-equal 10% of max-count are inlined."); | 49 "default 10%: calls above-equal 10% of max-count are inlined."); |
| 50 DEFINE_FLAG(bool, inline_recursive, true, | 50 DEFINE_FLAG(bool, inline_recursive, true, |
| 51 "Inline recursive calls."); | 51 "Inline recursive calls."); |
| 52 DEFINE_FLAG(bool, print_inlining_tree, false, "Print inlining tree"); | 52 DEFINE_FLAG(bool, print_inlining_tree, false, "Print inlining tree"); |
| 53 | 53 |
| 54 DECLARE_FLAG(bool, compiler_stats); |
| 55 DECLARE_FLAG(bool, enable_type_checks); |
| 56 DECLARE_FLAG(int, deoptimization_counter_threshold); |
| 54 DECLARE_FLAG(bool, print_flow_graph); | 57 DECLARE_FLAG(bool, print_flow_graph); |
| 55 DECLARE_FLAG(bool, print_flow_graph_optimized); | 58 DECLARE_FLAG(bool, print_flow_graph_optimized); |
| 56 DECLARE_FLAG(int, deoptimization_counter_threshold); | |
| 57 DECLARE_FLAG(bool, verify_compiler); | 59 DECLARE_FLAG(bool, verify_compiler); |
| 58 DECLARE_FLAG(bool, compiler_stats); | |
| 59 | 60 |
| 60 #define TRACE_INLINING(statement) \ | 61 #define TRACE_INLINING(statement) \ |
| 61 do { \ | 62 do { \ |
| 62 if (FLAG_trace_inlining) statement; \ | 63 if (FLAG_trace_inlining) statement; \ |
| 63 } while (false) | 64 } while (false) |
| 64 | 65 |
| 65 #define PRINT_INLINING_TREE(comment, caller, target, instance_call) \ | 66 #define PRINT_INLINING_TREE(comment, caller, target, instance_call) \ |
| 66 do { \ | 67 do { \ |
| 67 if (FLAG_print_inlining_tree) { \ | 68 if (FLAG_print_inlining_tree) { \ |
| 68 inlined_info_.Add(InlinedInfo( \ | 69 inlined_info_.Add(InlinedInfo( \ |
| (...skipping 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1659 // Collect graph info and store it on the function. | 1660 // Collect graph info and store it on the function. |
| 1660 // We might later use it for an early bailout from the inlining. | 1661 // We might later use it for an early bailout from the inlining. |
| 1661 CollectGraphInfo(flow_graph_); | 1662 CollectGraphInfo(flow_graph_); |
| 1662 | 1663 |
| 1663 const Function& top = flow_graph_->parsed_function().function(); | 1664 const Function& top = flow_graph_->parsed_function().function(); |
| 1664 if ((FLAG_inlining_filter != NULL) && | 1665 if ((FLAG_inlining_filter != NULL) && |
| 1665 (strstr(top.ToFullyQualifiedCString(), FLAG_inlining_filter) == NULL)) { | 1666 (strstr(top.ToFullyQualifiedCString(), FLAG_inlining_filter) == NULL)) { |
| 1666 return; | 1667 return; |
| 1667 } | 1668 } |
| 1668 | 1669 |
| 1670 if (FLAG_enable_type_checks) { |
| 1671 // TODO(srdjan): Fix out-of-memory crash in checked mode. |
| 1672 return; |
| 1673 } |
| 1674 |
| 1669 TRACE_INLINING(OS::Print("Inlining calls in %s\n", top.ToCString())); | 1675 TRACE_INLINING(OS::Print("Inlining calls in %s\n", top.ToCString())); |
| 1670 | 1676 |
| 1671 if (FLAG_trace_inlining && | 1677 if (FLAG_trace_inlining && |
| 1672 (FLAG_print_flow_graph || FLAG_print_flow_graph_optimized)) { | 1678 (FLAG_print_flow_graph || FLAG_print_flow_graph_optimized)) { |
| 1673 OS::Print("Before Inlining of %s\n", flow_graph_-> | 1679 OS::Print("Before Inlining of %s\n", flow_graph_-> |
| 1674 parsed_function().function().ToFullyQualifiedCString()); | 1680 parsed_function().function().ToFullyQualifiedCString()); |
| 1675 FlowGraphPrinter printer(*flow_graph_); | 1681 FlowGraphPrinter printer(*flow_graph_); |
| 1676 printer.PrintBlocks(); | 1682 printer.PrintBlocks(); |
| 1677 } | 1683 } |
| 1678 | 1684 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1690 OS::Print("After Inlining of %s\n", flow_graph_-> | 1696 OS::Print("After Inlining of %s\n", flow_graph_-> |
| 1691 parsed_function().function().ToFullyQualifiedCString()); | 1697 parsed_function().function().ToFullyQualifiedCString()); |
| 1692 FlowGraphPrinter printer(*flow_graph_); | 1698 FlowGraphPrinter printer(*flow_graph_); |
| 1693 printer.PrintBlocks(); | 1699 printer.PrintBlocks(); |
| 1694 } | 1700 } |
| 1695 } | 1701 } |
| 1696 } | 1702 } |
| 1697 } | 1703 } |
| 1698 | 1704 |
| 1699 } // namespace dart | 1705 } // namespace dart |
| OLD | NEW |