| Index: runtime/vm/flow_graph_inliner.cc
|
| diff --git a/runtime/vm/flow_graph_inliner.cc b/runtime/vm/flow_graph_inliner.cc
|
| index 34a2a9a4832095afcad07bc47dcfdd56481fc07d..b5848d6e04f3f9dc4359c4a4f30511ad5420ea3f 100644
|
| --- a/runtime/vm/flow_graph_inliner.cc
|
| +++ b/runtime/vm/flow_graph_inliner.cc
|
| @@ -182,7 +182,8 @@ class CallSites : public FlowGraphVisitor {
|
| : FlowGraphVisitor(flow_graph->postorder()), // We don't use this order.
|
| static_calls_(),
|
| closure_calls_(),
|
| - instance_calls_() { }
|
| + instance_calls_(),
|
| + skip_static_call_deopt_ids_() { }
|
|
|
| GrowableArray<StaticCallInstr*>* static_calls() {
|
| return &static_calls_;
|
| @@ -206,9 +207,16 @@ class CallSites : public FlowGraphVisitor {
|
| static_calls_.Clear();
|
| closure_calls_.Clear();
|
| instance_calls_.Clear();
|
| + skip_static_call_deopt_ids_.Clear();
|
| }
|
|
|
| void FindCallSites(FlowGraph* graph) {
|
| + ASSERT(graph != NULL);
|
| + const Function& function = graph->parsed_function().function();
|
| + ASSERT(function.HasCode());
|
| + const Code& code = Code::Handle(function.CurrentCode());
|
| + skip_static_call_deopt_ids_.Clear();
|
| + code.ExtractUncalledStaticCallDeoptIds(&skip_static_call_deopt_ids_);
|
| for (BlockIterator block_it = graph->postorder_iterator();
|
| !block_it.Done();
|
| block_it.Advance()) {
|
| @@ -229,13 +237,22 @@ class CallSites : public FlowGraphVisitor {
|
| }
|
|
|
| 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_;
|
| + GrowableArray<intptr_t> skip_static_call_deopt_ids_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(CallSites);
|
| };
|
| @@ -276,6 +293,8 @@ class CallSiteInliner : public ValueObject {
|
| return false;
|
| }
|
|
|
| + // TODO(srdjan): Handle large 'skip_static_call_deopt_ids'. Currently
|
| + // max. size observed is 11 (dart2js).
|
| void InlineCalls() {
|
| // If inlining depth is less then one abort.
|
| if (FLAG_inlining_depth_threshold < 1) return;
|
|
|