Skip to content

deps: patch V8 to 13.7.152.19 #58713

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deps/v8/include/v8-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 13
#define V8_MINOR_VERSION 7
#define V8_BUILD_NUMBER 152
#define V8_PATCH_LEVEL 14
#define V8_PATCH_LEVEL 19

// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/execution/isolate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3875,7 +3875,7 @@ void Isolate::SwitchStacks(wasm::StackMemory* from, wasm::StackMemory* to) {
// TODO(388533754): This check won't hold anymore with core stack-switching.
// Instead, we will need to validate all the intermediate stacks and also
// check that they don't hold central stack frames.
DCHECK_EQ(from->jmpbuf()->parent, to);
SBXCHECK_EQ(from->jmpbuf()->parent, to);
}
uintptr_t limit = reinterpret_cast<uintptr_t>(to->jmpbuf()->stack_limit);
stack_guard()->SetStackLimitForStackSwitching(limit);
Expand Down
9 changes: 5 additions & 4 deletions deps/v8/src/interpreter/bytecode-generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,8 @@ class V8_NODISCARD BytecodeGenerator::OptionalChainNullLabelScope final {
public:
explicit OptionalChainNullLabelScope(BytecodeGenerator* bytecode_generator)
: bytecode_generator_(bytecode_generator),
labels_(bytecode_generator->zone()) {
labels_(bytecode_generator->zone()),
hole_check_scope_(bytecode_generator) {
prev_ = bytecode_generator_->optional_chaining_null_labels_;
bytecode_generator_->optional_chaining_null_labels_ = &labels_;
}
Expand All @@ -1236,6 +1237,9 @@ class V8_NODISCARD BytecodeGenerator::OptionalChainNullLabelScope final {
BytecodeGenerator* bytecode_generator_;
BytecodeLabels labels_;
BytecodeLabels* prev_;
// Use the same scope for the entire optional chain, as links earlier in the
// chain dominate later links, linearly.
HoleCheckElisionScope hole_check_scope_;
};

// LoopScope delimits the scope of {loop}, from its header to its final jump.
Expand Down Expand Up @@ -6461,9 +6465,6 @@ template <typename ExpressionFunc>
void BytecodeGenerator::BuildOptionalChain(ExpressionFunc expression_func) {
BytecodeLabel done;
OptionalChainNullLabelScope label_scope(this);
// Use the same scope for the entire optional chain, as links earlier in the
// chain dominate later links, linearly.
HoleCheckElisionScope elider(this);
expression_func();
builder()->Jump(&done);
label_scope.labels()->Bind(builder());
Expand Down
9 changes: 4 additions & 5 deletions deps/v8/src/objects/js-break-iterator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,12 @@ MaybeDirectHandle<JSV8BreakIterator> JSV8BreakIterator::New(
MAYBE_RETURN(maybe_locale_matcher, MaybeDirectHandle<JSV8BreakIterator>());
Intl::MatcherOption matcher = maybe_locale_matcher.FromJust();

Maybe<Intl::ResolvedLocale> maybe_resolve_locale =
Intl::ResolveLocale(isolate, JSV8BreakIterator::GetAvailableLocales(),
requested_locales, matcher, {});
if (maybe_resolve_locale.IsNothing()) {
Intl::ResolvedLocale r;
if (!Intl::ResolveLocale(isolate, JSV8BreakIterator::GetAvailableLocales(),
requested_locales, matcher, {})
.To(&r)) {
THROW_NEW_ERROR(isolate, NewRangeError(MessageTemplate::kIcuError));
}
Intl::ResolvedLocale r = maybe_resolve_locale.FromJust();

// Extract type from options
enum class Type { CHARACTER, WORD, SENTENCE, LINE };
Expand Down
10 changes: 4 additions & 6 deletions deps/v8/src/objects/js-collator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -357,18 +357,16 @@ MaybeHandle<JSCollator> JSCollator::New(Isolate* isolate, DirectHandle<Map> map,
// https://tc39.github.io/ecma402/#sec-intl-collator-internal-slots
//
// 16. Let relevantExtensionKeys be %Collator%.[[RelevantExtensionKeys]].
std::set<std::string> relevant_extension_keys{"co", "kn", "kf"};

// 17. Let r be ResolveLocale(%Collator%.[[AvailableLocales]],
// requestedLocales, opt, %Collator%.[[RelevantExtensionKeys]],
// localeData).
Maybe<Intl::ResolvedLocale> maybe_resolve_locale =
Intl::ResolveLocale(isolate, JSCollator::GetAvailableLocales(),
requested_locales, matcher, relevant_extension_keys);
if (maybe_resolve_locale.IsNothing()) {
Intl::ResolvedLocale r;
if (!Intl::ResolveLocale(isolate, JSCollator::GetAvailableLocales(),
requested_locales, matcher, {"co", "kn", "kf"})
.To(&r)) {
THROW_NEW_ERROR(isolate, NewRangeError(MessageTemplate::kIcuError));
}
Intl::ResolvedLocale r = maybe_resolve_locale.FromJust();

// 18. Set collator.[[Locale]] to r.[[locale]].
icu::Locale icu_locale = r.icu_locale;
Expand Down
11 changes: 5 additions & 6 deletions deps/v8/src/objects/js-date-time-format.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2249,20 +2249,19 @@ MaybeDirectHandle<JSDateTimeFormat> JSDateTimeFormat::CreateDateTimeFormat(
// ecma402/#sec-intl.datetimeformat-internal-slots
// The value of the [[RelevantExtensionKeys]] internal slot is
// « "ca", "nu", "hc" ».
std::set<std::string> relevant_extension_keys = {"nu", "ca", "hc"};

// 10. Let localeData be %DateTimeFormat%.[[LocaleData]].
// 11. Let r be ResolveLocale( %DateTimeFormat%.[[AvailableLocales]],
// requestedLocales, opt, %DateTimeFormat%.[[RelevantExtensionKeys]],
// localeData).
//
Maybe<Intl::ResolvedLocale> maybe_resolve_locale = Intl::ResolveLocale(
isolate, JSDateTimeFormat::GetAvailableLocales(), requested_locales,
locale_matcher, relevant_extension_keys);
if (maybe_resolve_locale.IsNothing()) {
Intl::ResolvedLocale r;
if (!Intl::ResolveLocale(isolate, JSDateTimeFormat::GetAvailableLocales(),
requested_locales, locale_matcher,
{"nu", "ca", "hc"})
.To(&r)) {
THROW_NEW_ERROR(isolate, NewRangeError(MessageTemplate::kIcuError));
}
Intl::ResolvedLocale r = maybe_resolve_locale.FromJust();

icu::Locale icu_locale = r.icu_locale;
DCHECK(!icu_locale.isBogus());
Expand Down
10 changes: 4 additions & 6 deletions deps/v8/src/objects/js-display-names.cc
Original file line number Diff line number Diff line change
Expand Up @@ -436,16 +436,14 @@ MaybeDirectHandle<JSDisplayNames> JSDisplayNames::New(
// ecma402/#sec-Intl.DisplayNames-internal-slots
// The value of the [[RelevantExtensionKeys]] internal slot is
// « ».
std::set<std::string> relevant_extension_keys = {};
// 9. Let r be ResolveLocale(%DisplayNames%.[[AvailableLocales]],
// requestedLocales, opt, %DisplayNames%.[[RelevantExtensionKeys]]).
Maybe<Intl::ResolvedLocale> maybe_resolve_locale =
Intl::ResolveLocale(isolate, JSDisplayNames::GetAvailableLocales(),
requested_locales, matcher, relevant_extension_keys);
if (maybe_resolve_locale.IsNothing()) {
Intl::ResolvedLocale r;
if (!Intl::ResolveLocale(isolate, JSDisplayNames::GetAvailableLocales(),
requested_locales, matcher, {})
.To(&r)) {
THROW_NEW_ERROR(isolate, NewRangeError(MessageTemplate::kIcuError));
}
Intl::ResolvedLocale r = maybe_resolve_locale.FromJust();

icu::Locale icu_locale = r.icu_locale;

Expand Down
11 changes: 5 additions & 6 deletions deps/v8/src/objects/js-duration-format.cc
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,12 @@ MaybeDirectHandle<JSDurationFormat> JSDurationFormat::New(
// 9. Let r be ResolveLocale(%DurationFormat%.[[AvailableLocales]],
// requestedLocales, opt, %DurationFormat%.[[RelevantExtensionKeys]],
// %DurationFormat%.[[LocaleData]]).
std::set<std::string> relevant_extension_keys{"nu"};
Intl::ResolvedLocale r;
MAYBE_ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate, r,
Intl::ResolveLocale(isolate, JSDurationFormat::GetAvailableLocales(),
requested_locales, matcher, relevant_extension_keys),
DirectHandle<JSDurationFormat>());
if (!Intl::ResolveLocale(isolate, JSDurationFormat::GetAvailableLocales(),
requested_locales, matcher, {"nu"})
.To(&r)) {
THROW_NEW_ERROR(isolate, NewRangeError(MessageTemplate::kIcuError));
}

// 10. Let locale be r.[[locale]].
icu::Locale r_locale = r.icu_locale;
Expand Down
10 changes: 5 additions & 5 deletions deps/v8/src/objects/js-list-format.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ MaybeDirectHandle<JSListFormat> JSListFormat::New(

// 10. Let r be ResolveLocale(%ListFormat%.[[AvailableLocales]],
// requestedLocales, opt, undefined, localeData).
Maybe<Intl::ResolvedLocale> maybe_resolve_locale =
Intl::ResolveLocale(isolate, JSListFormat::GetAvailableLocales(),
requested_locales, matcher, {});
if (maybe_resolve_locale.IsNothing()) {
Intl::ResolvedLocale r;
if (!Intl::ResolveLocale(isolate, JSListFormat::GetAvailableLocales(),
requested_locales, matcher, {})
.To(&r)) {
THROW_NEW_ERROR(isolate, NewRangeError(MessageTemplate::kIcuError));
}
Intl::ResolvedLocale r = maybe_resolve_locale.FromJust();

DirectHandle<String> locale_str =
isolate->factory()->NewStringFromAsciiChecked(r.locale.c_str());

Expand Down
10 changes: 4 additions & 6 deletions deps/v8/src/objects/js-number-format.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1108,14 +1108,12 @@ MaybeDirectHandle<JSNumberFormat> JSNumberFormat::New(
// 10. Let r be ResolveLocale(%NumberFormat%.[[AvailableLocales]],
// requestedLocales, opt, %NumberFormat%.[[RelevantExtensionKeys]],
// localeData).
std::set<std::string> relevant_extension_keys{"nu"};
Maybe<Intl::ResolvedLocale> maybe_resolve_locale =
Intl::ResolveLocale(isolate, JSNumberFormat::GetAvailableLocales(),
requested_locales, matcher, relevant_extension_keys);
if (maybe_resolve_locale.IsNothing()) {
Intl::ResolvedLocale r;
if (!Intl::ResolveLocale(isolate, JSNumberFormat::GetAvailableLocales(),
requested_locales, matcher, {"nu"})
.To(&r)) {
THROW_NEW_ERROR(isolate, NewRangeError(MessageTemplate::kIcuError));
}
Intl::ResolvedLocale r = maybe_resolve_locale.FromJust();

icu::Locale icu_locale = r.icu_locale;
UErrorCode status = U_ZERO_ERROR;
Expand Down
9 changes: 4 additions & 5 deletions deps/v8/src/objects/js-plural-rules.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,12 @@ MaybeDirectHandle<JSPluralRules> JSPluralRules::New(
// 11. Let r be ResolveLocale(%PluralRules%.[[AvailableLocales]],
// requestedLocales, opt, %PluralRules%.[[RelevantExtensionKeys]],
// localeData).
Maybe<Intl::ResolvedLocale> maybe_resolve_locale =
Intl::ResolveLocale(isolate, JSPluralRules::GetAvailableLocales(),
requested_locales, matcher, {});
if (maybe_resolve_locale.IsNothing()) {
Intl::ResolvedLocale r;
if (!Intl::ResolveLocale(isolate, JSPluralRules::GetAvailableLocales(),
requested_locales, matcher, {})
.To(&r)) {
THROW_NEW_ERROR(isolate, NewRangeError(MessageTemplate::kIcuError));
}
Intl::ResolvedLocale r = maybe_resolve_locale.FromJust();
DirectHandle<String> locale_str =
isolate->factory()->NewStringFromAsciiChecked(r.locale.c_str());

Expand Down
30 changes: 18 additions & 12 deletions deps/v8/src/objects/js-regexp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,14 @@ bool IsLineTerminator(int c) {
// WriteEscapedRegExpSource into a single function to deduplicate dispatch logic
// and move related code closer to each other.
template <typename Char>
int CountAdditionalEscapeChars(DirectHandle<String> source,
bool* needs_escapes_out) {
uint32_t CountAdditionalEscapeChars(DirectHandle<String> source,
bool* needs_escapes_out) {
DisallowGarbageCollection no_gc;
int escapes = 0;
uint32_t escapes = 0;
// The maximum growth-factor is 5 (for \u2028 and \u2029). Make sure that we
// won't overflow |escapes| given the current constraints on string length.
static_assert(uint64_t{String::kMaxLength} * 5 <
std::numeric_limits<decltype(escapes)>::max());
bool needs_escapes = false;
bool in_character_class = false;
base::Vector<const Char> src = source->GetCharVector<Char>(no_gc);
Expand Down Expand Up @@ -232,14 +236,14 @@ int CountAdditionalEscapeChars(DirectHandle<String> source,
}
}
DCHECK(!in_character_class);
DCHECK_GE(escapes, 0);
DCHECK_IMPLIES(escapes != 0, needs_escapes);
*needs_escapes_out = needs_escapes;
return escapes;
}

template <typename Char>
void WriteStringToCharVector(base::Vector<Char> v, int* d, const char* string) {
void WriteStringToCharVector(base::Vector<Char> v, uint32_t* d,
const char* string) {
int s = 0;
while (string[s] != '\0') v[(*d)++] = string[s++];
}
Expand All @@ -250,21 +254,21 @@ DirectHandle<StringType> WriteEscapedRegExpSource(
DisallowGarbageCollection no_gc;
base::Vector<const Char> src = source->GetCharVector<Char>(no_gc);
base::Vector<Char> dst(result->GetChars(no_gc), result->length());
int s = 0;
int d = 0;
uint32_t s = 0;
uint32_t d = 0;
bool in_character_class = false;
while (s < src.length()) {
while (s < src.size()) {
const Char c = src[s];
if (c == '\\') {
if (s + 1 < src.length() && IsLineTerminator(src[s + 1])) {
if (s + 1 < src.size() && IsLineTerminator(src[s + 1])) {
// This '\' is ignored since the next character itself will be escaped.
s++;
continue;
} else {
// Escape. Copy this and next character.
dst[d++] = src[s++];
}
if (s == src.length()) break;
if (s == src.size()) break;
} else if (c == '/' && !in_character_class) {
// Not escaped forward-slash needs escape.
dst[d++] = '\\';
Expand Down Expand Up @@ -304,11 +308,13 @@ MaybeDirectHandle<String> EscapeRegExpSource(Isolate* isolate,
if (source->length() == 0) return isolate->factory()->query_colon_string();
bool one_byte = String::IsOneByteRepresentationUnderneath(*source);
bool needs_escapes = false;
int additional_escape_chars =
uint32_t additional_escape_chars =
one_byte ? CountAdditionalEscapeChars<uint8_t>(source, &needs_escapes)
: CountAdditionalEscapeChars<base::uc16>(source, &needs_escapes);
if (!needs_escapes) return source;
int length = source->length() + additional_escape_chars;
DCHECK_LE(static_cast<uint64_t>(source->length()) + additional_escape_chars,
std::numeric_limits<uint32_t>::max());
uint32_t length = source->length() + additional_escape_chars;
if (one_byte) {
DirectHandle<SeqOneByteString> result;
ASSIGN_RETURN_ON_EXCEPTION(isolate, result,
Expand Down
9 changes: 4 additions & 5 deletions deps/v8/src/objects/js-relative-time-format.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,12 @@ MaybeDirectHandle<JSRelativeTimeFormat> JSRelativeTimeFormat::New(
// ResolveLocale(%RelativeTimeFormat%.[[AvailableLocales]],
// requestedLocales, opt,
// %RelativeTimeFormat%.[[RelevantExtensionKeys]], localeData).
Maybe<Intl::ResolvedLocale> maybe_resolve_locale =
Intl::ResolveLocale(isolate, JSRelativeTimeFormat::GetAvailableLocales(),
requested_locales, matcher, {"nu"});
if (maybe_resolve_locale.IsNothing()) {
Intl::ResolvedLocale r;
if (!Intl::ResolveLocale(isolate, JSRelativeTimeFormat::GetAvailableLocales(),
requested_locales, matcher, {"nu"})
.To(&r)) {
THROW_NEW_ERROR(isolate, NewRangeError(MessageTemplate::kIcuError));
}
Intl::ResolvedLocale r = maybe_resolve_locale.FromJust();

UErrorCode status = U_ZERO_ERROR;

Expand Down
9 changes: 4 additions & 5 deletions deps/v8/src/objects/js-segmenter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,12 @@ MaybeDirectHandle<JSSegmenter> JSSegmenter::New(

// 11. Let r be ResolveLocale(%Segmenter%.[[AvailableLocales]],
// requestedLocales, opt, %Segmenter%.[[RelevantExtensionKeys]]).
Maybe<Intl::ResolvedLocale> maybe_resolve_locale =
Intl::ResolveLocale(isolate, JSSegmenter::GetAvailableLocales(),
requested_locales, matcher, {});
if (maybe_resolve_locale.IsNothing()) {
Intl::ResolvedLocale r;
if (!Intl::ResolveLocale(isolate, JSSegmenter::GetAvailableLocales(),
requested_locales, matcher, {})
.To(&r)) {
THROW_NEW_ERROR(isolate, NewRangeError(MessageTemplate::kIcuError));
}
Intl::ResolvedLocale r = maybe_resolve_locale.FromJust();

// 12. Set segmenter.[[Locale]] to the value of r.[[locale]].
DirectHandle<String> locale_str =
Expand Down
7 changes: 7 additions & 0 deletions deps/v8/src/wasm/baseline/liftoff-assembler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,13 @@ void LiftoffAssembler::FinishCall(const ValueKindSig* sig,
DCHECK(!loc.IsAnyRegister());
reg_pair[pair_idx] = LiftoffRegister::from_external_code(
rc, lowered_kind, loc.AsRegister());
#if V8_TARGET_ARCH_64_BIT
// See explanation in `LiftoffCompiler::ParameterProcessor`.
if (return_kind == kI32) {
DCHECK(!needs_gp_pair);
clear_i32_upper_half(reg_pair[0].gp());
}
#endif
} else {
DCHECK(loc.IsCallerFrameSlot());
reg_pair[pair_idx] = GetUnusedRegister(rc, pinned);
Expand Down
2 changes: 2 additions & 0 deletions deps/v8/src/wasm/baseline/liftoff-compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9218,6 +9218,7 @@ class LiftoffCompiler {
if (v8_flags.experimental_wasm_skip_null_checks || !type.is_nullable()) {
return;
}
SCOPED_CODE_COMMENT("null check");
LiftoffRegister null = __ GetUnusedRegister(kGpReg, pinned);
LoadNullValueForCompare(null.gp(), pinned, type);
OolTrapLabel trap =
Expand All @@ -9230,6 +9231,7 @@ class LiftoffCompiler {
LiftoffRegister array, LiftoffRegister index,
LiftoffRegList pinned) {
if (V8_UNLIKELY(v8_flags.experimental_wasm_skip_bounds_checks)) return;
SCOPED_CODE_COMMENT("array bounds check");
LiftoffRegister length = __ GetUnusedRegister(kGpReg, pinned);
constexpr int kLengthOffset =
wasm::ObjectAccess::ToTagged(WasmArray::kLengthOffset);
Expand Down
22 changes: 22 additions & 0 deletions deps/v8/test/intl/regress-412149700.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2025 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

assertThrows("let a = new Intl.DateTimeFormat('de-u-22300-true-x-true')",
RangeError, "Internal error. Icu error.");
assertThrows("let a = new Intl.NumberFormat('de-u-22300-true-x-true')",
RangeError, "Internal error. Icu error.");
assertThrows("let a = new Intl.Collator('de-u-22300-true-x-true')",
RangeError, "Internal error. Icu error.");
assertThrows("let a = new Intl.PluralRules('de-u-22300-true-x-true')",
RangeError, "Internal error. Icu error.");
assertThrows("let a = new Intl.RelativeTimeFormat('de-u-22300-true-x-true')",
RangeError, "Internal error. Icu error.");
assertThrows("let a = new Intl.ListFormat('de-u-22300-true-x-true')",
RangeError, "Internal error. Icu error.");
assertThrows("let a = new Intl.DisplayNames('de-u-22300-true-x-true')",
RangeError, "Internal error. Icu error.");
assertThrows("let a = new Intl.Segmenter('de-u-22300-true-x-true')",
RangeError, "Internal error. Icu error.");
assertThrows("let a = new Intl.DurationFormat('de-u-22300-true-x-true')",
RangeError, "Internal error. Icu error.");
Loading
Loading