Skip to content

Commit 5890d09

Browse files
authored
deps: patch V8 to 10.9.194.6
Refs: v8/v8@10.9.194.4...10.9.194.6 PR-URL: #45748 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]>
1 parent 2b9d3b2 commit 5890d09

File tree

5 files changed

+49
-73
lines changed

5 files changed

+49
-73
lines changed

deps/v8/include/v8-version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 10
1212
#define V8_MINOR_VERSION 9
1313
#define V8_BUILD_NUMBER 194
14-
#define V8_PATCH_LEVEL 4
14+
#define V8_PATCH_LEVEL 6
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

+10-15
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

+30-45
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 {

deps/v8/src/sandbox/external-pointer-table-inl.h

+8
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#define V8_SANDBOX_EXTERNAL_POINTER_TABLE_INL_H_
77

88
#include "src/base/atomicops.h"
9+
#include "src/common/assert-scope.h"
910
#include "src/sandbox/external-pointer-table.h"
1011
#include "src/sandbox/external-pointer.h"
1112
#include "src/utils/allocation.h"
@@ -75,6 +76,13 @@ ExternalPointerHandle ExternalPointerTable::AllocateAndInitializeEntry(
7576
Isolate* isolate, Address initial_value, ExternalPointerTag tag) {
7677
DCHECK(is_initialized());
7778

79+
// We currently don't want entry allocation to trigger garbage collection as
80+
// this may cause seemingly harmless pointer field assignments to trigger
81+
// garbage collection. This is especially true for lazily-initialized
82+
// external pointer slots which will typically only allocate the external
83+
// pointer table entry when the pointer is first set to a non-null value.
84+
DisallowGarbageCollection no_gc;
85+
7886
Freelist freelist;
7987
bool success = false;
8088
while (!success) {

deps/v8/src/sandbox/external-pointer-table.cc

-12
Original file line numberDiff line numberDiff line change
@@ -315,18 +315,6 @@ ExternalPointerTable::Freelist ExternalPointerTable::Grow(Isolate* isolate) {
315315

316316
set_capacity(new_capacity);
317317

318-
// Schedule GC when the table's utilization crosses one of these thresholds.
319-
constexpr double kGCThresholds[] = {0.5, 0.75, 0.9, 0.95, 0.99};
320-
constexpr double kMaxCapacity = static_cast<double>(kMaxExternalPointers);
321-
double old_utilization = static_cast<double>(old_capacity) / kMaxCapacity;
322-
double new_utilization = static_cast<double>(new_capacity) / kMaxCapacity;
323-
for (double threshold : kGCThresholds) {
324-
if (old_utilization < threshold && new_utilization >= threshold) {
325-
isolate->heap()->ReportExternalMemoryPressure();
326-
break;
327-
}
328-
}
329-
330318
// Build freelist bottom to top, which might be more cache friendly.
331319
uint32_t start = std::max<uint32_t>(old_capacity, 1); // Skip entry zero
332320
uint32_t last = new_capacity - 1;

0 commit comments

Comments
 (0)