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

Unified Diff: vm/flow_graph_builder.cc

Issue 10409043: Make saving and restoring of the context around closure calls explicit. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 7 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_x64.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 7782)
+++ vm/flow_graph_builder.cc (working copy)
@@ -1371,12 +1371,8 @@
}
-void EffectGraphVisitor::VisitClosureCallNode(ClosureCallNode* node) {
- // Context is saved around the call, it's treated as an extra operand
- // consumed by the call (but not an argument).
- BindInstr* context = new BindInstr(new CurrentContextComp());
- AddInstruction(context);
-
+ClosureCallComp* EffectGraphVisitor::BuildClosureCall(
+ ClosureCallNode* node) {
ValueGraphVisitor for_closure(owner(), temp_index());
node->closure()->Visit(&for_closure);
Append(for_closure);
@@ -1385,15 +1381,34 @@
new ZoneGrowableArray<Value*>(node->arguments()->length());
arguments->Add(for_closure.value());
TranslateArgumentList(*node->arguments(), arguments);
- // First operand is the saved context, consumed by the call.
- ClosureCallComp* call = new ClosureCallComp(node,
- owner()->try_index(),
- new UseVal(context),
- arguments);
- ReturnComputation(call);
+
+ // Save context around the call.
+ BuildStoreContext(*owner()->parsed_function().expression_temp_var());
+ return new ClosureCallComp(node, owner()->try_index(), arguments);
}
+void EffectGraphVisitor::VisitClosureCallNode(ClosureCallNode* node) {
+ ClosureCallComp* call = BuildClosureCall(node);
+ AddInstruction(new DoInstr(call));
+
+ // Restore context from saved location.
+ BuildLoadContext(*owner()->parsed_function().expression_temp_var());
+}
+
+
+void ValueGraphVisitor::VisitClosureCallNode(ClosureCallNode* node) {
+ ClosureCallComp* call = BuildClosureCall(node);
+ BindInstr* result = new BindInstr(call);
+ AddInstruction(result);
+
+ // Restore context from temp.
+ BuildLoadContext(*owner()->parsed_function().expression_temp_var());
+
+ ReturnValue(new UseVal(result));
+}
+
+
void EffectGraphVisitor::VisitCloneContextNode(CloneContextNode* node) {
BindInstr* context = new BindInstr(new CurrentContextComp());
AddInstruction(context);
« no previous file with comments | « vm/flow_graph_builder.h ('k') | vm/flow_graph_compiler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698