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

Unified Diff: runtime/vm/parser.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
« no previous file with comments | « runtime/vm/object_test.cc ('k') | runtime/vm/precompiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 4ef954bbd812d818a3d17ca44da76a8b92049d79..c3fb3fe4d16147a8d9383e65750104544aeca2a4 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -6581,11 +6581,8 @@ RawFunction* Parser::OpenSyncGeneratorFunction(intptr_t func_pos) {
// function has already been created by a previous
// compilation.
const Function& found_func = Function::Handle(
- Z, current_class().LookupClosureFunction(func_pos));
- if (!found_func.IsNull() &&
- (found_func.token_pos() == func_pos) &&
- (found_func.script() == innermost_function().script()) &&
- (found_func.parent_function() == innermost_function().raw())) {
+ Z, I->LookupClosureFunction(innermost_function(), func_pos));
+ if (!found_func.IsNull()) {
ASSERT(found_func.IsSyncGenClosure());
body = found_func.raw();
body_closure_name = body.name();
@@ -6722,11 +6719,8 @@ RawFunction* Parser::OpenAsyncFunction(intptr_t async_func_pos) {
// this async function has already been created by a previous
// compilation of this function.
const Function& found_func = Function::Handle(
- Z, current_class().LookupClosureFunction(async_func_pos));
- if (!found_func.IsNull() &&
- (found_func.token_pos() == async_func_pos) &&
- (found_func.script() == innermost_function().script()) &&
- (found_func.parent_function() == innermost_function().raw())) {
+ Z, I->LookupClosureFunction(innermost_function(), async_func_pos));
+ if (!found_func.IsNull()) {
ASSERT(found_func.IsAsyncClosure());
closure = found_func.raw();
} else {
@@ -6858,11 +6852,8 @@ RawFunction* Parser::OpenAsyncGeneratorFunction(intptr_t async_func_pos) {
// this async generator has already been created by a previous
// compilation of this function.
const Function& found_func = Function::Handle(
- Z, current_class().LookupClosureFunction(async_func_pos));
- if (!found_func.IsNull() &&
- (found_func.token_pos() == async_func_pos) &&
- (found_func.script() == innermost_function().script()) &&
- (found_func.parent_function() == innermost_function().raw())) {
+ Z, I->LookupClosureFunction(innermost_function(), async_func_pos));
+ if (!found_func.IsNull()) {
ASSERT(found_func.IsAsyncGenClosure());
closure = found_func.raw();
} else {
@@ -7629,9 +7620,8 @@ AstNode* Parser::ParseFunctionStatement(bool is_literal) {
// TODO(hausner): There could be two different closures at the given
// function_pos, one enclosed in a closurized function and one enclosed in the
// non-closurized version of this same function.
- function = current_class().LookupClosureFunction(function_pos);
- if (function.IsNull() || (function.token_pos() != function_pos) ||
- (function.parent_function() != innermost_function().raw())) {
+ function = I->LookupClosureFunction(innermost_function(), function_pos);
+ if (function.IsNull()) {
// The function will be registered in the lookup table by the
// EffectGraphVisitor::VisitClosureNode when the newly allocated closure
// function has been properly setup.
@@ -13131,7 +13121,7 @@ RawFunction* Parser::BuildConstructorClosureFunction(const Function& ctr,
intptr_t token_pos) {
ASSERT(ctr.kind() == RawFunction::kConstructor);
Function& closure = Function::Handle(Z);
- closure = current_class().LookupClosureFunction(token_pos);
+ closure = I->LookupClosureFunction(innermost_function(), token_pos);
if (!closure.IsNull()) {
ASSERT(closure.IsConstructorClosureFunction());
return closure.raw();
« no previous file with comments | « runtime/vm/object_test.cc ('k') | runtime/vm/precompiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698