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

Unified Diff: src/parsing/parser-base.h

Issue 2379533003: Revert of Don't use different function scopes when parsing with temp zones (Closed)
Patch Set: Created 4 years, 3 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 | « src/parsing/parser.cc ('k') | src/parsing/preparser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser-base.h
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h
index e02ccf4db714cfd84a794ac4543f8b605d1c9b39..86135f8caf9b70bfaeb8f34d8c8204ff925148a6 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -289,8 +289,8 @@
// allocation.
// TODO(verwaest): Move to LazyBlockState class that only allocates the
// scope when needed.
- explicit BlockState(Zone* zone, ScopeState** scope_stack)
- : ScopeState(scope_stack, NewScope(zone, *scope_stack)) {}
+ explicit BlockState(ScopeState** scope_stack)
+ : ScopeState(scope_stack, NewScope(*scope_stack)) {}
void SetNonlinear() { this->scope()->SetNonlinear(); }
void set_start_position(int pos) { this->scope()->set_start_position(pos); }
@@ -304,8 +304,9 @@
}
private:
- Scope* NewScope(Zone* zone, ScopeState* outer_state) {
+ Scope* NewScope(ScopeState* outer_state) {
Scope* parent = outer_state->scope();
+ Zone* zone = outer_state->zone();
return new (zone) Scope(zone, parent, BLOCK_SCOPE);
}
};
@@ -3925,8 +3926,6 @@
LazyParsingResult result = impl()->SkipLazyFunctionBody(
&materialized_literal_count, &expected_property_count, false, true,
CHECK_OK);
- formal_parameters.scope->ResetAfterPreparsing(result ==
- kLazyParsingAborted);
if (formal_parameters.materialized_literals_count > 0) {
materialized_literal_count +=
@@ -4461,7 +4460,7 @@
// Parse the statements and collect escaping labels.
Expect(Token::LBRACE, CHECK_OK_CUSTOM(NullBlock));
{
- BlockState block_state(zone(), &scope_state_);
+ BlockState block_state(&scope_state_);
block_state.set_start_position(scanner()->location().beg_pos);
typename Types::Target target(this, body);
@@ -4491,7 +4490,7 @@
}
// Make a block around the statement for a lexical binding
// is introduced by a FunctionDeclaration.
- BlockState block_state(zone(), &scope_state_);
+ BlockState block_state(&scope_state_);
block_state.set_start_position(scanner()->location().beg_pos);
BlockT block = factory()->NewBlock(NULL, 1, false, kNoSourcePosition);
StatementT body = impl()->ParseFunctionDeclaration(CHECK_OK);
@@ -4862,7 +4861,7 @@
auto switch_statement = factory()->NewSwitchStatement(labels, switch_pos);
{
- BlockState cases_block_state(zone(), &scope_state_);
+ BlockState cases_block_state(&scope_state_);
cases_block_state.set_start_position(scanner()->location().beg_pos);
cases_block_state.SetNonlinear();
typename Types::Target target(this, switch_statement);
@@ -4953,7 +4952,7 @@
// Create a block scope to hold any lexical declarations created
// as part of destructuring the catch parameter.
{
- BlockState catch_variable_block_state(zone(), &scope_state_);
+ BlockState catch_variable_block_state(&scope_state_);
catch_variable_block_state.set_start_position(
scanner()->location().beg_pos);
typename Types::Target target(this, catch_block);
@@ -5018,7 +5017,7 @@
bool bound_names_are_lexical = false;
// Create an in-between scope for let-bound iteration variables.
- BlockState for_state(zone(), &scope_state_);
+ BlockState for_state(&scope_state_);
Expect(Token::FOR, CHECK_OK);
Expect(Token::LPAREN, CHECK_OK);
for_state.set_start_position(scanner()->location().beg_pos);
@@ -5089,7 +5088,7 @@
{
ReturnExprScope no_tail_calls(function_state_,
ReturnExprContext::kInsideForInOfBody);
- BlockState block_state(zone(), &scope_state_);
+ BlockState block_state(&scope_state_);
block_state.set_start_position(scanner()->location().beg_pos);
StatementT body = ParseScopedStatement(nullptr, true, CHECK_OK);
@@ -5172,7 +5171,7 @@
{
ReturnExprScope no_tail_calls(function_state_,
ReturnExprContext::kInsideForInOfBody);
- BlockState block_state(zone(), &scope_state_);
+ BlockState block_state(&scope_state_);
block_state.set_start_position(scanner()->location().beg_pos);
// For legacy compat reasons, give for loops similar treatment to
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698