Commit 9fa50159 authored by Maya Lekova's avatar Maya Lekova Committed by Commit Bot

Revert "[scanner] Add Skip to be used after successful Peek"

This reverts commit 7fb6109b.

Reason for revert: Speculatively reverting because of https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8-Blink%20Linux%2064%20(dbg)/13264

Original change's description:
> [scanner] Add Skip to be used after successful Peek
> 
> Change-Id: Ic3df370e2859bf77572b34a314ad8ed17b75b942
> Reviewed-on: https://chromium-review.googlesource.com/1183485
> Commit-Queue: Toon Verwaest <verwaest@chromium.org>
> Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#55279}

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

Change-Id: Ie1825cb4c971d2ec6a00b7ce3384c97ebbf885ce
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/1184922Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55301}
parent 4a54b184
...@@ -529,8 +529,7 @@ Token::Value Scanner::ScanHtmlComment() { ...@@ -529,8 +529,7 @@ Token::Value Scanner::ScanHtmlComment() {
PushBack('!'); // undo Advance() PushBack('!'); // undo Advance()
return Token::LT; return Token::LT;
} }
source_->Skip('-'); Advance();
DCHECK_EQ('-', c0_);
found_html_comment_ = true; found_html_comment_ = true;
return SkipSingleHTMLComment(); return SkipSingleHTMLComment();
...@@ -675,7 +674,7 @@ void Scanner::Scan() { ...@@ -675,7 +674,7 @@ void Scanner::Scan() {
if (c0_ == '/') { if (c0_ == '/') {
uc32 c = Peek(); uc32 c = Peek();
if (c == '#' || c == '@') { if (c == '#' || c == '@') {
source_->Skip(c); Advance();
Advance(); Advance();
token = SkipSourceURLComment(); token = SkipSourceURLComment();
} else { } else {
...@@ -728,7 +727,7 @@ void Scanner::Scan() { ...@@ -728,7 +727,7 @@ void Scanner::Scan() {
token = Token::PERIOD; token = Token::PERIOD;
if (c0_ == '.') { if (c0_ == '.') {
if (Peek() == '.') { if (Peek() == '.') {
source_->Skip('.'); Advance();
Advance(); Advance();
token = Token::ELLIPSIS; token = Token::ELLIPSIS;
} }
...@@ -1005,8 +1004,8 @@ Token::Value Scanner::ScanTemplateSpan() { ...@@ -1005,8 +1004,8 @@ Token::Value Scanner::ScanTemplateSpan() {
result = Token::TEMPLATE_TAIL; result = Token::TEMPLATE_TAIL;
break; break;
} else if (c == '$' && Peek() == '{') { } else if (c == '$' && Peek() == '{') {
source_->Skip('{'); Advance(); // Consume '$'
Advance(); Advance(); // Consume '{'
break; break;
} else if (c == '\\') { } else if (c == '\\') {
Advance(); // Consume '\\' Advance(); // Consume '\\'
......
...@@ -50,12 +50,6 @@ class Utf16CharacterStream { ...@@ -50,12 +50,6 @@ class Utf16CharacterStream {
} }
} }
inline void Skip(uc32 c) {
DCHECK_LT(buffer_cursor_, buffer_end_);
DCHECK_EQ(c, static_cast<uc32>(*buffer_cursor_));
buffer_cursor_++;
}
// Returns and advances past the next UTF-16 code unit in the input // Returns and advances past the next UTF-16 code unit in the input
// stream. If there are no more code units it returns kEndOfInput. // stream. If there are no more code units it returns kEndOfInput.
inline uc32 Advance() { inline uc32 Advance() {
...@@ -640,13 +634,13 @@ class Scanner { ...@@ -640,13 +634,13 @@ class Scanner {
bool CombineSurrogatePair() { bool CombineSurrogatePair() {
DCHECK(!unibrow::Utf16::IsLeadSurrogate(kEndOfInput)); DCHECK(!unibrow::Utf16::IsLeadSurrogate(kEndOfInput));
if (unibrow::Utf16::IsLeadSurrogate(c0_)) { if (unibrow::Utf16::IsLeadSurrogate(c0_)) {
uc32 c1 = source_->Peek(); uc32 c1 = source_->Advance();
DCHECK(!unibrow::Utf16::IsTrailSurrogate(kEndOfInput)); DCHECK(!unibrow::Utf16::IsTrailSurrogate(kEndOfInput));
if (unibrow::Utf16::IsTrailSurrogate(c1)) { if (unibrow::Utf16::IsTrailSurrogate(c1)) {
c0_ = unibrow::Utf16::CombineSurrogatePair(c0_, c1); c0_ = unibrow::Utf16::CombineSurrogatePair(c0_, c1);
source_->Skip(c1);
return true; return true;
} }
source_->Back();
} }
return false; return false;
} }
......
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