Skip to content

Commit 2088cb4

Browse files
targosdanielleadams
authored andcommitted
deps: patch V8 to 10.2.154.23
Refs: v8/v8@10.2.154.19...10.2.154.23 PR-URL: #45997 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Danielle Adams <adamzdanielle@gmail.com>
1 parent 71433f3 commit 2088cb4

8 files changed

+104
-111
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 2
1313
#define V8_BUILD_NUMBER 154
14-
#define V8_PATCH_LEVEL 19
14+
#define V8_PATCH_LEVEL 23
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
@@ -888,9 +888,8 @@ void DeclarationScope::AddLocal(Variable* var) {
888888
}
889889

890890
void Scope::Snapshot::Reparent(DeclarationScope* new_parent) {
891-
DCHECK(!IsCleared());
892-
DCHECK_EQ(new_parent, outer_scope_and_calls_eval_.GetPointer()->inner_scope_);
893-
DCHECK_EQ(new_parent->outer_scope_, outer_scope_and_calls_eval_.GetPointer());
891+
DCHECK_EQ(new_parent, outer_scope_->inner_scope_);
892+
DCHECK_EQ(new_parent->outer_scope_, outer_scope_);
894893
DCHECK_EQ(new_parent, new_parent->GetClosureScope());
895894
DCHECK_NULL(new_parent->inner_scope_);
896895
DCHECK(new_parent->unresolved_list_.is_empty());
@@ -915,12 +914,11 @@ void Scope::Snapshot::Reparent(DeclarationScope* new_parent) {
915914
new_parent->sibling_ = top_inner_scope_;
916915
}
917916

918-
Scope* outer_scope = outer_scope_and_calls_eval_.GetPointer();
919-
new_parent->unresolved_list_.MoveTail(&outer_scope->unresolved_list_,
917+
new_parent->unresolved_list_.MoveTail(&outer_scope_->unresolved_list_,
920918
top_unresolved_);
921919

922920
// Move temporaries allocated for complex parameter initializers.
923-
DeclarationScope* outer_closure = outer_scope->GetClosureScope();
921+
DeclarationScope* outer_closure = outer_scope_->GetClosureScope();
924922
for (auto it = top_local_; it != outer_closure->locals()->end(); ++it) {
925923
Variable* local = *it;
926924
DCHECK_EQ(VariableMode::kTemporary, local->mode());
@@ -932,16 +930,10 @@ void Scope::Snapshot::Reparent(DeclarationScope* new_parent) {
932930
outer_closure->locals_.Rewind(top_local_);
933931

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

947939
void Scope::ReplaceOuterScope(Scope* outer) {
@@ -2579,6 +2571,9 @@ void Scope::AllocateVariablesRecursively() {
25792571
this->ForEach([](Scope* scope) -> Iteration {
25802572
DCHECK(!scope->already_resolved_);
25812573
if (WasLazilyParsed(scope)) return Iteration::kContinue;
2574+
if (scope->sloppy_eval_can_extend_vars_) {
2575+
scope->num_heap_slots_ = Context::MIN_CONTEXT_EXTENDED_SLOTS;
2576+
}
25822577
DCHECK_EQ(scope->ContextHeaderLength(), scope->num_heap_slots_);
25832578

25842579
// Allocate variables for this scope.

deps/v8/src/ast/scopes.h

+30-45
Original file line numberDiff line numberDiff line change
@@ -112,58 +112,38 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
112112

113113
class Snapshot final {
114114
public:
115-
Snapshot()
116-
: outer_scope_and_calls_eval_(nullptr, false),
117-
top_unresolved_(),
118-
top_local_() {
119-
DCHECK(IsCleared());
120-
}
121115
inline explicit Snapshot(Scope* scope);
122116

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

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

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

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

169149
enum class DeserializationMode { kIncludingVariables, kScopesOnly };
@@ -909,8 +889,8 @@ class V8_EXPORT_PRIVATE DeclarationScope : public Scope {
909889
void RecordDeclarationScopeEvalCall() {
910890
calls_eval_ = true;
911891

912-
// If this isn't a sloppy eval, we don't care about it.
913-
if (language_mode() != LanguageMode::kSloppy) return;
892+
// The caller already checked whether we're in sloppy mode.
893+
CHECK(is_sloppy(language_mode()));
914894

915895
// Sloppy eval in script scopes can only introduce global variables anyway,
916896
// so we don't care that it calls sloppy eval.
@@ -944,7 +924,6 @@ class V8_EXPORT_PRIVATE DeclarationScope : public Scope {
944924
}
945925

946926
sloppy_eval_can_extend_vars_ = true;
947-
num_heap_slots_ = Context::MIN_CONTEXT_EXTENDED_SLOTS;
948927
}
949928

950929
bool sloppy_eval_can_extend_vars() const {
@@ -1369,7 +1348,9 @@ class V8_EXPORT_PRIVATE DeclarationScope : public Scope {
13691348

13701349
void Scope::RecordEvalCall() {
13711350
calls_eval_ = true;
1372-
GetDeclarationScope()->RecordDeclarationScopeEvalCall();
1351+
if (is_sloppy(language_mode())) {
1352+
GetDeclarationScope()->RecordDeclarationScopeEvalCall();
1353+
}
13731354
RecordInnerScopeEvalCall();
13741355
// The eval contents might access "super" (if it's inside a function that
13751356
// binds super).
@@ -1382,14 +1363,18 @@ void Scope::RecordEvalCall() {
13821363
}
13831364

13841365
Scope::Snapshot::Snapshot(Scope* scope)
1385-
: outer_scope_and_calls_eval_(scope, scope->calls_eval_),
1366+
: outer_scope_(scope),
1367+
declaration_scope_(scope->GetDeclarationScope()),
13861368
top_inner_scope_(scope->inner_scope_),
13871369
top_unresolved_(scope->unresolved_list_.end()),
1388-
top_local_(scope->GetClosureScope()->locals_.end()) {
1389-
// Reset in order to record eval calls during this Snapshot's lifetime.
1390-
outer_scope_and_calls_eval_.GetPointer()->calls_eval_ = false;
1391-
outer_scope_and_calls_eval_.GetPointer()->sloppy_eval_can_extend_vars_ =
1392-
false;
1370+
top_local_(scope->GetClosureScope()->locals_.end()),
1371+
calls_eval_(outer_scope_->calls_eval_),
1372+
sloppy_eval_can_extend_vars_(
1373+
declaration_scope_->sloppy_eval_can_extend_vars_) {
1374+
// Reset in order to record (sloppy) eval calls during this Snapshot's
1375+
// lifetime.
1376+
outer_scope_->calls_eval_ = false;
1377+
declaration_scope_->sloppy_eval_can_extend_vars_ = false;
13931378
}
13941379

13951380
class ModuleScope final : public DeclarationScope {

deps/v8/src/builtins/promise-any.tq

+14-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,19 @@ PromiseAnyRejectElementClosure(
119119
kPromiseAnyRejectElementRemainingSlot);
120120

121121
// 9. Set errors[index] to x.
122-
const newCapacity = IntPtrMax(SmiUntag(remainingElementsCount), index + 1);
122+
123+
// The max computation below is an optimization to avoid excessive allocations
124+
// in the case of input promises being asynchronously rejected in ascending
125+
// index order.
126+
//
127+
// Note that subtracting 1 from remainingElementsCount is intentional. The
128+
// value of remainingElementsCount is 1 larger than the actual value during
129+
// iteration. So in the case of synchronous rejection, newCapacity is the
130+
// correct size by subtracting 1. In the case of asynchronous rejection this
131+
// is 1 smaller than the correct size, but is not incorrect as it is maxed
132+
// with index + 1.
133+
const newCapacity =
134+
IntPtrMax(SmiUntag(remainingElementsCount) - 1, index + 1);
123135
if (newCapacity > errors.length_intptr) deferred {
124136
errors = ExtractFixedArray(errors, 0, errors.length_intptr, newCapacity);
125137
*ContextSlot(
@@ -306,6 +318,7 @@ Reject(JSAny) {
306318
PromiseAnyRejectElementContextSlots::
307319
kPromiseAnyRejectElementErrorsSlot);
308320

321+
check(errors.length == index - 1);
309322
const error = ConstructAggregateError(errors);
310323
// 3. Return ThrowCompletion(error).
311324
goto Reject(error);

deps/v8/src/compiler/effect-control-linearizer.cc

+25-26
Original file line numberDiff line numberDiff line change
@@ -5384,6 +5384,8 @@ Node* EffectControlLinearizer::LowerLoadFieldByIndex(Node* node) {
53845384

53855385
auto if_double = __ MakeDeferredLabel();
53865386
auto done = __ MakeLabel(MachineRepresentation::kTagged);
5387+
auto loaded_field = __ MakeLabel(MachineRepresentation::kTagged);
5388+
auto done_double = __ MakeLabel(MachineRepresentation::kFloat64);
53875389

53885390
// Check if field is a mutable double field.
53895391
__ GotoIfNot(__ IntPtrEqual(__ WordAnd(index, one), zero), &if_double);
@@ -5400,8 +5402,8 @@ Node* EffectControlLinearizer::LowerLoadFieldByIndex(Node* node) {
54005402
Node* offset =
54015403
__ IntAdd(__ WordShl(index, __ IntPtrConstant(kTaggedSizeLog2 - 1)),
54025404
__ IntPtrConstant(JSObject::kHeaderSize - kHeapObjectTag));
5403-
Node* result = __ Load(MachineType::AnyTagged(), object, offset);
5404-
__ Goto(&done, result);
5405+
Node* field = __ Load(MachineType::AnyTagged(), object, offset);
5406+
__ Goto(&loaded_field, field);
54055407
}
54065408

54075409
// The field is located in the properties backing store of {object}.
@@ -5415,18 +5417,15 @@ Node* EffectControlLinearizer::LowerLoadFieldByIndex(Node* node) {
54155417
__ IntPtrConstant(kTaggedSizeLog2 - 1)),
54165418
__ IntPtrConstant((FixedArray::kHeaderSize - kTaggedSize) -
54175419
kHeapObjectTag));
5418-
Node* result = __ Load(MachineType::AnyTagged(), properties, offset);
5419-
__ Goto(&done, result);
5420+
Node* field = __ Load(MachineType::AnyTagged(), properties, offset);
5421+
__ Goto(&loaded_field, field);
54205422
}
54215423
}
54225424

54235425
// The field is a Double field, either unboxed in the object on 64-bit
54245426
// architectures, or a mutable HeapNumber.
54255427
__ Bind(&if_double);
54265428
{
5427-
auto loaded_field = __ MakeLabel(MachineRepresentation::kTagged);
5428-
auto done_double = __ MakeLabel(MachineRepresentation::kFloat64);
5429-
54305429
index = __ WordSar(index, one);
54315430

54325431
// Check if field is in-object or out-of-object.
@@ -5454,27 +5453,27 @@ Node* EffectControlLinearizer::LowerLoadFieldByIndex(Node* node) {
54545453
Node* field = __ Load(MachineType::AnyTagged(), properties, offset);
54555454
__ Goto(&loaded_field, field);
54565455
}
5456+
}
54575457

5458-
__ Bind(&loaded_field);
5459-
{
5460-
Node* field = loaded_field.PhiAt(0);
5461-
// We may have transitioned in-place away from double, so check that
5462-
// this is a HeapNumber -- otherwise the load is fine and we don't need
5463-
// to copy anything anyway.
5464-
__ GotoIf(ObjectIsSmi(field), &done, field);
5465-
Node* field_map = __ LoadField(AccessBuilder::ForMap(), field);
5466-
__ GotoIfNot(__ TaggedEqual(field_map, __ HeapNumberMapConstant()), &done,
5467-
field);
5468-
5469-
Node* value = __ LoadField(AccessBuilder::ForHeapNumberValue(), field);
5470-
__ Goto(&done_double, value);
5471-
}
5458+
__ Bind(&loaded_field);
5459+
{
5460+
Node* field = loaded_field.PhiAt(0);
5461+
// We may have transitioned in-place away from double, so check that
5462+
// this is a HeapNumber -- otherwise the load is fine and we don't need
5463+
// to copy anything anyway.
5464+
__ GotoIf(ObjectIsSmi(field), &done, field);
5465+
Node* field_map = __ LoadField(AccessBuilder::ForMap(), field);
5466+
__ GotoIfNot(__ TaggedEqual(field_map, __ HeapNumberMapConstant()), &done,
5467+
field);
54725468

5473-
__ Bind(&done_double);
5474-
{
5475-
Node* result = AllocateHeapNumberWithValue(done_double.PhiAt(0));
5476-
__ Goto(&done, result);
5477-
}
5469+
Node* value = __ LoadField(AccessBuilder::ForHeapNumberValue(), field);
5470+
__ Goto(&done_double, value);
5471+
}
5472+
5473+
__ Bind(&done_double);
5474+
{
5475+
Node* result = AllocateHeapNumberWithValue(done_double.PhiAt(0));
5476+
__ Goto(&done, result);
54785477
}
54795478

54805479
__ Bind(&done);

deps/v8/src/compiler/heap-refs.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ class PropertyAccessInfo;
5656
enum class AccessMode { kLoad, kStore, kStoreInLiteral, kHas, kDefine };
5757

5858
inline bool IsAnyStore(AccessMode mode) {
59-
return mode == AccessMode::kStore || mode == AccessMode::kStoreInLiteral;
59+
return mode == AccessMode::kStore || mode == AccessMode::kStoreInLiteral ||
60+
mode == AccessMode::kDefine;
6061
}
6162

6263
enum class OddballType : uint8_t {

deps/v8/src/compiler/js-native-context-specialization.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -2896,7 +2896,7 @@ JSNativeContextSpecialization::BuildElementAccess(
28962896

28972897
// Don't try to store to a copy-on-write backing store (unless supported by
28982898
// the store mode).
2899-
if (keyed_mode.access_mode() == AccessMode::kStore &&
2899+
if (IsAnyStore(keyed_mode.access_mode()) &&
29002900
IsSmiOrObjectElementsKind(elements_kind) &&
29012901
!IsCOWHandlingStoreMode(keyed_mode.store_mode())) {
29022902
effect = graph()->NewNode(

deps/v8/tools/v8heapconst.py

+21-21
Original file line numberDiff line numberDiff line change
@@ -538,27 +538,27 @@
538538
("old_space", 0x04b39): "StringSplitCache",
539539
("old_space", 0x04f41): "RegExpMultipleCache",
540540
("old_space", 0x05349): "BuiltinsConstantsTable",
541-
("old_space", 0x05775): "AsyncFunctionAwaitRejectSharedFun",
542-
("old_space", 0x05799): "AsyncFunctionAwaitResolveSharedFun",
543-
("old_space", 0x057bd): "AsyncGeneratorAwaitRejectSharedFun",
544-
("old_space", 0x057e1): "AsyncGeneratorAwaitResolveSharedFun",
545-
("old_space", 0x05805): "AsyncGeneratorYieldResolveSharedFun",
546-
("old_space", 0x05829): "AsyncGeneratorReturnResolveSharedFun",
547-
("old_space", 0x0584d): "AsyncGeneratorReturnClosedRejectSharedFun",
548-
("old_space", 0x05871): "AsyncGeneratorReturnClosedResolveSharedFun",
549-
("old_space", 0x05895): "AsyncIteratorValueUnwrapSharedFun",
550-
("old_space", 0x058b9): "PromiseAllResolveElementSharedFun",
551-
("old_space", 0x058dd): "PromiseAllSettledResolveElementSharedFun",
552-
("old_space", 0x05901): "PromiseAllSettledRejectElementSharedFun",
553-
("old_space", 0x05925): "PromiseAnyRejectElementSharedFun",
554-
("old_space", 0x05949): "PromiseCapabilityDefaultRejectSharedFun",
555-
("old_space", 0x0596d): "PromiseCapabilityDefaultResolveSharedFun",
556-
("old_space", 0x05991): "PromiseCatchFinallySharedFun",
557-
("old_space", 0x059b5): "PromiseGetCapabilitiesExecutorSharedFun",
558-
("old_space", 0x059d9): "PromiseThenFinallySharedFun",
559-
("old_space", 0x059fd): "PromiseThrowerFinallySharedFun",
560-
("old_space", 0x05a21): "PromiseValueThunkFinallySharedFun",
561-
("old_space", 0x05a45): "ProxyRevokeSharedFun",
541+
("old_space", 0x05779): "AsyncFunctionAwaitRejectSharedFun",
542+
("old_space", 0x0579d): "AsyncFunctionAwaitResolveSharedFun",
543+
("old_space", 0x057c1): "AsyncGeneratorAwaitRejectSharedFun",
544+
("old_space", 0x057e5): "AsyncGeneratorAwaitResolveSharedFun",
545+
("old_space", 0x05809): "AsyncGeneratorYieldResolveSharedFun",
546+
("old_space", 0x0582d): "AsyncGeneratorReturnResolveSharedFun",
547+
("old_space", 0x05851): "AsyncGeneratorReturnClosedRejectSharedFun",
548+
("old_space", 0x05875): "AsyncGeneratorReturnClosedResolveSharedFun",
549+
("old_space", 0x05899): "AsyncIteratorValueUnwrapSharedFun",
550+
("old_space", 0x058bd): "PromiseAllResolveElementSharedFun",
551+
("old_space", 0x058e1): "PromiseAllSettledResolveElementSharedFun",
552+
("old_space", 0x05905): "PromiseAllSettledRejectElementSharedFun",
553+
("old_space", 0x05929): "PromiseAnyRejectElementSharedFun",
554+
("old_space", 0x0594d): "PromiseCapabilityDefaultRejectSharedFun",
555+
("old_space", 0x05971): "PromiseCapabilityDefaultResolveSharedFun",
556+
("old_space", 0x05995): "PromiseCatchFinallySharedFun",
557+
("old_space", 0x059b9): "PromiseGetCapabilitiesExecutorSharedFun",
558+
("old_space", 0x059dd): "PromiseThenFinallySharedFun",
559+
("old_space", 0x05a01): "PromiseThrowerFinallySharedFun",
560+
("old_space", 0x05a25): "PromiseValueThunkFinallySharedFun",
561+
("old_space", 0x05a49): "ProxyRevokeSharedFun",
562562
}
563563

564564
# Lower 32 bits of first page addresses for various heap spaces.

0 commit comments

Comments
 (0)