From 1acd8df36ff61f1fd1f92bdb9a2d2a646ec8d071 Mon Sep 17 00:00:00 2001 From: Abdirahim Musse Date: Tue, 7 Oct 2025 16:28:34 -0500 Subject: [PATCH] deps: V8: backport fed47445bbdd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Original commit message: Fix build on gcc This commit fixes two issues 1. ``` In file included from ../../src/compiler/turboshaft/assembler.h:37, from ../../src/wasm/turboshaft-graph-interface.h:13, from ../../src/wasm/function-compiler.cc:20: ../../src/compiler/turboshaft/builtin-call-descriptors.h:26:55: error: declaration of 'static constexpr v8::internal::compiler::turboshaft::detail::IndexTag<1> v8::internal::compiler::turboshaft::builtin::BigIntAdd::Arguments::index_counter(v8::internal::compiler::turboshaft::detail::IndexTag<1>)' changes meaning of 'index_counter' [-fpermissive] ``` GCC is more strict on accessing the fields from a inner struct. The fix was to wrap the base declarations in a struct and have Arguments struct inheirt from the base. 2. In maglev-ir.h and maglev-range-analysis.h fixed up `error: call to non-'constexpr'` issues. Change-Id: I175700665c7bbb4f07588e9cac3d55d9afce44d0 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6987408 Reviewed-by: Jakob Linke Commit-Queue: Jakob Linke Reviewed-by: Milad Farazmand Reviewed-by: Nico Hartmann Cr-Commit-Position: refs/heads/main@{#103041} Refs: https://github.com/v8/v8/commit/fed47445bbdd1a69b70f2b93a761c62c1e0f769c Co-authored-by: Michaƫl Zasso PR-URL: https://github.com/nodejs/node/pull/60111 Reviewed-By: Richard Lau Reviewed-By: Joyee Cheung Reviewed-By: Yagiz Nizipli --- common.gypi | 2 +- .../turboshaft/builtin-call-descriptors.h | 85 ++++++++++--------- deps/v8/src/maglev/maglev-ir.h | 2 +- 3 files changed, 46 insertions(+), 43 deletions(-) diff --git a/common.gypi b/common.gypi index 2252d1aa353..09bb9b93623 100644 --- a/common.gypi +++ b/common.gypi @@ -38,7 +38,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.7', + 'v8_embedder_string': '-node.8', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/src/compiler/turboshaft/builtin-call-descriptors.h b/deps/v8/src/compiler/turboshaft/builtin-call-descriptors.h index 1a6e66969cc..ed91aabe0df 100644 --- a/deps/v8/src/compiler/turboshaft/builtin-call-descriptors.h +++ b/deps/v8/src/compiler/turboshaft/builtin-call-descriptors.h @@ -66,12 +66,15 @@ struct builtin { // if necessary. static constexpr std::size_t kMaxArgumentCount = 8; using arguments_vector_t = base::SmallVector; - static constexpr inline detail::IndexTag<0> index_counter( - detail::IndexTag<0>); - static constexpr base::tmp::list<> make_args_type_list_n(detail::IndexTag<0>); + // TODO(abmusse): use ArgumentsBase (until we can use GCC 13 or better) + struct ArgumentsBase { + static constexpr inline detail::IndexTag<0> index_counter( + detail::IndexTag<0>); + static constexpr base::tmp::list<> make_args_type_list_n( + detail::IndexTag<0>); + }; static constexpr OpEffects base_effects = OpEffects().CanDependOnChecks(); - template static arguments_vector_t ArgumentsToVector(const A& args) { arguments_vector_t result; @@ -169,7 +172,7 @@ struct builtin { struct BigIntAdd : public Descriptor { static constexpr auto kFunction = Builtin::kBigIntAdd; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, left) ARG(V, right) }; @@ -183,7 +186,7 @@ struct builtin { struct CheckTurbofanType : public Descriptor { static constexpr auto kFunction = Builtin::kCheckTurbofanType; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, value) ARG(V, expected_type) ARG(V, node_id) @@ -201,7 +204,7 @@ struct builtin { #define DECL_GENERIC_BINOP(Name) \ struct Name : public Descriptor { \ static constexpr auto kFunction = Builtin::k##Name; \ - struct Arguments { \ + struct Arguments : ArgumentsBase { \ ARG(V, left) \ ARG(V, right) \ }; \ @@ -219,7 +222,7 @@ struct builtin { #define DECL_GENERIC_UNOP(Name) \ struct Name : public Descriptor { \ static constexpr auto kFunction = Builtin::k##Name; \ - struct Arguments { \ + struct Arguments : ArgumentsBase { \ ARG(V, input) \ }; \ using returns_t = std::tuple>; \ @@ -235,7 +238,7 @@ struct builtin { struct DetachContextCell : public Descriptor { static constexpr auto kFunction = Builtin::kDetachContextCell; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, the_context) ARG(V, new_value) ARG(V, i) @@ -251,7 +254,7 @@ struct builtin { struct ToNumber : public Descriptor { static constexpr auto kFunction = Builtin::kToNumber; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, input) }; using returns_t = std::tuple>; @@ -264,7 +267,7 @@ struct builtin { struct NonNumberToNumber : public Descriptor { static constexpr auto kFunction = Builtin::kNonNumberToNumber; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, input) }; using returns_t = std::tuple>; @@ -277,7 +280,7 @@ struct builtin { struct ToNumeric : public Descriptor { static constexpr auto kFunction = Builtin::kToNumeric; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, input) }; using returns_t = std::tuple>; @@ -290,7 +293,7 @@ struct builtin { struct NonNumberToNumeric : public Descriptor { static constexpr auto kFunction = Builtin::kNonNumberToNumeric; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, input) }; using returns_t = std::tuple>; @@ -304,7 +307,7 @@ struct builtin { struct CopyFastSmiOrObjectElements : public Descriptor { static constexpr auto kFunction = Builtin::kCopyFastSmiOrObjectElements; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, object) }; using returns_t = std::tuple>; @@ -321,7 +324,7 @@ struct builtin { static constexpr auto kFunction = B; using StringOrSmi = Union; // We use smi:0 for an empty label. - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, label_or_0) ARG(V, value) }; @@ -343,7 +346,7 @@ struct builtin { template struct FindOrderedHashEntry : public Descriptor> { static constexpr auto kFunction = B; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, table) ARG(V, key) }; @@ -363,7 +366,7 @@ struct builtin { template struct GrowFastElements : public Descriptor> { static constexpr auto kFunction = B; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, object) ARG(V, size) }; @@ -383,7 +386,7 @@ struct builtin { template struct NewArgumentsElements : public Descriptor> { static constexpr auto kFunction = B; - struct Arguments { + struct Arguments : ArgumentsBase { // TODO(nicohartmann@): First argument should be replaced by a proper // RawPtr. ARG(V, frame) @@ -406,7 +409,7 @@ struct builtin { struct NumberToString : public Descriptor { static constexpr auto kFunction = Builtin::kNumberToString; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, input) }; using returns_t = std::tuple>; @@ -420,7 +423,7 @@ struct builtin { struct ToString : public Descriptor { static constexpr auto kFunction = Builtin::kToString; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, o) }; using returns_t = std::tuple>; @@ -433,7 +436,7 @@ struct builtin { struct PlainPrimitiveToNumber : public Descriptor { static constexpr auto kFunction = Builtin::kPlainPrimitiveToNumber; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, input) }; using returns_t = std::tuple>; @@ -447,7 +450,7 @@ struct builtin { struct SameValue : public Descriptor { static constexpr auto kFunction = Builtin::kSameValue; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, left) ARG(V, right) }; @@ -462,7 +465,7 @@ struct builtin { struct SameValueNumbersOnly : public Descriptor { static constexpr auto kFunction = Builtin::kSameValueNumbersOnly; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, left) ARG(V, right) }; @@ -476,7 +479,7 @@ struct builtin { struct StringAdd_CheckNone : public Descriptor { static constexpr auto kFunction = Builtin::kStringAdd_CheckNone; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, left) ARG(V, right) }; @@ -494,7 +497,7 @@ struct builtin { struct StringEqual : public Descriptor { static constexpr auto kFunction = Builtin::kStringEqual; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, left) ARG(V, right) ARG(V, length) @@ -512,7 +515,7 @@ struct builtin { struct StringFromCodePointAt : public Descriptor { static constexpr auto kFunction = Builtin::kStringFromCodePointAt; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, receiver) ARG(V, position) }; @@ -527,7 +530,7 @@ struct builtin { struct StringIndexOf : public Descriptor { static constexpr auto kFunction = Builtin::kStringIndexOf; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, s) ARG(V, search_string) ARG(V, start) @@ -545,7 +548,7 @@ struct builtin { struct StringCompare : public Descriptor { static constexpr auto kFunction = Builtin::kStringCompare; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, left) ARG(V, right) }; @@ -561,7 +564,7 @@ struct builtin { template struct StringComparison : public Descriptor> { static constexpr auto kFunction = B; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, left) ARG(V, right) }; @@ -579,7 +582,7 @@ struct builtin { struct StringSubstring : public Descriptor { static constexpr auto kFunction = Builtin::kStringSubstring; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, string) ARG(V, from) ARG(V, to) @@ -596,7 +599,7 @@ struct builtin { #ifdef V8_INTL_SUPPORT struct StringToLowerCaseIntl : public Descriptor { static constexpr auto kFunction = Builtin::kStringToLowerCaseIntl; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, string) }; using returns_t = std::tuple>; @@ -612,7 +615,7 @@ struct builtin { struct StringToNumber : public Descriptor { static constexpr auto kFunction = Builtin::kStringToNumber; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, input) }; using returns_t = std::tuple>; @@ -626,7 +629,7 @@ struct builtin { struct ToBoolean : public Descriptor { static constexpr auto kFunction = Builtin::kToBoolean; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, input) }; using returns_t = std::tuple>; @@ -639,7 +642,7 @@ struct builtin { struct ToObject : public Descriptor { static constexpr auto kFunction = Builtin::kToObject; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, input) }; using returns_t = std::tuple>; @@ -654,7 +657,7 @@ struct builtin { template struct CreateFunctionContext : public Descriptor> { static constexpr auto kFunction = B; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, scope_info) ARG(V, slots) }; @@ -674,7 +677,7 @@ struct builtin { struct FastNewClosure : public Descriptor { static constexpr auto kFunction = Builtin::kFastNewClosure; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, shared_function_info) ARG(V, feedback_cell) }; @@ -690,7 +693,7 @@ struct builtin { struct Typeof : public Descriptor { static constexpr auto kFunction = Builtin::kTypeof; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, object) }; using returns_t = std::tuple>; @@ -704,7 +707,7 @@ struct builtin { struct CheckTurboshaftWord32Type : public Descriptor { static constexpr auto kFunction = Builtin::kCheckTurboshaftWord32Type; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, value) ARG(V, expected_type) ARG(V, node_id) @@ -720,7 +723,7 @@ struct builtin { struct CheckTurboshaftWord64Type : public Descriptor { static constexpr auto kFunction = Builtin::kCheckTurboshaftWord64Type; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, value_high) ARG(V, value_low) ARG(V, expected_type) @@ -737,7 +740,7 @@ struct builtin { struct CheckTurboshaftFloat32Type : public Descriptor { static constexpr auto kFunction = Builtin::kCheckTurboshaftFloat32Type; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, value) ARG(V, expected_type) ARG(V, node_id) @@ -753,7 +756,7 @@ struct builtin { struct CheckTurboshaftFloat64Type : public Descriptor { static constexpr auto kFunction = Builtin::kCheckTurboshaftFloat64Type; - struct Arguments { + struct Arguments : ArgumentsBase { ARG(V, value) ARG(V, expected_type) ARG(V, node_id) diff --git a/deps/v8/src/maglev/maglev-ir.h b/deps/v8/src/maglev/maglev-ir.h index 9d5cf70429e..6dcccf15f6b 100644 --- a/deps/v8/src/maglev/maglev-ir.h +++ b/deps/v8/src/maglev/maglev-ir.h @@ -6477,7 +6477,7 @@ class VirtualObject : public FixedInputValueNodeT<0, VirtualObject> { int slot_count() const { return slots_.length(); } - vobj::ObjectType object_type() const { + constexpr vobj::ObjectType object_type() const { return object_layout_->object_type; }