Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1176)

Unified Diff: runtime/vm/flow_graph_inliner.cc

Issue 11312105: Do not inline static calls that have not been executed in unoptimized code: the inlined function do… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/flow_graph_inliner.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « runtime/vm/flow_graph_inliner.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698