From 7eb0ac3cb689297a855c1686a12181e22ee6e030 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Mon, 20 Mar 2023 15:46:39 +0100 Subject: [PATCH] deps: patch V8 to support compilation on win-arm64 PR-URL: https://github.com/nodejs/node/pull/47251 Reviewed-By: Yagiz Nizipli Reviewed-By: Jiawen Geng Reviewed-By: Rafael Gonzaga Reviewed-By: Richard Lau --- common.gypi | 2 +- .../v8/src/execution/arm64/simulator-arm64.cc | 5 ++++ .../src/trap-handler/trap-handler-simulator.h | 4 +++- deps/v8/test/cctest/test-assembler-arm64.cc | 24 +++++++++---------- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/common.gypi b/common.gypi index d4d64a90f56a6c..0dcf428002c4c7 100644 --- a/common.gypi +++ b/common.gypi @@ -36,7 +36,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.2', + 'v8_embedder_string': '-node.3', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/src/execution/arm64/simulator-arm64.cc b/deps/v8/src/execution/arm64/simulator-arm64.cc index 16cf4f3b84025e..548cd3017bcbc1 100644 --- a/deps/v8/src/execution/arm64/simulator-arm64.cc +++ b/deps/v8/src/execution/arm64/simulator-arm64.cc @@ -34,6 +34,11 @@ #include "src/trap-handler/trap-handler-simulator.h" #endif // V8_ENABLE_WEBASSEMBLY +#if defined(_MSC_VER) +// define full memory barrier for msvc +#define __sync_synchronize _ReadWriteBarrier +#endif + namespace v8 { namespace internal { diff --git a/deps/v8/src/trap-handler/trap-handler-simulator.h b/deps/v8/src/trap-handler/trap-handler-simulator.h index 0ab80d202eee07..627f8e8dad4fcb 100644 --- a/deps/v8/src/trap-handler/trap-handler-simulator.h +++ b/deps/v8/src/trap-handler/trap-handler-simulator.h @@ -34,8 +34,10 @@ uintptr_t ProbeMemory(uintptr_t address, uintptr_t pc) // "ProbeMemory", but we want something more expressive on stack traces. #if V8_OS_DARWIN asm("_v8_internal_simulator_ProbeMemory"); -#else +#elif !defined(_MSC_VER) asm("v8_internal_simulator_ProbeMemory"); +#else // MSVC + ; #endif } // namespace v8::internal::trap_handler diff --git a/deps/v8/test/cctest/test-assembler-arm64.cc b/deps/v8/test/cctest/test-assembler-arm64.cc index 829b124fd626d8..273cba805857f4 100644 --- a/deps/v8/test/cctest/test-assembler-arm64.cc +++ b/deps/v8/test/cctest/test-assembler-arm64.cc @@ -14771,12 +14771,12 @@ static void AtomicMemoryWHelper(AtomicMemoryLoadSignature* load_funcs, AtomicMemoryStoreSignature* store_funcs, uint64_t arg1, uint64_t arg2, uint64_t expected, uint64_t result_mask) { - uint64_t data0[] __attribute__((aligned(kXRegSize * 2))) = {arg2, 0}; - uint64_t data1[] __attribute__((aligned(kXRegSize * 2))) = {arg2, 0}; - uint64_t data2[] __attribute__((aligned(kXRegSize * 2))) = {arg2, 0}; - uint64_t data3[] __attribute__((aligned(kXRegSize * 2))) = {arg2, 0}; - uint64_t data4[] __attribute__((aligned(kXRegSize * 2))) = {arg2, 0}; - uint64_t data5[] __attribute__((aligned(kXRegSize * 2))) = {arg2, 0}; + uint64_t data0[2] = {arg2, 0}; + uint64_t data1[2] = {arg2, 0}; + uint64_t data2[2] = {arg2, 0}; + uint64_t data3[2] = {arg2, 0}; + uint64_t data4[2] = {arg2, 0}; + uint64_t data5[2] = {arg2, 0}; SETUP(); SETUP_FEATURE(LSE); @@ -14838,12 +14838,12 @@ static void AtomicMemoryXHelper(AtomicMemoryLoadSignature* load_funcs, AtomicMemoryStoreSignature* store_funcs, uint64_t arg1, uint64_t arg2, uint64_t expected) { - uint64_t data0[] __attribute__((aligned(kXRegSize * 2))) = {arg2, 0}; - uint64_t data1[] __attribute__((aligned(kXRegSize * 2))) = {arg2, 0}; - uint64_t data2[] __attribute__((aligned(kXRegSize * 2))) = {arg2, 0}; - uint64_t data3[] __attribute__((aligned(kXRegSize * 2))) = {arg2, 0}; - uint64_t data4[] __attribute__((aligned(kXRegSize * 2))) = {arg2, 0}; - uint64_t data5[] __attribute__((aligned(kXRegSize * 2))) = {arg2, 0}; + uint64_t data0[2] = {arg2, 0}; + uint64_t data1[2] = {arg2, 0}; + uint64_t data2[2] = {arg2, 0}; + uint64_t data3[2] = {arg2, 0}; + uint64_t data4[2] = {arg2, 0}; + uint64_t data5[2] = {arg2, 0}; SETUP(); SETUP_FEATURE(LSE);