From 014c3bdbcfb38bcd145ed8b588ff17a2704f5c9d Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Wed, 22 Apr 2026 14:19:21 +0000 Subject: [PATCH 1/2] Revert "deps: V8: cherry-pick 7107287" This reverts commit 142b593485e3eea6c2f0850472452ceab7269cfb. --- common.gypi | 2 +- deps/v8/BUILD.gn | 2 +- deps/v8/src/builtins/ppc/builtins-ppc.cc | 13 ------------- deps/v8/src/compiler/turboshaft/operations.h | 6 +++--- deps/v8/src/execution/simulator.h | 18 +++++++----------- deps/v8/src/trap-handler/handler-shared.cc | 4 ---- 6 files changed, 12 insertions(+), 33 deletions(-) diff --git a/common.gypi b/common.gypi index 56f97a39497b5a..62d0d61529c41c 100644 --- a/common.gypi +++ b/common.gypi @@ -39,7 +39,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.18', + 'v8_embedder_string': '-node.17', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/BUILD.gn b/deps/v8/BUILD.gn index 75034b69a8a648..6432f7342e26a5 100644 --- a/deps/v8/BUILD.gn +++ b/deps/v8/BUILD.gn @@ -1583,7 +1583,7 @@ config("toolchain") { if (v8_current_cpu == "ppc64") { defines += [ "V8_TARGET_ARCH_PPC64" ] cflags += [ "-ffp-contract=off" ] - if (current_os == "aix" and !is_clang) { + if (current_os == "aix") { cflags += [ # Work around AIX ceil, trunc and round oddities. "-mcpu=power5+", diff --git a/deps/v8/src/builtins/ppc/builtins-ppc.cc b/deps/v8/src/builtins/ppc/builtins-ppc.cc index 45c59b0ce74f21..fe0856261e423a 100644 --- a/deps/v8/src/builtins/ppc/builtins-ppc.cc +++ b/deps/v8/src/builtins/ppc/builtins-ppc.cc @@ -4219,19 +4219,6 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size, // If return value is on the stack, pop it to registers. if (needs_return_buffer) { - Label done; - if (switch_to_central_stack) { - Label no_stack_change; - __ CmpU64(kOldSPRegister, Operand(0), r0); - __ beq(&no_stack_change); - __ addi(r3, kOldSPRegister, - Operand((kStackFrameExtraParamSlot + 1) * kSystemPointerSize)); - __ b(&done); - __ bind(&no_stack_change); - } - __ addi(r3, sp, - Operand((kStackFrameExtraParamSlot + 1) * kSystemPointerSize)); - __ bind(&done); __ LoadU64(r4, MemOperand(r3, kSystemPointerSize)); __ LoadU64(r3, MemOperand(r3)); } diff --git a/deps/v8/src/compiler/turboshaft/operations.h b/deps/v8/src/compiler/turboshaft/operations.h index 2059de599c10d5..c306bd14822054 100644 --- a/deps/v8/src/compiler/turboshaft/operations.h +++ b/deps/v8/src/compiler/turboshaft/operations.h @@ -526,7 +526,7 @@ class InputsRepFactory { }; }; -struct __attribute__((packed)) EffectDimensions { +struct EffectDimensions { // Produced by loads, consumed by operations that should not move before loads // because they change memory. bool load_heap_memory : 1; @@ -621,7 +621,7 @@ static_assert(sizeof(EffectDimensions) == sizeof(EffectDimensions::Bits)); // they become more restricted in their movement. Note that calls are not the // most side-effectful operations, as they do not leave the heap in an // inconsistent state, so they do not need to be marked as raw heap access. -struct __attribute__((packed)) OpEffects { +struct OpEffects { EffectDimensions produces; EffectDimensions consumes; @@ -2878,7 +2878,7 @@ struct ConstantOp : FixedArityOperationT<0, ConstantOp> { // When result_rep is RegisterRepresentation::Compressed(), then the load does // not decompress the value. struct LoadOp : OperationT { - struct __attribute__((packed)) Kind { + struct Kind { // The `base` input is a tagged pointer to a HeapObject. bool tagged_base : 1; // The effective address might be unaligned. This is only set to true if diff --git a/deps/v8/src/execution/simulator.h b/deps/v8/src/execution/simulator.h index 8a6eb8e02c6482..9ba16c3e7de69c 100644 --- a/deps/v8/src/execution/simulator.h +++ b/deps/v8/src/execution/simulator.h @@ -199,17 +199,13 @@ class GeneratedCode { return fn(args...); #else // AIX ABI requires function descriptors (FD). Artificially create a pseudo - // FD to ensure correct dispatch to generated code. - void* function_desc[3]; - Signature* fn; - asm("std %1, 0(%2)\n\t" - "li 0, 0\n\t" - "std 0, 8(%2)\n\t" - "std 0, 16(%2)\n\t" - "mr %0, %2\n\t" - : "=r"(fn) - : "r"(fn_ptr_), "r"(function_desc) - : "memory", "0"); + // FD to ensure correct dispatch to generated code. The 'volatile' + // declaration is required to avoid the compiler from not observing the + // alias of the pseudo FD to the function pointer, and hence, optimizing the + // pseudo FD declaration/initialization away. + volatile Address function_desc[] = {reinterpret_cast
(fn_ptr_), 0, + 0}; + Signature* fn = reinterpret_cast(function_desc); return fn(args...); #endif // V8_OS_ZOS #else diff --git a/deps/v8/src/trap-handler/handler-shared.cc b/deps/v8/src/trap-handler/handler-shared.cc index 23778117637f6a..443f023fd18b32 100644 --- a/deps/v8/src/trap-handler/handler-shared.cc +++ b/deps/v8/src/trap-handler/handler-shared.cc @@ -24,11 +24,7 @@ namespace v8 { namespace internal { namespace trap_handler { -#if defined(V8_OS_AIX) -__thread bool TrapHandlerGuard::is_active_ = 0; -#else thread_local bool TrapHandlerGuard::is_active_ = 0; -#endif size_t gNumCodeObjects = 0; CodeProtectionInfoListEntry* gCodeObjects = nullptr; From 5d7272dae41c7bb1a77e3b9dd1e4fa474b15ec54 Mon Sep 17 00:00:00 2001 From: Abdirahim Musse Date: Thu, 11 Dec 2025 12:10:12 -0600 Subject: [PATCH 2/2] deps: V8: cherry-pick fcf8b990c73c Original commit message: aix: add required changes to build with clang Change-Id: Icc78c58831306aa2f227843b0b4ec2321585fa64 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7107287 Reviewed-by: Toon Verwaest Commit-Queue: Clemens Backes Reviewed-by: Leszek Swirski Cr-Commit-Position: refs/heads/main@{#104364} Refs: https://github.com/v8/v8/commit/fcf8b990c73c4d22cf90d3cdcec448af79a90ae6 --- common.gypi | 2 +- deps/v8/BUILD.gn | 2 +- deps/v8/src/builtins/ppc/builtins-ppc.cc | 13 +++++++++++++ deps/v8/src/compiler/turboshaft/operations.h | 6 +++--- deps/v8/src/execution/simulator.h | 18 +++++++++++------- deps/v8/src/trap-handler/handler-shared.cc | 4 ++++ 6 files changed, 33 insertions(+), 12 deletions(-) diff --git a/common.gypi b/common.gypi index 62d0d61529c41c..56f97a39497b5a 100644 --- a/common.gypi +++ b/common.gypi @@ -39,7 +39,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.17', + 'v8_embedder_string': '-node.18', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/BUILD.gn b/deps/v8/BUILD.gn index 6432f7342e26a5..c30222b4a992ca 100644 --- a/deps/v8/BUILD.gn +++ b/deps/v8/BUILD.gn @@ -1583,7 +1583,7 @@ config("toolchain") { if (v8_current_cpu == "ppc64") { defines += [ "V8_TARGET_ARCH_PPC64" ] cflags += [ "-ffp-contract=off" ] - if (current_os == "aix") { + if (current_os == "aix" && !is_clang) { cflags += [ # Work around AIX ceil, trunc and round oddities. "-mcpu=power5+", diff --git a/deps/v8/src/builtins/ppc/builtins-ppc.cc b/deps/v8/src/builtins/ppc/builtins-ppc.cc index fe0856261e423a..45c59b0ce74f21 100644 --- a/deps/v8/src/builtins/ppc/builtins-ppc.cc +++ b/deps/v8/src/builtins/ppc/builtins-ppc.cc @@ -4219,6 +4219,19 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size, // If return value is on the stack, pop it to registers. if (needs_return_buffer) { + Label done; + if (switch_to_central_stack) { + Label no_stack_change; + __ CmpU64(kOldSPRegister, Operand(0), r0); + __ beq(&no_stack_change); + __ addi(r3, kOldSPRegister, + Operand((kStackFrameExtraParamSlot + 1) * kSystemPointerSize)); + __ b(&done); + __ bind(&no_stack_change); + } + __ addi(r3, sp, + Operand((kStackFrameExtraParamSlot + 1) * kSystemPointerSize)); + __ bind(&done); __ LoadU64(r4, MemOperand(r3, kSystemPointerSize)); __ LoadU64(r3, MemOperand(r3)); } diff --git a/deps/v8/src/compiler/turboshaft/operations.h b/deps/v8/src/compiler/turboshaft/operations.h index c306bd14822054..2bc695998d6b69 100644 --- a/deps/v8/src/compiler/turboshaft/operations.h +++ b/deps/v8/src/compiler/turboshaft/operations.h @@ -526,7 +526,7 @@ class InputsRepFactory { }; }; -struct EffectDimensions { +struct __attribute__((packed)) EffectDimensions { // Produced by loads, consumed by operations that should not move before loads // because they change memory. bool load_heap_memory : 1; @@ -621,7 +621,7 @@ static_assert(sizeof(EffectDimensions) == sizeof(EffectDimensions::Bits)); // they become more restricted in their movement. Note that calls are not the // most side-effectful operations, as they do not leave the heap in an // inconsistent state, so they do not need to be marked as raw heap access. -struct OpEffects { +struct __attribute__((packed)) OpEffects { EffectDimensions produces; EffectDimensions consumes; @@ -2878,7 +2878,7 @@ struct ConstantOp : FixedArityOperationT<0, ConstantOp> { // When result_rep is RegisterRepresentation::Compressed(), then the load does // not decompress the value. struct LoadOp : OperationT { - struct Kind { + struct __attribute__((packed)) Kind { // The `base` input is a tagged pointer to a HeapObject. bool tagged_base : 1; // The effective address might be unaligned. This is only set to true if diff --git a/deps/v8/src/execution/simulator.h b/deps/v8/src/execution/simulator.h index 9ba16c3e7de69c..8a6eb8e02c6482 100644 --- a/deps/v8/src/execution/simulator.h +++ b/deps/v8/src/execution/simulator.h @@ -199,13 +199,17 @@ class GeneratedCode { return fn(args...); #else // AIX ABI requires function descriptors (FD). Artificially create a pseudo - // FD to ensure correct dispatch to generated code. The 'volatile' - // declaration is required to avoid the compiler from not observing the - // alias of the pseudo FD to the function pointer, and hence, optimizing the - // pseudo FD declaration/initialization away. - volatile Address function_desc[] = {reinterpret_cast
(fn_ptr_), 0, - 0}; - Signature* fn = reinterpret_cast(function_desc); + // FD to ensure correct dispatch to generated code. + void* function_desc[3]; + Signature* fn; + asm("std %1, 0(%2)\n\t" + "li 0, 0\n\t" + "std 0, 8(%2)\n\t" + "std 0, 16(%2)\n\t" + "mr %0, %2\n\t" + : "=r"(fn) + : "r"(fn_ptr_), "r"(function_desc) + : "memory", "0"); return fn(args...); #endif // V8_OS_ZOS #else diff --git a/deps/v8/src/trap-handler/handler-shared.cc b/deps/v8/src/trap-handler/handler-shared.cc index 443f023fd18b32..23778117637f6a 100644 --- a/deps/v8/src/trap-handler/handler-shared.cc +++ b/deps/v8/src/trap-handler/handler-shared.cc @@ -24,7 +24,11 @@ namespace v8 { namespace internal { namespace trap_handler { +#if defined(V8_OS_AIX) +__thread bool TrapHandlerGuard::is_active_ = 0; +#else thread_local bool TrapHandlerGuard::is_active_ = 0; +#endif size_t gNumCodeObjects = 0; CodeProtectionInfoListEntry* gCodeObjects = nullptr;