Commit bfe134a7 authored by Maya Lekova's avatar Maya Lekova Committed by Commit Bot

Revert "[parser] Set all tokens to ILLEGAL on parser error"

This reverts commit ea8aa6a7.

Reason for revert: Breaking V8 Win64 - debug build, see
https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64%20-%20debug/25531

Original change's description:
> [parser] Set all tokens to ILLEGAL on parser error
> 
> Otherwise already peeked tokens will possibly pass later checks causing us to
> parse more than necessary. Initially we held off on doing this since subsequent
> Consume calls would fail after previous checks succeeded; especially in the
> case of stack overflow. However, we've previously relaxed that DCHECK to also
> pass if the parser has an error.
> 
> Change-Id: I413dffd475982d07299a08270fa94fdc3858e883
> Reviewed-on: https://chromium-review.googlesource.com/c/1304313
> Reviewed-by: Marja Hölttä <marja@chromium.org>
> Commit-Queue: Toon Verwaest <verwaest@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#57054}

TBR=marja@chromium.org,verwaest@chromium.org

Change-Id: Ifddd3cefa3876ec03aa1c137dfa95da3d933532e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/1304295Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57057}
parent da21a0d8
...@@ -3364,8 +3364,7 @@ ParserBase<Impl>::ParseFunctionExpression() { ...@@ -3364,8 +3364,7 @@ ParserBase<Impl>::ParseFunctionExpression() {
// We don't want dynamic functions to actually declare their name // We don't want dynamic functions to actually declare their name
// "anonymous". We just want that name in the toString(). // "anonymous". We just want that name in the toString().
Consume(Token::IDENTIFIER); Consume(Token::IDENTIFIER);
DCHECK_IMPLIES(!has_error(), DCHECK(scanner()->CurrentMatchesContextual(Token::ANONYMOUS));
scanner()->CurrentMatchesContextual(Token::ANONYMOUS));
} else if (peek_any_identifier()) { } else if (peek_any_identifier()) {
bool is_await = false; bool is_await = false;
name = ParseIdentifierOrStrictReservedWord( name = ParseIdentifierOrStrictReservedWord(
...@@ -4420,9 +4419,9 @@ ParserBase<Impl>::ParseAsyncFunctionLiteral() { ...@@ -4420,9 +4419,9 @@ ParserBase<Impl>::ParseAsyncFunctionLiteral() {
// Consuming token we did not peek yet, which could lead to a ILLEGAL token // Consuming token we did not peek yet, which could lead to a ILLEGAL token
// in the case of a stackoverflow. // in the case of a stackoverflow.
Consume(Token::IDENTIFIER); Expect(Token::IDENTIFIER);
DCHECK_IMPLIES(!has_error(), RETURN_IF_PARSE_ERROR;
scanner()->CurrentMatchesContextual(Token::ANONYMOUS)); DCHECK(scanner()->CurrentMatchesContextual(Token::ANONYMOUS));
} else if (peek_any_identifier()) { } else if (peek_any_identifier()) {
type = FunctionLiteral::kNamedExpression; type = FunctionLiteral::kNamedExpression;
bool is_await = false; bool is_await = false;
......
...@@ -238,12 +238,7 @@ class Scanner { ...@@ -238,12 +238,7 @@ class Scanner {
// Sets the Scanner into an error state to stop further scanning and terminate // Sets the Scanner into an error state to stop further scanning and terminate
// the parsing by only returning ILLEGAL tokens after that. // the parsing by only returning ILLEGAL tokens after that.
V8_INLINE void set_parser_error() { V8_INLINE void set_parser_error() { source_->set_parser_error(); }
source_->set_parser_error();
current_->token = Token::ILLEGAL;
next_->token = Token::ILLEGAL;
next_next_->token = Token::ILLEGAL;
}
V8_INLINE void reset_parser_error_flag() { V8_INLINE void reset_parser_error_flag() {
source_->reset_parser_error_flag(); source_->reset_parser_error_flag();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment