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

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

Issue 2629363002: [Ignition/turbo] Add a CallWithSpread bytecode. (Closed)
Patch Set: reparent on the bytecode CL Created 3 years, 11 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.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 eade9a7402a4b7200e286d8b1f9067bbe6a88e5e..73e6151ff9ef4596c5ad2e8adcd620ba1e10ddf1 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -2609,6 +2609,7 @@ typename ParserBase<Impl>::ExpressionListT ParserBase<Impl>::ParseArguments(
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();
bool is_spread = Check(Token::ELLIPSIS);
@@ -2632,6 +2633,7 @@ typename ParserBase<Impl>::ExpressionListT ParserBase<Impl>::ParseArguments(
// 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++;
@@ -2667,7 +2669,11 @@ typename ParserBase<Impl>::ExpressionListT ParserBase<Impl>::ParseArguments(
// Unspread parameter sequences are translated into array literals in the
// parser. Ensure that the number of materialized literals matches between
// the parser and preparser
- impl()->MaterializeUnspreadArgumentsLiterals(unspread_sequences_count);
+ 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);
+ }
}
}
@@ -3209,7 +3215,7 @@ ParserBase<Impl>::ParseLeftHandSideExpression(bool* ok) {
bool is_super_call = result->IsSuperCallReference();
if (spread_pos.IsValid()) {
- result = impl()->SpreadCall(result, args, pos);
+ result = impl()->SpreadCall(result, args, pos, is_possibly_eval);
} else {
result = factory()->NewCall(result, args, pos, is_possibly_eval);
}
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698