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

Unified Diff: vm/flow_graph_builder.cc

Issue 10825035: Add an explicit push-argument instruction to the IL. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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 | « vm/flow_graph_builder.h ('k') | vm/flow_graph_compiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/flow_graph_builder.cc
===================================================================
--- vm/flow_graph_builder.cc (revision 9930)
+++ vm/flow_graph_builder.cc (working copy)
@@ -1375,6 +1375,11 @@
} else {
receiver = BuildNullValue();
}
+ PushArgumentInstr* push_receiver = new PushArgumentInstr(receiver);
+ ZoneGrowableArray<PushArgumentInstr*>* arguments =
+ new ZoneGrowableArray<PushArgumentInstr*>(2);
+ arguments->Add(push_receiver);
+ AddInstruction(push_receiver);
ASSERT(function.context_scope() != ContextScope::null());
// The function type of a closure may have type arguments. In that case, pass
@@ -1389,10 +1394,12 @@
} else {
type_arguments = BuildNullValue();
}
-
- CreateClosureComp* create = new CreateClosureComp(
- node, owner()->try_index(), type_arguments, receiver);
- ReturnComputation(create);
+ PushArgumentInstr* push_type_arguments =
+ new PushArgumentInstr(type_arguments);
+ arguments->Add(push_type_arguments);
+ AddInstruction(push_type_arguments);
+ ReturnComputation(
+ new CreateClosureComp(node, owner()->try_index(), arguments));
}
@@ -1407,6 +1414,21 @@
}
}
+
+void EffectGraphVisitor::BuildPushArguments(
+ const ArgumentListNode& node,
+ ZoneGrowableArray<PushArgumentInstr*>* values) {
+ for (intptr_t i = 0; i < node.length(); ++i) {
+ ValueGraphVisitor for_argument(owner(), temp_index());
+ node.NodeAt(i)->Visit(&for_argument);
+ Append(for_argument);
+ PushArgumentInstr* push_arg = new PushArgumentInstr(for_argument.value());
+ AddInstruction(push_arg);
+ values->Add(push_arg);
+ }
+}
+
+
void EffectGraphVisitor::VisitInstanceCallNode(InstanceCallNode* node) {
ArgumentListNode* arguments = node->arguments();
int length = arguments->length();
@@ -1447,11 +1469,13 @@
ValueGraphVisitor for_closure(owner(), temp_index());
node->closure()->Visit(&for_closure);
Append(for_closure);
+ PushArgumentInstr* push_closure = new PushArgumentInstr(for_closure.value());
+ AddInstruction(push_closure);
- ZoneGrowableArray<Value*>* arguments =
- new ZoneGrowableArray<Value*>(node->arguments()->length());
- arguments->Add(for_closure.value());
- TranslateArgumentList(*node->arguments(), arguments);
+ ZoneGrowableArray<PushArgumentInstr*>* arguments =
+ new ZoneGrowableArray<PushArgumentInstr*>(node->arguments()->length());
+ arguments->Add(push_closure);
+ BuildPushArguments(*node->arguments(), arguments);
// Save context around the call.
BuildStoreContext(*owner()->parsed_function().expression_temp_var());
« no previous file with comments | « vm/flow_graph_builder.h ('k') | vm/flow_graph_compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698