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

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

Issue 2657413002: No need to collect literal counts.
Patch Set: Rebase. Created 3 years, 10 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/preparse-data.h » ('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 ad336adcd6b2110e1fa7da79b927e15668c87ff4..07364b3d7ab4592328e17efc789a93b70a1a0ce8 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -410,17 +410,6 @@ class ParserBase {
return ScopeState::scope()->AsDeclarationScope();
}
- int NextMaterializedLiteralIndex() {
- return next_materialized_literal_index_++;
- }
- int materialized_literal_count() {
- return next_materialized_literal_index_;
- }
-
- void SkipMaterializedLiterals(int count) {
- next_materialized_literal_index_ += count;
- }
-
void AddProperty() { expected_property_count_++; }
int expected_property_count() { return expected_property_count_; }
@@ -1717,8 +1706,6 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseRegExpLiteral(
return impl()->EmptyExpression();
}
- function_state_->NextMaterializedLiteralIndex();
-
IdentifierT js_pattern = impl()->GetNextSymbol();
Maybe<RegExp::Flags> flags = scanner()->ScanRegExpFlags();
if (flags.IsNothing()) {
@@ -2007,9 +1994,6 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseArrayLiteral(
}
Expect(Token::RBRACK, CHECK_OK);
- // Update the scope information before the pre-parsing bailout.
- function_state_->NextMaterializedLiteralIndex();
-
ExpressionT result =
factory()->NewArrayLiteral(values, first_spread_index, pos);
if (first_spread_index >= 0) {
@@ -2357,7 +2341,6 @@ ParserBase<Impl>::ParseClassFieldForInitializer(bool has_initializer,
body->Add(factory()->NewReturnStatement(value, kNoSourcePosition), zone());
FunctionLiteralT function_literal = factory()->NewFunctionLiteral(
impl()->EmptyIdentifierString(), initializer_scope, body,
- initializer_state.materialized_literal_count(),
initializer_state.expected_property_count(), 0, 0,
FunctionLiteral::kNoDuplicateParameters,
FunctionLiteral::kAnonymousExpression, default_eager_compile_hint_,
@@ -2608,9 +2591,6 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseObjectLiteral(
}
Expect(Token::RBRACE, CHECK_OK);
- // Computation of literal_index must happen before pre parse bailout.
- function_state_->NextMaterializedLiteralIndex();
-
// In pattern rewriter, we rewrite rest property to call out to a
// runtime function passing all the other properties as arguments to
// this runtime function. Here, we make sure that the number of
@@ -2636,7 +2616,6 @@ typename ParserBase<Impl>::ExpressionListT ParserBase<Impl>::ParseArguments(
Expect(Token::LPAREN, CHECK_OK_CUSTOM(NullExpressionList));
bool done = (peek() == Token::RPAREN);
bool was_unspread = false;
- int unspread_sequences_count = 0;
int spread_count = 0;
while (!done) {
int start_pos = peek_position();
@@ -2657,14 +2636,11 @@ typename ParserBase<Impl>::ExpressionListT ParserBase<Impl>::ParseArguments(
}
result->Add(argument, zone_);
- // unspread_sequences_count is the number of sequences of parameters which
- // are not prefixed with a spread '...' operator.
if (is_spread) {
was_unspread = false;
spread_count++;
} else if (!was_unspread) {
was_unspread = true;
- unspread_sequences_count++;
}
if (result->length() > Code::kMaxArguments) {
@@ -2693,16 +2669,6 @@ typename ParserBase<Impl>::ExpressionListT ParserBase<Impl>::ParseArguments(
if (maybe_arrow) {
impl()->RewriteNonPattern(CHECK_OK_CUSTOM(NullExpressionList));
}
- if (spread_arg.IsValid()) {
- // Unspread parameter sequences are translated into array literals in the
- // parser. Ensure that the number of materialized literals matches between
- // the parser and preparser
- if (was_unspread || spread_count > 1) {
- // There was more than one spread, or the spread was not the final
- // argument, so the parser will materialize literals.
- impl()->MaterializeUnspreadArgumentsLiterals(unspread_sequences_count);
- }
- }
}
return result;
@@ -4160,7 +4126,6 @@ ParserBase<Impl>::ParseArrowFunctionLiteral(
}
StatementListT body = impl()->NullStatementList();
- int materialized_literal_count = -1;
int expected_property_count = -1;
int function_literal_id = GetNextFunctionLiteralId();
@@ -4179,9 +4144,6 @@ ParserBase<Impl>::ParseArrowFunctionLiteral(
FunctionState function_state(&function_state_, &scope_state_,
formal_parameters.scope);
- function_state.SkipMaterializedLiterals(
- formal_parameters.materialized_literals_count);
-
Expect(Token::ARROW, CHECK_OK);
if (peek() == Token::LBRACE) {
@@ -4202,16 +4164,10 @@ ParserBase<Impl>::ParseArrowFunctionLiteral(
LazyParsingResult result = impl()->SkipFunction(
kind, formal_parameters.scope, &dummy_num_parameters,
&dummy_function_length, &dummy_has_duplicate_parameters,
- &materialized_literal_count, &expected_property_count, false, true,
- CHECK_OK);
+ &expected_property_count, false, true, CHECK_OK);
formal_parameters.scope->ResetAfterPreparsing(
ast_value_factory_, result == kLazyParsingAborted);
- if (formal_parameters.materialized_literals_count > 0) {
- materialized_literal_count +=
- formal_parameters.materialized_literals_count;
- }
-
if (result == kLazyParsingAborted) {
bookmark.Apply();
// Trigger eager (re-)parsing, just below this block.
@@ -4231,8 +4187,6 @@ ParserBase<Impl>::ParseArrowFunctionLiteral(
kNoSourcePosition, formal_parameters, kind,
FunctionLiteral::kAnonymousExpression,
CHECK_OK);
- materialized_literal_count =
- function_state.materialized_literal_count();
expected_property_count = function_state.expected_property_count();
}
} else {
@@ -4262,7 +4216,6 @@ ParserBase<Impl>::ParseArrowFunctionLiteral(
impl()->MarkTailPosition(expression);
}
}
- materialized_literal_count = function_state.materialized_literal_count();
expected_property_count = function_state.expected_property_count();
impl()->MarkCollectedTailCallExpressions();
}
@@ -4295,8 +4248,8 @@ ParserBase<Impl>::ParseArrowFunctionLiteral(
}
FunctionLiteralT function_literal = factory()->NewFunctionLiteral(
impl()->EmptyIdentifierString(), formal_parameters.scope, body,
- materialized_literal_count, expected_property_count,
- formal_parameters.num_parameters(), formal_parameters.function_length,
+ expected_property_count, formal_parameters.num_parameters(),
+ formal_parameters.function_length,
FunctionLiteral::kNoDuplicateParameters,
FunctionLiteral::kAnonymousExpression, eager_compile_hint,
formal_parameters.scope->start_position(), has_braces,
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/preparse-data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698