| Index: runtime/vm/flow_graph_inliner.cc
|
| ===================================================================
|
| --- runtime/vm/flow_graph_inliner.cc (revision 32381)
|
| +++ runtime/vm/flow_graph_inliner.cc (working copy)
|
| @@ -26,6 +26,8 @@
|
| DEFINE_FLAG(charp, inlining_filter, NULL, "Inline only in named function");
|
|
|
| // Flags for inlining heuristics.
|
| +DEFINE_FLAG(int, inline_getters_setters_smaller_than, 10,
|
| + "Always inline getters and setters that have fewer instructions");
|
| DEFINE_FLAG(int, inlining_depth_threshold, 3,
|
| "Inline function calls up to threshold nesting depth");
|
| DEFINE_FLAG(int, inlining_size_threshold, 25,
|
| @@ -363,7 +365,8 @@
|
| // Prevent methods becoming humongous and thus slow to compile.
|
| return false;
|
| }
|
| - if (instr_count <= FLAG_inlining_size_threshold) {
|
| + // 'instr_count' can be 0 if it was not computed yet.
|
| + if ((instr_count != 0) && (instr_count <= FLAG_inlining_size_threshold)) {
|
| return true;
|
| }
|
| if (call_site_count <= FLAG_inlining_callee_call_sites_threshold) {
|
| @@ -373,7 +376,7 @@
|
| (instr_count <= FLAG_inlining_constant_arguments_size_threshold)) {
|
| return true;
|
| }
|
| - if (MethodRecognizer::AlwaysInline(callee)) {
|
| + if (FlowGraphInliner::AlwaysInline(callee)) {
|
| return true;
|
| }
|
| return false;
|
| @@ -775,7 +778,7 @@
|
| }
|
| }
|
| const Function& target = call->function();
|
| - if (!MethodRecognizer::AlwaysInline(target) &&
|
| + if (!FlowGraphInliner::AlwaysInline(target) &&
|
| (call_info[call_idx].ratio * 100) < FLAG_inlining_hotness) {
|
| TRACE_INLINING(OS::Print(
|
| " => %s (deopt count %d)\n Bailout: cold %f\n",
|
| @@ -847,7 +850,7 @@
|
|
|
| const ICData& ic_data = call->ic_data();
|
| const Function& target = Function::ZoneHandle(ic_data.GetTargetAt(0));
|
| - if (!MethodRecognizer::AlwaysInline(target) &&
|
| + if (!FlowGraphInliner::AlwaysInline(target) &&
|
| (call_info[call_idx].ratio * 100) < FLAG_inlining_hotness) {
|
| TRACE_INLINING(OS::Print(
|
| " => %s (deopt count %d)\n Bailout: cold %f\n",
|
| @@ -1446,6 +1449,18 @@
|
| }
|
|
|
|
|
| +bool FlowGraphInliner::AlwaysInline(const Function& function) {
|
| + if (function.IsImplicitGetterFunction() || function.IsGetterFunction() ||
|
| + function.IsImplicitSetterFunction() || function.IsSetterFunction()) {
|
| + const intptr_t count = function.optimized_instruction_count();
|
| + if ((count != 0) && (count < FLAG_inline_getters_setters_smaller_than)) {
|
| + return true;
|
| + }
|
| + }
|
| + return MethodRecognizer::AlwaysInline(function);
|
| +}
|
| +
|
| +
|
| void FlowGraphInliner::Inline() {
|
| // Collect graph info and store it on the function.
|
| // We might later use it for an early bailout from the inlining.
|
|
|