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

Unified Diff: runtime/vm/flow_graph_inliner.cc

Issue 12377032: Do not inline List factory if a non-constant argument is passed in order to prevent non-optimal cod… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 months 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 | « no previous file | no next file » | 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 19261)
+++ runtime/vm/flow_graph_inliner.cc (working copy)
@@ -644,12 +644,27 @@
return parsed_function;
}
+ // Include special handling for List. factory: inlining it is not helpful
+ // if the incoming argument is a non-constant value.
+ // TODO(srdjan): Fix inlining of List. factory.
Ivan Posva 2013/02/28 23:22:31 Two spaces between of and List.
srdjan 2013/02/28 23:31:01 Done.
void InlineStaticCalls() {
const GrowableArray<StaticCallInstr*>& calls =
inlining_call_sites_->static_calls();
TRACE_INLINING(OS::Print(" Static Calls (%d)\n", calls.length()));
for (intptr_t i = 0; i < calls.length(); ++i) {
StaticCallInstr* call = calls[i];
+ if (call->function().name() == Symbols::ListFactory().raw()) {
+ // Inline only if no arguments or a constant was passed.
+ ASSERT(call->function().NumImplicitParameters() == 1);
+ ASSERT(call->ArgumentCount() <= 2);
+ // Arg 0: Instantiator type arguments.
+ // Arg 1: Length (optional).
+ if ((call->ArgumentCount() == 2) &&
+ (!call->PushArgumentAt(1)->value()->BindsToConstant())) {
+ // Do not inline since a non-constant argument was passed.
+ continue;
+ }
+ }
GrowableArray<Value*> arguments(call->ArgumentCount());
for (int i = 0; i < call->ArgumentCount(); ++i) {
arguments.Add(call->PushArgumentAt(i)->value());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698