Skip to content

Commit 0c771c3

Browse files
nodejs-github-bottargos
authored andcommitted
deps: patch V8 to 12.8.374.22
Refs: v8/v8@12.8.374.13...12.8.374.22 PR-URL: #54435 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
1 parent 71b36b3 commit 0c771c3

16 files changed

+71
-211
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 12
1212
#define V8_MINOR_VERSION 8
1313
#define V8_BUILD_NUMBER 374
14-
#define V8_PATCH_LEVEL 13
14+
#define V8_PATCH_LEVEL 22
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

+8-14
Original file line numberDiff line numberDiff line change
@@ -2607,8 +2607,7 @@ void ModuleScope::AllocateModuleVariables() {
26072607
}
26082608
}
26092609

2610-
// Needs to be kept in sync with ScopeInfo::UniqueIdInScript and
2611-
// SharedFunctionInfo::UniqueIdInScript.
2610+
// Needs to be kept in sync with ScopeInfo::UniqueIdInScript.
26122611
int Scope::UniqueIdInScript() const {
26132612
// Script scopes start "before" the script to avoid clashing with a scope that
26142613
// starts on character 0.
@@ -2801,25 +2800,20 @@ void DeclarationScope::AllocateScopeInfos(ParseInfo* info,
28012800
Tagged<ScopeInfo> outer = sfi->HasOuterScopeInfo()
28022801
? sfi->GetOuterScopeInfo()
28032802
: Tagged<ScopeInfo>();
2804-
// Look at all inner functions whether they have scope infos that we should
2805-
// reuse. Also look at the compiled function itself, and reuse its function
2806-
// scope info if it exists.
2807-
for (int i = info->literal()->function_literal_id();
2803+
// Look at all the existing inner functions (they are numbered id+1 until
2804+
// max_id+1) to reattach their outer scope infos to corresponding scopes.
2805+
for (int i = info->literal()->function_literal_id() + 1;
28082806
i < info->max_info_id() + 1; ++i) {
28092807
Tagged<MaybeObject> maybe_info = infos->get(i);
28102808
if (maybe_info.IsWeak()) {
28112809
Tagged<Object> info = maybe_info.GetHeapObjectAssumeWeak();
28122810
Tagged<ScopeInfo> scope_info;
28132811
if (Is<SharedFunctionInfo>(info)) {
28142812
Tagged<SharedFunctionInfo> sfi = Cast<SharedFunctionInfo>(info);
2815-
if (!sfi->scope_info()->IsEmpty() &&
2816-
sfi->scope_info()->HasContext()) {
2817-
scope_info = sfi->scope_info();
2818-
} else if (sfi->HasOuterScopeInfo()) {
2819-
scope_info = sfi->GetOuterScopeInfo();
2820-
} else {
2821-
continue;
2822-
}
2813+
// Reuse outer scope infos. Don't look at sfi->scope_info() because
2814+
// that might be empty if the sfi isn't compiled yet.
2815+
if (!sfi->HasOuterScopeInfo()) continue;
2816+
scope_info = sfi->GetOuterScopeInfo();
28232817
} else {
28242818
scope_info = Cast<ScopeInfo>(info);
28252819
}

deps/v8/src/codegen/compiler.cc

+16-134
Original file line numberDiff line numberDiff line change
@@ -2022,39 +2022,18 @@ class ConstantPoolPointerForwarder {
20222022
}
20232023

20242024
void RecordScopeInfos(Tagged<MaybeObject> maybe_old_info) {
2025-
RecordScopeInfos(maybe_old_info.GetHeapObjectAssumeWeak());
2026-
}
2027-
2028-
// Record all scope infos relevant for a shared function info or scope info
2029-
// (recorded for eval).
2030-
void RecordScopeInfos(Tagged<HeapObject> info) {
20312025
Tagged<ScopeInfo> scope_info;
2026+
Tagged<HeapObject> info = maybe_old_info.GetHeapObjectAssumeWeak();
20322027
if (Is<SharedFunctionInfo>(info)) {
20332028
Tagged<SharedFunctionInfo> old_sfi = Cast<SharedFunctionInfo>(info);
2034-
// Also record context-having own scope infos for SFIs.
2035-
if (!old_sfi->scope_info()->IsEmpty() &&
2036-
old_sfi->scope_info()->HasContext()) {
2037-
scope_info = old_sfi->scope_info();
2038-
} else if (old_sfi->HasOuterScopeInfo()) {
2039-
scope_info = old_sfi->GetOuterScopeInfo();
2040-
} else {
2041-
return;
2042-
}
2029+
if (!old_sfi->HasOuterScopeInfo()) return;
2030+
scope_info = old_sfi->GetOuterScopeInfo();
20432031
} else {
20442032
scope_info = Cast<ScopeInfo>(info);
20452033
}
2046-
20472034
while (true) {
2048-
auto it = scope_infos_to_update_.find(scope_info->UniqueIdInScript());
2049-
if (it != scope_infos_to_update_.end()) {
2050-
// Once we find an already recorded scope info, it need to match the one
2051-
// on the chain.
2052-
if (V8_UNLIKELY(*it->second != scope_info)) {
2053-
info->Print();
2054-
(*it->second)->Print();
2055-
scope_info->Print();
2056-
UNREACHABLE();
2057-
}
2035+
if (scope_infos_to_update_.find(scope_info->UniqueIdInScript()) !=
2036+
scope_infos_to_update_.end()) {
20582037
return;
20592038
}
20602039
scope_infos_to_update_[scope_info->UniqueIdInScript()] =
@@ -2083,51 +2062,17 @@ class ConstantPoolPointerForwarder {
20832062
!scope_infos_to_update_.empty();
20842063
}
20852064

2086-
// Find an own scope info for the sfi based on the UniqueIdInScript that the
2087-
// own scope info would have. This works even if the SFI doesn't yet have a
2088-
// scope info attached by computing UniqueIdInScript from the SFI position.
2089-
//
2090-
// This should only directly be used for SFIs that already existed on the
2091-
// script. Their outer scope info will already be correct.
2092-
bool InstallOwnScopeInfo(Tagged<SharedFunctionInfo> sfi) {
2093-
auto it = scope_infos_to_update_.find(sfi->UniqueIdInScript());
2094-
if (it == scope_infos_to_update_.end()) return false;
2095-
sfi->SetScopeInfo(*it->second);
2096-
return true;
2097-
}
2098-
2099-
// Either replace the own scope info of the sfi, or the first outer scope info
2100-
// that was recorded.
2101-
//
2102-
// This has to be used for all newly created SFIs since their outer scope info
2103-
// also may need to be reattached.
2104-
void UpdateScopeInfo(Tagged<SharedFunctionInfo> sfi) {
2105-
// This should not be called on already existing SFIs. Their scope infos are
2106-
// already correct.
2107-
DCHECK_NE(MakeWeak(sfi),
2108-
old_script_->infos()->get(sfi->function_literal_id()));
2109-
if (InstallOwnScopeInfo(sfi)) return;
2065+
void UpdateOuterScopeInfo(Tagged<SharedFunctionInfo> sfi) {
21102066
if (!sfi->HasOuterScopeInfo()) return;
2111-
2112-
Tagged<ScopeInfo> parent =
2113-
sfi->scope_info()->IsEmpty() ? Tagged<ScopeInfo>() : sfi->scope_info();
21142067
Tagged<ScopeInfo> outer_info = sfi->GetOuterScopeInfo();
2115-
21162068
auto it = scope_infos_to_update_.find(outer_info->UniqueIdInScript());
2117-
while (it == scope_infos_to_update_.end()) {
2118-
if (!outer_info->HasOuterScopeInfo()) return;
2119-
parent = outer_info;
2120-
outer_info = outer_info->OuterScopeInfo();
2121-
it = scope_infos_to_update_.find(outer_info->UniqueIdInScript());
2122-
}
2069+
if (it == scope_infos_to_update_.end()) return;
21232070
if (outer_info == *it->second) return;
2124-
21252071
VerifyScopeInfo(outer_info, *it->second);
2126-
2127-
if (parent.is_null()) {
2128-
sfi->set_raw_outer_scope_info_or_feedback_metadata(*it->second);
2072+
if (sfi->is_compiled()) {
2073+
sfi->scope_info()->set_outer_scope_info(*it->second);
21292074
} else {
2130-
parent->set_outer_scope_info(*it->second);
2075+
sfi->set_raw_outer_scope_info_or_feedback_metadata(*it->second);
21312076
}
21322077
}
21332078

@@ -2309,16 +2254,6 @@ void BackgroundMergeTask::BeginMergeInBackground(
23092254
new_compiled_data_for_cached_sfis_.push_back(
23102255
{local_heap->NewPersistentHandle(old_sfi),
23112256
local_heap->NewPersistentHandle(new_sfi)});
2312-
// Pick up existing scope infos from the old sfi. The new sfi will be
2313-
// copied over the old sfi later. This will ensure that we'll keep
2314-
// using the old sfis. This will also allow us check later whether new
2315-
// scope infos have appeared that need to be reused.
2316-
if (!old_sfi->scope_info()->IsEmpty()) {
2317-
new_sfi->SetScopeInfo(old_sfi->scope_info());
2318-
} else if (old_sfi->HasOuterScopeInfo()) {
2319-
new_sfi->scope_info()->set_outer_scope_info(
2320-
old_sfi->GetOuterScopeInfo());
2321-
}
23222257
forwarder.AddBytecodeArray(new_sfi->GetBytecodeArray(isolate));
23232258
}
23242259
} else {
@@ -2343,23 +2278,13 @@ void BackgroundMergeTask::BeginMergeInBackground(
23432278

23442279
if (forwarder.HasAnythingToForward()) {
23452280
for (DirectHandle<SharedFunctionInfo> new_sfi : used_new_sfis_) {
2346-
forwarder.UpdateScopeInfo(*new_sfi);
2347-
}
2348-
for (const auto& new_compiled_data : new_compiled_data_for_cached_sfis_) {
2349-
// It's possible that new_compiled_data.cached_sfi had
2350-
// scope_info()->IsEmpty() while an inner function has scope info if the
2351-
// cached_sfi was recreated when an outer function was recompiled. If so,
2352-
// new_compiled_data.new_sfi does not have a reused scope info yet, and
2353-
// we'll have found it when we visited the inner function. Try to pick it
2354-
// up here.
2355-
forwarder.InstallOwnScopeInfo(*new_compiled_data.new_sfi);
2281+
forwarder.UpdateOuterScopeInfo(*new_sfi);
23562282
}
23572283
forwarder.IterateAndForwardPointers();
23582284
}
23592285
persistent_handles_ = local_heap->DetachPersistentHandles();
23602286
state_ = kPendingForegroundWork;
23612287
}
2362-
23632288
Handle<SharedFunctionInfo> BackgroundMergeTask::CompleteMergeInForeground(
23642289
Isolate* isolate, DirectHandle<Script> new_script) {
23652290
DCHECK_EQ(state_, kPendingForegroundWork);
@@ -2370,8 +2295,8 @@ Handle<SharedFunctionInfo> BackgroundMergeTask::CompleteMergeInForeground(
23702295
isolate, isolate->main_thread_local_heap(), old_script);
23712296

23722297
for (const auto& new_compiled_data : new_compiled_data_for_cached_sfis_) {
2373-
Tagged<SharedFunctionInfo> sfi = *new_compiled_data.cached_sfi;
2374-
if (!sfi->is_compiled() && new_compiled_data.new_sfi->is_compiled()) {
2298+
if (!new_compiled_data.cached_sfi->is_compiled() &&
2299+
new_compiled_data.new_sfi->is_compiled()) {
23752300
// Updating existing DebugInfos is not supported, but we don't expect
23762301
// uncompiled SharedFunctionInfos to contain DebugInfos.
23772302
DCHECK(!new_compiled_data.cached_sfi->HasDebugInfo(isolate));
@@ -2381,7 +2306,8 @@ Handle<SharedFunctionInfo> BackgroundMergeTask::CompleteMergeInForeground(
23812306
// cached_sfi to new_sfi, and then copy every field using CopyFrom.
23822307
new_compiled_data.new_sfi->set_script(
23832308
new_compiled_data.cached_sfi->script(kAcquireLoad), kReleaseStore);
2384-
sfi->CopyFrom(*new_compiled_data.new_sfi, isolate);
2309+
new_compiled_data.cached_sfi->CopyFrom(*new_compiled_data.new_sfi,
2310+
isolate);
23852311
}
23862312
}
23872313

@@ -2410,17 +2336,12 @@ Handle<SharedFunctionInfo> BackgroundMergeTask::CompleteMergeInForeground(
24102336
// pools is required.
24112337
if (forwarder.HasAnythingToForward()) {
24122338
for (DirectHandle<SharedFunctionInfo> new_sfi : used_new_sfis_) {
2413-
forwarder.UpdateScopeInfo(*new_sfi);
2339+
forwarder.UpdateOuterScopeInfo(*new_sfi);
24142340
if (new_sfi->HasBytecodeArray(isolate)) {
24152341
forwarder.AddBytecodeArray(new_sfi->GetBytecodeArray(isolate));
24162342
}
24172343
}
24182344
for (const auto& new_compiled_data : new_compiled_data_for_cached_sfis_) {
2419-
// It's possible that cached_sfi wasn't compiled, but an inner function
2420-
// existed that didn't exist when be background merged. In that case, pick
2421-
// up the relevant scope infos.
2422-
Tagged<SharedFunctionInfo> sfi = *new_compiled_data.cached_sfi;
2423-
forwarder.InstallOwnScopeInfo(sfi);
24242345
if (new_compiled_data.cached_sfi->HasBytecodeArray(isolate)) {
24252346
forwarder.AddBytecodeArray(
24262347
new_compiled_data.cached_sfi->GetBytecodeArray(isolate));
@@ -2443,45 +2364,6 @@ Handle<SharedFunctionInfo> BackgroundMergeTask::CompleteMergeInForeground(
24432364
SharedFunctionInfo::EnsureSourcePositionsAvailable(isolate, result);
24442365
}
24452366

2446-
if (v8_flags.verify_code_merge) {
2447-
// Check that there aren't any duplicate scope infos. Every scope/context
2448-
// should correspond to at most one scope info.
2449-
std::unordered_map<int, Tagged<ScopeInfo>> scope_infos;
2450-
for (int i = 0; i < old_script->infos()->length(); i++) {
2451-
Tagged<ScopeInfo> scope_info;
2452-
if (!old_script->infos()->get(i).IsWeak()) continue;
2453-
Tagged<HeapObject> info =
2454-
old_script->infos()->get(i).GetHeapObjectAssumeWeak();
2455-
if (Is<SharedFunctionInfo>(info)) {
2456-
Tagged<SharedFunctionInfo> old_sfi = Cast<SharedFunctionInfo>(info);
2457-
if (!old_sfi->scope_info()->IsEmpty()) {
2458-
scope_info = old_sfi->scope_info();
2459-
} else if (old_sfi->HasOuterScopeInfo()) {
2460-
scope_info = old_sfi->GetOuterScopeInfo();
2461-
} else {
2462-
continue;
2463-
}
2464-
} else {
2465-
scope_info = Cast<ScopeInfo>(info);
2466-
}
2467-
while (true) {
2468-
auto it = scope_infos.find(scope_info->UniqueIdInScript());
2469-
if (it != scope_infos.end()) {
2470-
if (*it->second != scope_info) {
2471-
old_script->infos()->get(i).GetHeapObjectAssumeWeak()->Print();
2472-
(*it->second)->Print();
2473-
scope_info->Print();
2474-
UNREACHABLE();
2475-
}
2476-
break;
2477-
}
2478-
scope_infos[scope_info->UniqueIdInScript()] = scope_info;
2479-
if (!scope_info->HasOuterScopeInfo()) break;
2480-
scope_info = scope_info->OuterScopeInfo();
2481-
}
2482-
}
2483-
}
2484-
24852367
return handle_scope.CloseAndEscape(result);
24862368
}
24872369

deps/v8/src/compiler/operation-typer.cc

+1
Original file line numberDiff line numberDiff line change
@@ -1259,6 +1259,7 @@ Type JSType(Type type) {
12591259
} // namespace
12601260

12611261
Type OperationTyper::SameValue(Type lhs, Type rhs) {
1262+
if (lhs.IsNone() || rhs.IsNone()) return Type::None();
12621263
if (!JSType(lhs).Maybe(JSType(rhs))) return singleton_false();
12631264
if (lhs.Is(Type::NaN())) {
12641265
if (rhs.Is(Type::NaN())) return singleton_true();

deps/v8/src/flags/flag-definitions.h

-1
Original file line numberDiff line numberDiff line change
@@ -2217,7 +2217,6 @@ DEFINE_BOOL(
22172217
merge_background_deserialized_script_with_compilation_cache, true,
22182218
"After deserializing code cache data on a background thread, merge it into "
22192219
"an existing Script if one is found in the Isolate compilation cache")
2220-
DEFINE_BOOL(verify_code_merge, false, "Verify scope infos after merge")
22212220
DEFINE_BOOL(
22222221
embedder_instance_types, false,
22232222
"enable type checks based on instance types provided by the embedder")

deps/v8/src/objects/js-date-time-format.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1845,7 +1845,7 @@ std::unique_ptr<icu::SimpleDateFormat> CreateICUDateFormat(
18451845
// has to be discussed. Revisit once the spec is clarified/revised.
18461846
icu::UnicodeString pattern;
18471847
UErrorCode status = U_ZERO_ERROR;
1848-
pattern = generator->getBestPattern(skeleton, UDATPG_MATCH_ALL_FIELDS_LENGTH,
1848+
pattern = generator->getBestPattern(skeleton, UDATPG_MATCH_HOUR_FIELD_LENGTH,
18491849
status);
18501850
pattern = ReplaceHourCycleInPattern(pattern, hc);
18511851
DCHECK(U_SUCCESS(status));

deps/v8/src/objects/scope-info.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -726,8 +726,7 @@ int ScopeInfo::ContextLength() const {
726726
(function_name_context_slot ? 1 : 0);
727727
}
728728

729-
// Needs to be kept in sync with Scope::UniqueIdInScript and
730-
// SharedFunctionInfo::UniqueIdInScript.
729+
// Needs to be kept in sync with Scope::UniqueIdInScript.
731730
int ScopeInfo::UniqueIdInScript() const {
732731
// Script scopes start "before" the script to avoid clashing with a scope that
733732
// starts on character 0.

deps/v8/src/objects/shared-function-info-inl.h

+4-6
Original file line numberDiff line numberDiff line change
@@ -613,11 +613,11 @@ DEF_GETTER(SharedFunctionInfo, outer_scope_info, Tagged<HeapObject>) {
613613

614614
bool SharedFunctionInfo::HasOuterScopeInfo() const {
615615
Tagged<ScopeInfo> outer_info;
616-
Tagged<ScopeInfo> info = scope_info(kAcquireLoad);
617-
if (info->IsEmpty()) {
616+
if (!is_compiled()) {
618617
if (!IsScopeInfo(outer_scope_info())) return false;
619618
outer_info = Cast<ScopeInfo>(outer_scope_info());
620619
} else {
620+
Tagged<ScopeInfo> info = scope_info(kAcquireLoad);
621621
if (!info->HasOuterScopeInfo()) return false;
622622
outer_info = info->OuterScopeInfo();
623623
}
@@ -626,17 +626,15 @@ bool SharedFunctionInfo::HasOuterScopeInfo() const {
626626

627627
Tagged<ScopeInfo> SharedFunctionInfo::GetOuterScopeInfo() const {
628628
DCHECK(HasOuterScopeInfo());
629-
Tagged<ScopeInfo> info = scope_info(kAcquireLoad);
630-
if (info->IsEmpty()) return Cast<ScopeInfo>(outer_scope_info());
631-
return info->OuterScopeInfo();
629+
if (!is_compiled()) return Cast<ScopeInfo>(outer_scope_info());
630+
return scope_info(kAcquireLoad)->OuterScopeInfo();
632631
}
633632

634633
void SharedFunctionInfo::set_outer_scope_info(Tagged<HeapObject> value,
635634
WriteBarrierMode mode) {
636635
DCHECK(!is_compiled());
637636
DCHECK(IsTheHole(raw_outer_scope_info_or_feedback_metadata()));
638637
DCHECK(IsScopeInfo(value) || IsTheHole(value));
639-
DCHECK(scope_info()->IsEmpty());
640638
set_raw_outer_scope_info_or_feedback_metadata(value, mode);
641639
}
642640

deps/v8/src/objects/shared-function-info.cc

-11
Original file line numberDiff line numberDiff line change
@@ -265,17 +265,6 @@ bool SharedFunctionInfo::HasDebugInfo(Isolate* isolate) const {
265265
return isolate->debug()->HasDebugInfo(*this);
266266
}
267267

268-
// Needs to be kept in sync with Scope::UniqueIdInScript and
269-
// ScopeInfo::UniqueIdInScript.
270-
int SharedFunctionInfo::UniqueIdInScript() const {
271-
// Script scopes start "before" the script to avoid clashing with a scope that
272-
// starts on character 0.
273-
if (function_literal_id() == kFunctionLiteralIdTopLevel) return -1;
274-
// Default constructors have the same start position as their parent class
275-
// scope. Use the next char position to distinguish this scope.
276-
return StartPosition() + IsDefaultConstructor(kind());
277-
}
278-
279268
Tagged<DebugInfo> SharedFunctionInfo::GetDebugInfo(Isolate* isolate) const {
280269
return isolate->debug()->TryGetDebugInfo(*this).value();
281270
}

deps/v8/src/objects/shared-function-info.h

-2
Original file line numberDiff line numberDiff line change
@@ -597,8 +597,6 @@ class SharedFunctionInfo
597597

598598
inline FunctionKind kind() const;
599599

600-
int UniqueIdInScript() const;
601-
602600
// Defines the index in a native context of closure's map instantiated using
603601
// this shared function info.
604602
DECL_INT_ACCESSORS(function_map_index)

0 commit comments

Comments
 (0)