Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: patch V8 to 7.8.279.15 #29899

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deps/v8/include/v8-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 7
#define V8_MINOR_VERSION 8
#define V8_BUILD_NUMBER 279
#define V8_PATCH_LEVEL 14
#define V8_PATCH_LEVEL 15

// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
Expand Down
1 change: 1 addition & 0 deletions deps/v8/src/ast/scopes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1396,6 +1396,7 @@ void Scope::AnalyzePartially(DeclarationScope* max_outer_scope,

for (VariableProxy* proxy = scope->unresolved_list_.first();
proxy != nullptr; proxy = proxy->next_unresolved()) {
if (proxy->is_removed_from_unresolved()) continue;
DCHECK(!proxy->is_resolved());
Variable* var =
Lookup<kParsedScope>(proxy, scope, max_outer_scope->outer_scope());
Expand Down
8 changes: 4 additions & 4 deletions deps/v8/src/parsing/expression-scope.h
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,10 @@ class ExpressionParsingScope : public ExpressionScope<Types> {
return end;
}

ScopedList<std::pair<VariableProxy*, int>>* variable_list() {
return &variable_list_;
}

protected:
bool is_verified() const {
#ifdef DEBUG
Expand All @@ -549,10 +553,6 @@ class ExpressionParsingScope : public ExpressionScope<Types> {

void ValidatePattern() { Validate(kPatternIndex); }

ScopedList<std::pair<VariableProxy*, int>>* variable_list() {
return &variable_list_;
}

private:
friend class AccumulationScope<Types>;

Expand Down
45 changes: 31 additions & 14 deletions deps/v8/src/parsing/parser-base.h
Original file line number Diff line number Diff line change
Expand Up @@ -5062,20 +5062,37 @@ ParserBase<Impl>::ParseExpressionOrLabelledStatement(
}

bool starts_with_identifier = peek_any_identifier();
ExpressionT expr = ParseExpression();
if (peek() == Token::COLON && starts_with_identifier &&
impl()->IsIdentifier(expr)) {
// The whole expression was a single identifier, and not, e.g.,
// something starting with an identifier or a parenthesized identifier.
impl()->DeclareLabel(&labels, &own_labels,
impl()->AsIdentifierExpression(expr));
Consume(Token::COLON);
// ES#sec-labelled-function-declarations Labelled Function Declarations
if (peek() == Token::FUNCTION && is_sloppy(language_mode()) &&
allow_function == kAllowLabelledFunctionStatement) {
return ParseFunctionDeclaration();
}
return ParseStatement(labels, own_labels, allow_function);

ExpressionT expr;
{
// Effectively inlines ParseExpression, so potential labels can be extracted
// from expression_scope.
ExpressionParsingScope expression_scope(impl());
AcceptINScope scope(this, true);
expr = ParseExpressionCoverGrammar();
expression_scope.ValidateExpression();

if (peek() == Token::COLON && starts_with_identifier &&
impl()->IsIdentifier(expr)) {
// The whole expression was a single identifier, and not, e.g.,
// something starting with an identifier or a parenthesized identifier.
DCHECK_EQ(expression_scope.variable_list()->length(), 1);
VariableProxy* label = expression_scope.variable_list()->at(0).first;
impl()->DeclareLabel(&labels, &own_labels, label->raw_name());

// Remove the "ghost" variable that turned out to be a label from the top
// scope. This way, we don't try to resolve it during the scope
// processing.
this->scope()->DeleteUnresolved(label);

Consume(Token::COLON);
// ES#sec-labelled-function-declarations Labelled Function Declarations
if (peek() == Token::FUNCTION && is_sloppy(language_mode()) &&
allow_function == kAllowLabelledFunctionStatement) {
return ParseFunctionDeclaration();
}
return ParseStatement(labels, own_labels, allow_function);
}
}

// If we have an extension, we allow a native function declaration.
Expand Down
19 changes: 5 additions & 14 deletions deps/v8/src/parsing/parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1489,15 +1489,11 @@ Statement* Parser::DeclareNative(const AstRawString* name, int pos) {

void Parser::DeclareLabel(ZonePtrList<const AstRawString>** labels,
ZonePtrList<const AstRawString>** own_labels,
VariableProxy* var) {
DCHECK(IsIdentifier(var));
const AstRawString* label = var->raw_name();

// TODO(1240780): We don't check for redeclaration of labels
// during preparsing since keeping track of the set of active
// labels requires nontrivial changes to the way scopes are
// structured. However, these are probably changes we want to
// make later anyway so we should go back and fix this then.
const AstRawString* label) {
// TODO(1240780): We don't check for redeclaration of labels during preparsing
// since keeping track of the set of active labels requires nontrivial changes
// to the way scopes are structured. However, these are probably changes we
// want to make later anyway so we should go back and fix this then.
if (ContainsLabel(*labels, label) || TargetStackContainsLabel(label)) {
ReportMessage(MessageTemplate::kLabelRedeclaration, label);
return;
Expand All @@ -1515,11 +1511,6 @@ void Parser::DeclareLabel(ZonePtrList<const AstRawString>** labels,
}
(*labels)->Add(label, zone());
(*own_labels)->Add(label, zone());

// Remove the "ghost" variable that turned out to be a label
// from the top scope. This way, we don't try to resolve it
// during the scope processing.
scope()->DeleteUnresolved(var);
}

bool Parser::ContainsLabel(ZonePtrList<const AstRawString>* labels,
Expand Down
3 changes: 2 additions & 1 deletion deps/v8/src/parsing/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <cstddef>

#include "src/ast/ast-source-ranges.h"
#include "src/ast/ast-value-factory.h"
#include "src/ast/ast.h"
#include "src/ast/scopes.h"
#include "src/base/compiler-specific.h"
Expand Down Expand Up @@ -273,7 +274,7 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
Statement* BuildInitializationBlock(DeclarationParsingResult* parsing_result);
void DeclareLabel(ZonePtrList<const AstRawString>** labels,
ZonePtrList<const AstRawString>** own_labels,
VariableProxy* expr);
const AstRawString* label);
bool ContainsLabel(ZonePtrList<const AstRawString>* labels,
const AstRawString* label);
Expression* RewriteReturn(Expression* return_value, int pos);
Expand Down
10 changes: 3 additions & 7 deletions deps/v8/src/parsing/preparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#ifndef V8_PARSING_PREPARSER_H_
#define V8_PARSING_PREPARSER_H_

#include "src/ast/ast-value-factory.h"
#include "src/ast/ast.h"
#include "src/ast/scopes.h"
#include "src/parsing/parser-base.h"
Expand Down Expand Up @@ -1071,9 +1072,8 @@ class PreParser : public ParserBase<PreParser> {

V8_INLINE void DeclareLabel(ZonePtrList<const AstRawString>** labels,
ZonePtrList<const AstRawString>** own_labels,
const PreParserExpression& expr) {
DCHECK(!parsing_module_ || !expr.AsIdentifier().IsAwait());
DCHECK(IsIdentifier(expr));
const AstRawString* label) {
DCHECK(!parsing_module_ || !label->IsOneByteEqualTo("await"));
}

// TODO(nikolaos): The preparser currently does not keep track of labels.
Expand Down Expand Up @@ -1323,10 +1323,6 @@ class PreParser : public ParserBase<PreParser> {
return identifier.IsEvalOrArguments();
}

V8_INLINE bool IsAwait(const PreParserIdentifier& identifier) const {
return identifier.IsAwait();
}

// Returns true if the expression is of type "this.foo".
V8_INLINE static bool IsThisProperty(const PreParserExpression& expression) {
return expression.IsThisProperty();
Expand Down
15 changes: 15 additions & 0 deletions deps/v8/test/mjsunit/regress/regress-crbug-1009728.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Flags: --stress-lazy-source-positions

function foo(x) {
(function bar() {
{
x: 1
}
function f() {}
});
}
foo();
8 changes: 8 additions & 0 deletions deps/v8/test/mjsunit/regress/regress-crbug-1011596-module.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

export function foo() {
{ label: 1 }
return 42;
}
5 changes: 5 additions & 0 deletions deps/v8/test/mjsunit/regress/regress-crbug-1011596.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import "./regress-crbug-1011596-module.mjs"