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

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

Issue 2452403003: Changed statement ZoneList to a ZoneChunkList
Patch Set: Created 4 years, 2 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/pattern-rewriter.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 bd8a8b4882cc20a99236602377d1070b3dbbf733..dfac3924adf260f5cf9d9077348f70831b3cf433 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -2296,7 +2296,7 @@ ParserBase<Impl>::ParseClassFieldForInitializer(bool has_initializer,
}
initializer_scope->set_end_position(scanner()->location().end_pos);
typename Types::StatementList body = impl()->NewStatementList(1);
- body->Add(factory()->NewReturnStatement(value, kNoSourcePosition), zone());
+ body->push_back(factory()->NewReturnStatement(value, kNoSourcePosition));
FunctionLiteralT function_literal = factory()->NewFunctionLiteral(
impl()->EmptyIdentifierString(), initializer_scope, body,
initializer_state.materialized_literal_count(),
@@ -3551,7 +3551,7 @@ typename ParserBase<Impl>::BlockT ParserBase<Impl>::ParseVariableDeclarations(
BlockT init_block = impl()->NullBlock();
if (var_context != kForStatement) {
init_block = factory()->NewBlock(
- nullptr, 1, true, parsing_result->descriptor.declaration_pos);
+ nullptr, true, parsing_result->descriptor.declaration_pos);
}
switch (peek()) {
@@ -4008,7 +4008,7 @@ ParserBase<Impl>::ParseArrowFunctionLiteral(
} else {
ExpressionT expression = ParseAssignmentExpression(accept_IN, CHECK_OK);
impl()->RewriteNonPattern(CHECK_OK);
- body->Add(factory()->NewReturnStatement(expression, pos), zone());
+ body->push_back(factory()->NewReturnStatement(expression, pos));
if (allow_tailcalls() && !is_sloppy(language_mode())) {
// ES6 14.6.1 Static Semantics: IsInTailPosition
impl()->MarkTailPosition(expression);
@@ -4128,7 +4128,7 @@ void ParserBase<Impl>::ParseAsyncFunctionBody(Scope* scope, StatementListT body,
impl()->PrepareAsyncFunctionBody(body, kind, pos);
- BlockT block = factory()->NewBlock(nullptr, 8, true, kNoSourcePosition);
+ BlockT block = factory()->NewBlock(nullptr, true, kNoSourcePosition);
ExpressionT return_value = impl()->EmptyExpression();
if (body_type == FunctionBodyType::kNormal) {
@@ -4439,7 +4439,7 @@ ParserBase<Impl>::ParseStatementList(StatementListT body, int end_token,
}
}
- body->Add(stat, zone());
+ body->push_back(stat);
}
return kLazyParsingComplete;
}
@@ -4544,11 +4544,10 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseStatement(
if (labels == nullptr) {
return ParseStatementAsUnlabelled(labels, ok);
} else {
- BlockT result =
- factory()->NewBlock(labels, 1, false, kNoSourcePosition);
+ BlockT result = factory()->NewBlock(labels, false, kNoSourcePosition);
typename Types::Target target(this, result);
StatementT statement = ParseStatementAsUnlabelled(labels, CHECK_OK);
- result->statements()->Add(statement, zone());
+ result->statements()->push_back(statement);
return result;
}
}
@@ -4608,7 +4607,7 @@ typename ParserBase<Impl>::BlockT ParserBase<Impl>::ParseBlock(
// '{' StatementList '}'
// Construct block expecting 16 statements.
- BlockT body = factory()->NewBlock(labels, 16, false, kNoSourcePosition);
+ BlockT body = factory()->NewBlock(labels, false, kNoSourcePosition);
// Parse the statements and collect escaping labels.
Expect(Token::LBRACE, CHECK_OK_CUSTOM(NullBlock));
@@ -4620,7 +4619,7 @@ typename ParserBase<Impl>::BlockT ParserBase<Impl>::ParseBlock(
while (peek() != Token::RBRACE) {
StatementT stat = ParseStatementListItem(CHECK_OK_CUSTOM(NullBlock));
if (!impl()->IsNullStatement(stat) && !impl()->IsEmptyStatement(stat)) {
- body->statements()->Add(stat, zone());
+ body->statements()->push_back(stat);
}
}
@@ -4645,9 +4644,9 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseScopedStatement(
// is introduced by a FunctionDeclaration.
BlockState block_state(zone(), &scope_state_);
block_state.set_start_position(scanner()->location().beg_pos);
- BlockT block = factory()->NewBlock(NULL, 1, false, kNoSourcePosition);
+ BlockT block = factory()->NewBlock(NULL, false, kNoSourcePosition);
StatementT body = ParseFunctionDeclaration(CHECK_OK);
- block->statements()->Add(body, zone());
+ block->statements()->push_back(body);
block_state.set_end_position(scanner()->location().end_pos);
block->set_scope(block_state.FinalizedBlockScope());
return block;
@@ -5042,7 +5041,7 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseSwitchStatement(
while (peek() != Token::CASE && peek() != Token::DEFAULT &&
peek() != Token::RBRACE) {
StatementT stat = ParseStatementListItem(CHECK_OK);
- statements->Add(stat, zone());
+ statements->push_back(stat);
}
auto clause = factory()->NewCaseClause(label, statements, clause_pos);
cases->Add(clause, zone());
@@ -5100,7 +5099,7 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseTryStatement(
function_state_, &catch_info.tail_call_expressions);
BlockState catch_block_state(&scope_state_, catch_info.scope);
- catch_block = factory()->NewBlock(nullptr, 16, false, kNoSourcePosition);
+ catch_block = factory()->NewBlock(nullptr, false, kNoSourcePosition);
// Create a block scope to hold any lexical declarations created
// as part of destructuring the catch parameter.
@@ -5126,11 +5125,11 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseTryStatement(
Expect(Token::RPAREN, CHECK_OK);
impl()->RewriteCatchPattern(&catch_info, CHECK_OK);
if (!impl()->IsNullStatement(catch_info.init_block)) {
- catch_block->statements()->Add(catch_info.init_block, zone());
+ catch_block->statements()->push_back(catch_info.init_block);
}
catch_info.inner_block = ParseBlock(nullptr, CHECK_OK);
- catch_block->statements()->Add(catch_info.inner_block, zone());
+ catch_block->statements()->push_back(catch_info.inner_block);
impl()->ValidateCatchBlock(catch_info, CHECK_OK);
catch_variable_block_state.set_end_position(
scanner()->location().end_pos);
@@ -5234,7 +5233,7 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseForStatement(
ExpressionT each_variable = impl()->EmptyExpression();
impl()->DesugarBindingInForEachStatement(&for_info, &body_block,
&each_variable, CHECK_OK);
- body_block->statements()->Add(body, zone());
+ body_block->statements()->push_back(body);
final_loop = impl()->InitializeForEachStatement(
loop, each_variable, enumerable, body_block, each_keyword_pos);
@@ -5249,7 +5248,7 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseForStatement(
Scope* for_scope = for_state.FinalizedBlockScope();
// Parsed for-in loop w/ variable declarations.
if (!impl()->IsNullStatement(init_block)) {
- init_block->statements()->Add(final_loop, zone());
+ init_block->statements()->push_back(final_loop);
init_block->set_scope(for_scope);
return init_block;
} else {
@@ -5395,11 +5394,11 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseForStatement(
// }
// just in case b introduces a lexical binding some other way, e.g., if b
// is a FunctionDeclaration.
- BlockT block = factory()->NewBlock(nullptr, 2, false, kNoSourcePosition);
+ BlockT block = factory()->NewBlock(nullptr, false, kNoSourcePosition);
if (!impl()->IsNullStatement(init)) {
- block->statements()->Add(init, zone());
+ block->statements()->push_back(init);
}
- block->statements()->Add(loop, zone());
+ block->statements()->push_back(loop);
block->set_scope(for_scope);
loop->Initialize(init, cond, next, body);
return block;
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/pattern-rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698