Skip to content

Commit c842120

Browse files
committed
deps: patch V8 to 10.8.168.21
Refs: v8/v8@10.8.168.20...10.8.168.21 PR-URL: #45749 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
1 parent 4d9af84 commit c842120

File tree

3 files changed

+41
-61
lines changed

3 files changed

+41
-61
lines changed

deps/v8/include/v8-version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 10
1212
#define V8_MINOR_VERSION 8
1313
#define V8_BUILD_NUMBER 168
14-
#define V8_PATCH_LEVEL 20
14+
#define V8_PATCH_LEVEL 21
1515

1616
// Use 1 for candidates and 0 otherwise.
1717
// (Boolean macro values are not supported by all preprocessors.)

deps/v8/src/ast/scopes.cc

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -885,9 +885,8 @@ void DeclarationScope::AddLocal(Variable* var) {
885885
}
886886

887887
void Scope::Snapshot::Reparent(DeclarationScope* new_parent) {
888-
DCHECK(!IsCleared());
889-
DCHECK_EQ(new_parent, outer_scope_and_calls_eval_.GetPointer()->inner_scope_);
890-
DCHECK_EQ(new_parent->outer_scope_, outer_scope_and_calls_eval_.GetPointer());
888+
DCHECK_EQ(new_parent, outer_scope_->inner_scope_);
889+
DCHECK_EQ(new_parent->outer_scope_, outer_scope_);
891890
DCHECK_EQ(new_parent, new_parent->GetClosureScope());
892891
DCHECK_NULL(new_parent->inner_scope_);
893892
DCHECK(new_parent->unresolved_list_.is_empty());
@@ -912,12 +911,11 @@ void Scope::Snapshot::Reparent(DeclarationScope* new_parent) {
912911
new_parent->sibling_ = top_inner_scope_;
913912
}
914913

915-
Scope* outer_scope = outer_scope_and_calls_eval_.GetPointer();
916-
new_parent->unresolved_list_.MoveTail(&outer_scope->unresolved_list_,
914+
new_parent->unresolved_list_.MoveTail(&outer_scope_->unresolved_list_,
917915
top_unresolved_);
918916

919917
// Move temporaries allocated for complex parameter initializers.
920-
DeclarationScope* outer_closure = outer_scope->GetClosureScope();
918+
DeclarationScope* outer_closure = outer_scope_->GetClosureScope();
921919
for (auto it = top_local_; it != outer_closure->locals()->end(); ++it) {
922920
Variable* local = *it;
923921
DCHECK_EQ(VariableMode::kTemporary, local->mode());
@@ -929,16 +927,10 @@ void Scope::Snapshot::Reparent(DeclarationScope* new_parent) {
929927
outer_closure->locals_.Rewind(top_local_);
930928

931929
// Move eval calls since Snapshot's creation into new_parent.
932-
if (outer_scope_and_calls_eval_->calls_eval_) {
933-
new_parent->RecordDeclarationScopeEvalCall();
934-
new_parent->inner_scope_calls_eval_ = true;
930+
if (outer_scope_->calls_eval_) {
931+
new_parent->RecordEvalCall();
932+
declaration_scope_->sloppy_eval_can_extend_vars_ = false;
935933
}
936-
937-
// We are in the arrow function case. The calls eval we may have recorded
938-
// is intended for the inner scope and we should simply restore the
939-
// original "calls eval" flag of the outer scope.
940-
RestoreEvalFlag();
941-
Clear();
942934
}
943935

944936
void Scope::ReplaceOuterScope(Scope* outer) {
@@ -2576,6 +2568,9 @@ void Scope::AllocateVariablesRecursively() {
25762568
this->ForEach([](Scope* scope) -> Iteration {
25772569
DCHECK(!scope->already_resolved_);
25782570
if (WasLazilyParsed(scope)) return Iteration::kContinue;
2571+
if (scope->sloppy_eval_can_extend_vars_) {
2572+
scope->num_heap_slots_ = Context::MIN_CONTEXT_EXTENDED_SLOTS;
2573+
}
25792574
DCHECK_EQ(scope->ContextHeaderLength(), scope->num_heap_slots_);
25802575

25812576
// Allocate variables for this scope.

deps/v8/src/ast/scopes.h

Lines changed: 30 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -110,58 +110,38 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
110110

111111
class Snapshot final {
112112
public:
113-
Snapshot()
114-
: outer_scope_and_calls_eval_(nullptr, false),
115-
top_unresolved_(),
116-
top_local_() {
117-
DCHECK(IsCleared());
118-
}
119113
inline explicit Snapshot(Scope* scope);
120114

121115
// Disallow copy and move.
122116
Snapshot(const Snapshot&) = delete;
123117
Snapshot(Snapshot&&) = delete;
124118

125119
~Snapshot() {
126-
// If we're still active, there was no arrow function. In that case outer
127-
// calls eval if it already called eval before this snapshot started, or
128-
// if the code during the snapshot called eval.
129-
if (!IsCleared() && outer_scope_and_calls_eval_.GetPayload()) {
130-
RestoreEvalFlag();
120+
// Restore eval flags from before the scope was active.
121+
if (sloppy_eval_can_extend_vars_) {
122+
declaration_scope_->sloppy_eval_can_extend_vars_ = true;
131123
}
132-
}
133-
134-
void RestoreEvalFlag() {
135-
if (outer_scope_and_calls_eval_.GetPayload()) {
136-
// This recreates both calls_eval and sloppy_eval_can_extend_vars.
137-
outer_scope_and_calls_eval_.GetPointer()->RecordEvalCall();
124+
if (calls_eval_) {
125+
outer_scope_->calls_eval_ = true;
138126
}
139127
}
140128

141129
void Reparent(DeclarationScope* new_parent);
142-
bool IsCleared() const {
143-
return outer_scope_and_calls_eval_.GetPointer() == nullptr;
144-
}
145-
146-
void Clear() {
147-
outer_scope_and_calls_eval_.SetPointer(nullptr);
148-
#ifdef DEBUG
149-
outer_scope_and_calls_eval_.SetPayload(false);
150-
top_inner_scope_ = nullptr;
151-
top_local_ = base::ThreadedList<Variable>::Iterator();
152-
top_unresolved_ = UnresolvedList::Iterator();
153-
#endif
154-
}
155130

156131
private:
157-
// During tracking calls_eval caches whether the outer scope called eval.
158-
// Upon move assignment we store whether the new inner scope calls eval into
159-
// the move target calls_eval bit, and restore calls eval on the outer
160-
// scope.
161-
base::PointerWithPayload<Scope, bool, 1> outer_scope_and_calls_eval_;
132+
Scope* outer_scope_;
133+
Scope* declaration_scope_;
162134
Scope* top_inner_scope_;
163135
UnresolvedList::Iterator top_unresolved_;
164136
base::ThreadedList<Variable>::Iterator top_local_;
137+
// While the scope is active, the scope caches the flag values for
138+
// outer_scope_ / declaration_scope_ they can be used to know what happened
139+
// while parsing the arrow head. If this turns out to be an arrow head, new
140+
// values on the respective scopes will be cleared and moved to the inner
141+
// scope. Otherwise the cached flags will be merged with the flags from the
142+
// arrow head.
143+
bool calls_eval_;
144+
bool sloppy_eval_can_extend_vars_;
165145
};
166146

167147
enum class DeserializationMode { kIncludingVariables, kScopesOnly };
@@ -907,8 +887,8 @@ class V8_EXPORT_PRIVATE DeclarationScope : public Scope {
907887
void RecordDeclarationScopeEvalCall() {
908888
calls_eval_ = true;
909889

910-
// If this isn't a sloppy eval, we don't care about it.
911-
if (language_mode() != LanguageMode::kSloppy) return;
890+
// The caller already checked whether we're in sloppy mode.
891+
CHECK(is_sloppy(language_mode()));
912892

913893
// Sloppy eval in script scopes can only introduce global variables anyway,
914894
// so we don't care that it calls sloppy eval.
@@ -942,7 +922,6 @@ class V8_EXPORT_PRIVATE DeclarationScope : public Scope {
942922
}
943923

944924
sloppy_eval_can_extend_vars_ = true;
945-
num_heap_slots_ = Context::MIN_CONTEXT_EXTENDED_SLOTS;
946925
}
947926

948927
bool sloppy_eval_can_extend_vars() const {
@@ -1367,7 +1346,9 @@ class V8_EXPORT_PRIVATE DeclarationScope : public Scope {
13671346

13681347
void Scope::RecordEvalCall() {
13691348
calls_eval_ = true;
1370-
GetDeclarationScope()->RecordDeclarationScopeEvalCall();
1349+
if (is_sloppy(language_mode())) {
1350+
GetDeclarationScope()->RecordDeclarationScopeEvalCall();
1351+
}
13711352
RecordInnerScopeEvalCall();
13721353
// The eval contents might access "super" (if it's inside a function that
13731354
// binds super).
@@ -1380,14 +1361,18 @@ void Scope::RecordEvalCall() {
13801361
}
13811362

13821363
Scope::Snapshot::Snapshot(Scope* scope)
1383-
: outer_scope_and_calls_eval_(scope, scope->calls_eval_),
1364+
: outer_scope_(scope),
1365+
declaration_scope_(scope->GetDeclarationScope()),
13841366
top_inner_scope_(scope->inner_scope_),
13851367
top_unresolved_(scope->unresolved_list_.end()),
1386-
top_local_(scope->GetClosureScope()->locals_.end()) {
1387-
// Reset in order to record eval calls during this Snapshot's lifetime.
1388-
outer_scope_and_calls_eval_.GetPointer()->calls_eval_ = false;
1389-
outer_scope_and_calls_eval_.GetPointer()->sloppy_eval_can_extend_vars_ =
1390-
false;
1368+
top_local_(scope->GetClosureScope()->locals_.end()),
1369+
calls_eval_(outer_scope_->calls_eval_),
1370+
sloppy_eval_can_extend_vars_(
1371+
declaration_scope_->sloppy_eval_can_extend_vars_) {
1372+
// Reset in order to record (sloppy) eval calls during this Snapshot's
1373+
// lifetime.
1374+
outer_scope_->calls_eval_ = false;
1375+
declaration_scope_->sloppy_eval_can_extend_vars_ = false;
13911376
}
13921377

13931378
class ModuleScope final : public DeclarationScope {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy