Chromium Code Reviews| Index: runtime/vm/flow_graph_inliner.cc |
| =================================================================== |
| --- runtime/vm/flow_graph_inliner.cc (revision 25997) |
| +++ runtime/vm/flow_graph_inliner.cc (working copy) |
| @@ -165,9 +165,11 @@ |
| !it.Done(); |
| it.Advance()) { |
| ++instruction_count_; |
| - if (it.Current()->IsStaticCall() || |
| - it.Current()->IsClosureCall() || |
| - it.Current()->IsPolymorphicInstanceCall()) { |
| + Instruction* current = it.Current(); |
| + if (current->IsStaticCall() || |
| + current->IsClosureCall() || |
| + (current->IsPolymorphicInstanceCall() && |
| + !current->AsPolymorphicInstanceCall()->HasRecognizedTarget())) { |
| ++call_site_count_; |
| } |
| } |
| @@ -286,6 +288,27 @@ |
| ComputeCallSiteRatio(static_call_start_ix, instance_call_start_ix); |
| } |
| + void FindRecognizedCallSites(FlowGraph* graph) { |
|
Kevin Millikin (Google)
2013/08/13 11:47:40
Instead of a separate function which is a copy of
Florian Schneider
2013/08/14 12:30:24
Done.
|
| + ASSERT(graph != NULL); |
| + |
| + const intptr_t instance_call_start_ix = instance_calls_.length(); |
| + const intptr_t static_call_start_ix = static_calls_.length(); |
| + for (BlockIterator block_it = graph->postorder_iterator(); |
| + !block_it.Done(); |
| + block_it.Advance()) { |
| + for (ForwardInstructionIterator it(block_it.Current()); |
| + !it.Done(); |
| + it.Advance()) { |
| + PolymorphicInstanceCallInstr* call = |
| + it.Current()->AsPolymorphicInstanceCall(); |
| + if (call != NULL && call->HasRecognizedTarget()) { |
|
srdjan
2013/08/12 21:49:47
Add ()
Florian Schneider
2013/08/14 12:30:24
Done.
|
| + instance_calls_.Add(InstanceCallInfo(call)); |
| + } |
| + } |
| + } |
| + ComputeCallSiteRatio(static_call_start_ix, instance_call_start_ix); |
| + } |
| + |
| void VisitClosureCall(ClosureCallInstr* call) { |
| closure_calls_.Add(call); |
| } |
| @@ -394,8 +417,6 @@ |
| return false; |
| } |
| - // TODO(srdjan): Handle large 'skip_static_call_deopt_ids'. Currently |
| - // max. size observed is 11 (dart2js). |
|
Florian Schneider
2013/08/12 15:48:14
I think this TODO is obsolete.
|
| void InlineCalls() { |
| // If inlining depth is less then one abort. |
| if (FLAG_inlining_depth_threshold < 1) return; |
| @@ -635,6 +656,8 @@ |
| // If depth is less or equal to threshold recursively add call sites. |
| if (inlining_depth_ < FLAG_inlining_depth_threshold) { |
| collected_call_sites_->FindCallSites(callee_graph); |
| + } else if (inlining_depth_ == FLAG_inlining_depth_threshold) { |
|
Kevin Millikin (Google)
2013/08/13 11:47:40
In any case, even if you keep the separate functio
Florian Schneider
2013/08/14 12:30:24
Done. I use only one function. Also change CallSit
|
| + collected_call_sites_->FindRecognizedCallSites(callee_graph); |
| } |
| // Add the function to the cache. |
| @@ -1064,9 +1087,6 @@ |
| bool PolymorphicInliner::TryInlining(const Function& target) { |
| - if (!target.is_optimizable()) { |
|
Kevin Millikin (Google)
2013/08/13 11:47:40
Why remove this check?
Florian Schneider
2013/08/14 12:30:24
It's not strictly necessary, but I'll put it back
|
| - return false; |
| - } |
| GrowableArray<Value*> arguments(call_->ArgumentCount()); |
| for (int i = 0; i < call_->ArgumentCount(); ++i) { |
| arguments.Add(call_->PushArgumentAt(i)->value()); |