| Index: runtime/vm/flow_graph_inliner.cc
|
| ===================================================================
|
| --- runtime/vm/flow_graph_inliner.cc (revision 14603)
|
| +++ runtime/vm/flow_graph_inliner.cc (working copy)
|
| @@ -178,11 +178,13 @@
|
| // A collection of call sites to consider for inlining.
|
| class CallSites : public FlowGraphVisitor {
|
| public:
|
| - explicit CallSites(FlowGraph* flow_graph)
|
| + CallSites(FlowGraph* flow_graph,
|
| + const GrowableArray<intptr_t>& skip_static_call_deopt_ids)
|
| : FlowGraphVisitor(flow_graph->postorder()), // We don't use this order.
|
| static_calls_(),
|
| closure_calls_(),
|
| - instance_calls_() { }
|
| + instance_calls_(),
|
| + skip_static_call_deopt_ids_(skip_static_call_deopt_ids) { }
|
|
|
| GrowableArray<StaticCallInstr*>* static_calls() {
|
| return &static_calls_;
|
| @@ -229,13 +231,22 @@
|
| }
|
|
|
| void VisitStaticCall(StaticCallInstr* call) {
|
| - if (call->function().IsInlineable()) static_calls_.Add(call);
|
| + if (!call->function().IsInlineable()) return;
|
| + const intptr_t call_deopt_id = call->deopt_id();
|
| + for (intptr_t i = 0; i < skip_static_call_deopt_ids_.length(); i++) {
|
| + if (call_deopt_id == skip_static_call_deopt_ids_[i]) {
|
| + // Do not inline this call.
|
| + return;
|
| + }
|
| + }
|
| + static_calls_.Add(call);
|
| }
|
|
|
| private:
|
| GrowableArray<StaticCallInstr*> static_calls_;
|
| GrowableArray<ClosureCallInstr*> closure_calls_;
|
| GrowableArray<PolymorphicInstanceCallInstr*> instance_calls_;
|
| + const GrowableArray<intptr_t>& skip_static_call_deopt_ids_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(CallSites);
|
| };
|
| @@ -276,12 +287,14 @@
|
| return false;
|
| }
|
|
|
| - void InlineCalls() {
|
| + // TODO(srdjan): Handle large 'skip_static_call_deopt_ids'. Currently
|
| + // max. size observed is 11 (dart2js).
|
| + void InlineCalls(const GrowableArray<intptr_t>& skip_static_call_deopt_ids) {
|
| // If inlining depth is less then one abort.
|
| if (FLAG_inlining_depth_threshold < 1) return;
|
| // Create two call site collections to swap between.
|
| - CallSites sites1(caller_graph_);
|
| - CallSites sites2(caller_graph_);
|
| + CallSites sites1(caller_graph_, skip_static_call_deopt_ids);
|
| + CallSites sites2(caller_graph_, skip_static_call_deopt_ids);
|
| CallSites* call_sites_temp = NULL;
|
| collected_call_sites_ = &sites1;
|
| inlining_call_sites_ = &sites2;
|
| @@ -771,7 +784,7 @@
|
| }
|
|
|
| CallSiteInliner inliner(flow_graph_);
|
| - inliner.InlineCalls();
|
| + inliner.InlineCalls(uncalled_static_static_call_deopt_ids_);
|
|
|
| if (inliner.inlined()) {
|
| flow_graph_->RepairGraphAfterInlining();
|
|
|