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

Unified Diff: src/parsing/preparser.cc

Issue 2531593002: Parser: store parameters in a ThreadedList instead of ZoneList. (Closed)
Patch Set: 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
Index: src/parsing/preparser.cc
diff --git a/src/parsing/preparser.cc b/src/parsing/preparser.cc
index c7b2e1b5d25d6e9537e62989e4a610d6ee47ee68..804e5e1ae01a3203fa9b9b5e434091629f6dcfea 100644
--- a/src/parsing/preparser.cc
+++ b/src/parsing/preparser.cc
@@ -101,7 +101,8 @@ PreParser::PreParseResult PreParser::PreParseFunction(
bool ok_holder = true;
bool* ok = &ok_holder;
- PreParserFormalParameters formals(function_scope);
+ PreParserFormalParameters* formals =
+ new (zone()) PreParserFormalParameters(function_scope);
bool has_duplicate_parameters = false;
DuplicateFinder duplicate_finder(scanner()->unicode_cache());
std::unique_ptr<ExpressionClassifier> formals_classifier;
@@ -112,20 +113,21 @@ PreParser::PreParseResult PreParser::PreParseFunction(
formals_classifier.reset(new ExpressionClassifier(this, &duplicate_finder));
// We return kPreParseSuccess in failure cases too - errors are retrieved
// separately by Parser::SkipLazyFunctionBody.
- ParseFormalParameterList(&formals, CHECK_OK_VALUE(kPreParseSuccess));
+ ParseFormalParameterList(formals, CHECK_OK_VALUE(kPreParseSuccess));
Expect(Token::RPAREN, CHECK_OK_VALUE(kPreParseSuccess));
int formals_end_position = scanner()->location().end_pos;
- CheckArityRestrictions(
- formals.arity, kind, formals.has_rest, function_scope->start_position(),
- formals_end_position, CHECK_OK_VALUE(kPreParseSuccess));
+ CheckArityRestrictions(formals->arity, kind, formals->has_rest,
+ function_scope->start_position(),
+ formals_end_position,
+ CHECK_OK_VALUE(kPreParseSuccess));
has_duplicate_parameters =
!classifier()->is_valid_formal_parameter_list_without_duplicates();
}
Expect(Token::LBRACE, CHECK_OK_VALUE(kPreParseSuccess));
LazyParsingResult result = ParseStatementListAndLogFunction(
- &formals, has_duplicate_parameters, may_abort, ok);
+ formals, has_duplicate_parameters, may_abort, ok);
use_counts_ = nullptr;
track_unresolved_variables_ = false;
if (result == kLazyParsingAborted) {
@@ -141,7 +143,7 @@ PreParser::PreParseResult PreParser::PreParseFunction(
// Validate parameter names. We can do this only after parsing the
// function, since the function can declare itself strict.
const bool allow_duplicate_parameters =
- is_sloppy(function_scope->language_mode()) && formals.is_simple &&
+ is_sloppy(function_scope->language_mode()) && formals->is_simple &&
!IsConciseMethod(kind);
ValidateFormalParameters(function_scope->language_mode(),
allow_duplicate_parameters,
@@ -199,13 +201,14 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
Expect(Token::LPAREN, CHECK_OK);
int start_position = scanner()->location().beg_pos;
function_scope->set_start_position(start_position);
- PreParserFormalParameters formals(function_scope);
- ParseFormalParameterList(&formals, CHECK_OK);
+ PreParserFormalParameters* formals =
+ new (zone()) PreParserFormalParameters(function_scope);
+ ParseFormalParameterList(formals, CHECK_OK);
Expect(Token::RPAREN, CHECK_OK);
int formals_end_position = scanner()->location().end_pos;
- CheckArityRestrictions(formals.arity, kind, formals.has_rest, start_position,
- formals_end_position, CHECK_OK);
+ CheckArityRestrictions(formals->arity, kind, formals->has_rest,
+ start_position, formals_end_position, CHECK_OK);
Expect(Token::LBRACE, CHECK_OK);
ParseStatementList(body, Token::RBRACE, CHECK_OK);
@@ -219,7 +222,7 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
CheckFunctionName(language_mode, function_name, function_name_validity,
function_name_location, CHECK_OK);
const bool allow_duplicate_parameters =
- is_sloppy(language_mode) && formals.is_simple && !IsConciseMethod(kind);
+ is_sloppy(language_mode) && formals->is_simple && !IsConciseMethod(kind);
ValidateFormalParameters(language_mode, allow_duplicate_parameters, CHECK_OK);
int end_position = scanner()->location().end_pos;
« src/parsing/parser.cc ('K') | « src/parsing/preparser.h ('k') | src/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698