Skip to content

Commit 0584133

Browse files
committed
Revert "deps: V8: cherry-pick f9257802c1c0"
This reverts commit 75da64c. PR-URL: #32521 Refs: v8/v8@8.1.307.20...8.1.307.26 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 8f86986 commit 0584133

File tree

7 files changed

+15
-21
lines changed

7 files changed

+15
-21
lines changed

deps/v8/src/parsing/parser.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ FunctionLiteral* Parser::ParseProgram(Isolate* isolate, Handle<Script> script,
505505
Scope::DeserializationMode::kIncludingVariables);
506506

507507
scanner_.Initialize();
508+
scanner_.SkipHashBang();
508509
FunctionLiteral* result = DoParseProgram(isolate, info);
509510
MaybeResetCharacterStream(info, result);
510511
MaybeProcessSourceRanges(info, result, stack_limit_);

deps/v8/src/parsing/preparser.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ PreParser::PreParseResult PreParser::PreParseProgram() {
7575
scope->set_is_being_lazily_parsed(true);
7676
#endif
7777

78+
// Note: We should only skip the hashbang in non-Eval scripts
79+
// (currently, Eval is not handled by the PreParser).
80+
scanner()->SkipHashBang();
81+
7882
// ModuleDeclarationInstantiation for Source Text Module Records creates a
7983
// new Module Environment Record whose outer lexical environment record is
8084
// the global scope.

deps/v8/src/parsing/scanner-inl.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -506,10 +506,6 @@ V8_INLINE Token::Value Scanner::ScanSingleToken() {
506506
return ScanTemplateSpan();
507507

508508
case Token::PRIVATE_NAME:
509-
if (source_pos() == 0 && Peek() == '!') {
510-
token = SkipSingleLineComment();
511-
continue;
512-
}
513509
return ScanPrivateName();
514510

515511
case Token::WHITESPACE:

deps/v8/src/parsing/scanner.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,13 @@ Token::Value Scanner::SkipMultiLineComment() {
314314
return Token::ILLEGAL;
315315
}
316316

317+
void Scanner::SkipHashBang() {
318+
if (c0_ == '#' && Peek() == '!' && source_pos() == 0) {
319+
SkipSingleLineComment();
320+
Scan();
321+
}
322+
}
323+
317324
Token::Value Scanner::ScanHtmlComment() {
318325
// Check for <!-- comments.
319326
DCHECK_EQ(c0_, '!');

deps/v8/src/parsing/scanner.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,9 @@ class V8_EXPORT_PRIVATE Scanner {
422422

423423
const Utf16CharacterStream* stream() const { return source_; }
424424

425+
// If the next characters in the stream are "#!", the line is skipped.
426+
void SkipHashBang();
427+
425428
private:
426429
// Scoped helper for saving & restoring scanner error state.
427430
// This is used for tagged template literals, in which normally forbidden

deps/v8/test/message/fail/hashbang-incomplete-string.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

deps/v8/test/message/fail/hashbang-incomplete-string.out

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)