From 92e4123de76879f438b69d3185a00ffb359176b7 Mon Sep 17 00:00:00 2001 From: Keeley Hammond Date: Thu, 23 May 2024 02:03:24 -0700 Subject: [PATCH] chore: cherry-pick 3e037e195e50 from v8 (#42257) * chore: cherry-pick 3e037e195e50 from v8 * chore: update patches --------- Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> --- patches/v8/.patches | 1 + patches/v8/cherry-pick-3e037e195e50.patch | 41 +++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 patches/v8/cherry-pick-3e037e195e50.patch diff --git a/patches/v8/.patches b/patches/v8/.patches index 5bddfa1e29..966dc8e739 100644 --- a/patches/v8/.patches +++ b/patches/v8/.patches @@ -9,3 +9,4 @@ merged_runtime_recreate_enum_cache_on_map_update_if_any_previous.patch cherry-pick-f320600cd1f4.patch cherry-pick-b3c01ac1e60a.patch cherry-pick-6503a987d966.patch +cherry-pick-3e037e195e50.patch diff --git a/patches/v8/cherry-pick-3e037e195e50.patch b/patches/v8/cherry-pick-3e037e195e50.patch new file mode 100644 index 0000000000..98e1963500 --- /dev/null +++ b/patches/v8/cherry-pick-3e037e195e50.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shu-yu Guo +Date: Tue, 21 May 2024 10:06:20 -0700 +Subject: Using FunctionParsingScope for parsing class static blocks + +Class static blocks contain statements, don't inherit the +ExpressionScope stack. + +Bug: 341663589 +Change-Id: Id52a60d77781201a706fcf2290d7d103f39bed83 +Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5553030 +Commit-Queue: Shu-yu Guo +Commit-Queue: Adam Klein +Reviewed-by: Adam Klein +Cr-Commit-Position: refs/heads/main@{#94014} + +diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc +index 6dfcd45cf208e58a2fc0cd18ba3b115bae35a0d5..61b8fbf0cfcaa02a92ead411e4bcbc1f36dfdad3 100644 +--- a/src/ast/scopes.cc ++++ b/src/ast/scopes.cc +@@ -2441,7 +2441,7 @@ bool Scope::MustAllocate(Variable* var) { + var->set_is_used(); + if (inner_scope_calls_eval_ && !var->is_this()) var->SetMaybeAssigned(); + } +- DCHECK(!var->has_forced_context_allocation() || var->is_used()); ++ CHECK(!var->has_forced_context_allocation() || var->is_used()); + // Global variables do not need to be allocated. + return !var->IsGlobalObjectProperty() && var->is_used(); + } +diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h +index 232a6bdae48d5d6300b53bfd05b42841d2eae664..9b6c217d8b9d5330750b2fde4439d7e5d09de93f 100644 +--- a/src/parsing/parser-base.h ++++ b/src/parsing/parser-base.h +@@ -2619,6 +2619,7 @@ typename ParserBase::BlockT ParserBase::ParseClassStaticBlock( + } + + FunctionState initializer_state(&function_state_, &scope_, initializer_scope); ++ FunctionParsingScope body_parsing_scope(impl()); + AcceptINScope accept_in(this, true); + + // Each static block has its own var and lexical scope, so make a new var