Commit 5f800d25 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

Revert "[scanner] Faster SkipMultiLineComment by avoiding a copy."

This reverts commit 9c4200b2.

Reason for revert: breaks arm64 msan: https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Linux%20-%20arm64%20-%20sim%20-%20MSAN/22108

Original change's description:
> [scanner] Faster SkipMultiLineComment by avoiding a copy.
> 
> Avoid coping the last character to a local variable, by checking the parsing
> state in a different order.
> 
> BUG=v8:7926
> 
> Change-Id: I0b62f711674beac8c81a25dd566a5ed0d681948b
> Reviewed-on: https://chromium-review.googlesource.com/1148456
> Commit-Queue: Florian Sattler <sattlerf@google.com>
> Reviewed-by: Marja Hölttä <marja@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#54657}

TBR=marja@chromium.org,sattlerf@google.com

Change-Id: I665bce8214e6d0b8f8a619820ff13f37bc722332
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:7926
Reviewed-on: https://chromium-review.googlesource.com/1148620Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54658}
parent 9c4200b2
...@@ -555,30 +555,28 @@ void Scanner::TryToParseSourceURLComment() { ...@@ -555,30 +555,28 @@ void Scanner::TryToParseSourceURLComment() {
} }
} }
Token::Value Scanner::SkipMultiLineComment() { Token::Value Scanner::SkipMultiLineComment() {
DCHECK_EQ(c0_, '*'); DCHECK_EQ(c0_, '*');
Advance(); Advance();
while (c0_ != kEndOfInput) { while (c0_ != kEndOfInput) {
uc32 ch = c0_;
Advance();
DCHECK(!unibrow::IsLineTerminator(kEndOfInput)); DCHECK(!unibrow::IsLineTerminator(kEndOfInput));
if (!has_multiline_comment_before_next_ && unibrow::IsLineTerminator(c0_)) { if (unibrow::IsLineTerminator(ch)) {
// Following ECMA-262, section 7.4, a comment containing // Following ECMA-262, section 7.4, a comment containing
// a newline will make the comment count as a line-terminator. // a newline will make the comment count as a line-terminator.
has_multiline_comment_before_next_ = true; has_multiline_comment_before_next_ = true;
} }
while (V8_UNLIKELY(c0_ == '*')) {
Advance();
// If we have reached the end of the multi-line comment, we // If we have reached the end of the multi-line comment, we
// consume the '/' and insert a whitespace. This way all // consume the '/' and insert a whitespace. This way all
// multi-line comments are treated as whitespace. // multi-line comments are treated as whitespace.
if (c0_ == '/') { if (ch == '*' && c0_ == '/') {
c0_ = ' '; c0_ = ' ';
return Token::WHITESPACE; return Token::WHITESPACE;
} }
} }
Advance();
}
// Unterminated multi-line comment. // Unterminated multi-line comment.
return Token::ILLEGAL; return Token::ILLEGAL;
......
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