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

Unified Diff: runtime/vm/flow_graph_builder.cc

Issue 1436243005: Collect closure functions in isolate (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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
Index: runtime/vm/flow_graph_builder.cc
diff --git a/runtime/vm/flow_graph_builder.cc b/runtime/vm/flow_graph_builder.cc
index 1c4325c33256440bde8d933a9eaba3983882b1a2..209439897cf05d8b71a9967c540e6e52098385d4 100644
--- a/runtime/vm/flow_graph_builder.cc
+++ b/runtime/vm/flow_graph_builder.cc
@@ -2483,25 +2483,25 @@ void EffectGraphVisitor::VisitClosureNode(ClosureNode* node) {
ASSERT(!function.HasCode());
ASSERT(function.context_scope() == ContextScope::null());
function.set_context_scope(context_scope);
- const Class& cls = Class::Handle(Z, owner()->function().Owner());
+
// The closure is now properly setup, add it to the lookup table.
// It is possible that the compiler creates more than one function
// object for the same closure, e.g. when inlining nodes from
// finally clauses. If we already have a function object for the
- // same closure, do not add a second one. We compare the origin
- // class, token position, and parent function to detect duplicates.
+ // same closure, do not add a second one. We compare the script,
+ // token position, and parent function to detect duplicates.
// Note that we can have two different closure object for the same
// source text representation of the closure: one with a non-closurized
// parent, and one with a closurized parent function.
- const Function& found_func = Function::Handle(
- Z, cls.LookupClosureFunction(function.token_pos()));
-
+ const Script& origin = Script::Handle(Z, function.script());
+ const Function& found_func = Function::Handle(Z,
+ isolate()->LookupClosureFunction(origin, function.token_pos()));
if (found_func.IsNull() ||
(found_func.token_pos() != function.token_pos()) ||
(found_func.script() != function.script()) ||
(found_func.parent_function() != function.parent_function())) {
Ivan Posva 2015/11/13 17:47:51 Why would any of these tests for pos or script fai
hausner 2015/11/13 20:13:29 It seems that LookupClosureFunction was implemente
- cls.AddClosureFunction(function);
+ isolate()->AddClosureFunction(function);
}
}
ZoneGrowableArray<PushArgumentInstr*>* arguments =
« runtime/vm/debugger.cc ('K') | « runtime/vm/debugger.cc ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698