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

Unified Diff: src/parsing/parser.cc

Issue 2522223002: Fix zone in which temp-zone parsed data is allocated for the function scope on the boundary. (Closed)
Patch Set: Also free map_ Created 4 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 | « src/base/hashmap.h ('k') | src/parsing/parser-base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser.cc
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
index 63cdfa1da6142f0ad76cead0302d3e15028f6ca6..073800d8167d4583c3091880555cb5b474ed11c6 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -2626,13 +2626,6 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
bool is_lazy_inner_function =
use_temp_zone && FLAG_lazy_inner_functions && !is_lazy_top_level_function;
- // This Scope lives in the main zone. We'll migrate data into that zone later.
- DeclarationScope* scope = NewFunctionScope(kind);
- SetLanguageMode(scope, language_mode);
-#ifdef DEBUG
- scope->SetScopeName(function_name);
-#endif
-
ZoneList<Statement*>* body = nullptr;
int materialized_literal_count = -1;
int expected_property_count = -1;
@@ -2641,8 +2634,8 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
int function_length = -1;
bool has_duplicate_parameters = false;
- Expect(Token::LPAREN, CHECK_OK);
- scope->set_start_position(scanner()->location().beg_pos);
+ Zone* outer_zone = zone();
+ DeclarationScope* scope;
{
// Temporary zones can nest. When we migrate free variables (see below), we
@@ -2657,10 +2650,19 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
// information when the function is parsed.
Zone temp_zone(zone()->allocator(), ZONE_NAME);
DiscardableZoneScope zone_scope(this, &temp_zone, use_temp_zone);
+
+ // This Scope lives in the main zone. We'll migrate data into that zone
+ // later.
+ scope = NewFunctionScope(kind, outer_zone);
+ SetLanguageMode(scope, language_mode);
#ifdef DEBUG
+ scope->SetScopeName(function_name);
if (use_temp_zone) scope->set_needs_migration();
#endif
+ Expect(Token::LPAREN, CHECK_OK);
+ scope->set_start_position(scanner()->location().beg_pos);
+
// Eager or lazy parse? If is_lazy_top_level_function, we'll parse
// lazily. We'll call SkipFunction, which may decide to
// abort lazy parsing if it suspects that wasn't a good idea. If so (in
« no previous file with comments | « src/base/hashmap.h ('k') | src/parsing/parser-base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698