Index: runtime/vm/flow_graph_inliner.cc |
=================================================================== |
--- runtime/vm/flow_graph_inliner.cc (revision 36520) |
+++ runtime/vm/flow_graph_inliner.cc (working copy) |
@@ -49,6 +49,8 @@ |
"default 10%: calls above-equal 10% of max-count are inlined."); |
DEFINE_FLAG(bool, inline_recursive, true, |
"Inline recursive calls."); |
+DEFINE_FLAG(int, max_inlined_per_depth, 500, |
+ "Max. number of inlined calls per depth"); |
DEFINE_FLAG(bool, print_inlining_tree, false, "Print inlining tree"); |
DECLARE_FLAG(bool, compiler_stats); |
@@ -240,6 +242,12 @@ |
instance_calls_.is_empty()); |
} |
+ intptr_t NumCalls() const { |
+ return instance_calls_.length() + |
+ static_calls_.length() + |
+ closure_calls_.length(); |
+ } |
+ |
void Clear() { |
static_calls_.Clear(); |
closure_calls_.Clear(); |
@@ -516,6 +524,13 @@ |
while (collected_call_sites_->HasCalls()) { |
TRACE_INLINING(OS::Print(" Depth %" Pd " ----------\n", |
inlining_depth_)); |
+ if (collected_call_sites_->NumCalls() > FLAG_max_inlined_per_depth) { |
+ break; |
+ } |
+ if (FLAG_print_inlining_tree) { |
+ OS::Print("**Depth % " Pd " calls to inline %" Pd "\n", |
+ inlining_depth_, collected_call_sites_->NumCalls()); |
+ } |
// Swap collected and inlining arrays and clear the new collecting array. |
call_sites_temp = collected_call_sites_; |
collected_call_sites_ = inlining_call_sites_; |
@@ -1002,8 +1017,6 @@ |
} |
if (target.IsNull()) { |
TRACE_INLINING(OS::Print(" Bailout: non-closure operator\n")); |
- PRINT_INLINING_TREE("Non-closure operator", |
- call_info[call_idx].caller, &target, call); |
continue; |
} |
GrowableArray<Value*> arguments(call->ArgumentCount()); |
@@ -1667,11 +1680,6 @@ |
return; |
} |
- if (FLAG_enable_type_checks) { |
- // TODO(srdjan): Fix out-of-memory crash in checked mode. |
- return; |
- } |
- |
TRACE_INLINING(OS::Print("Inlining calls in %s\n", top.ToCString())); |
if (FLAG_trace_inlining && |