From c8ff2dfd1137acbc2defaea3d6d93df3cb7b0823 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Sun, 25 Sep 2022 17:34:59 +0200 Subject: [PATCH] deps: V8: cherry-pick b161a0823165 Original commit message: [msvc] implement symbols without inline assembly MSVC does not support inline assembly (clang-cl does). Those two functions needs to be implemented using C++ only. Implemented a version for MSVC only, based on an intrinsic (that guarantees load, even with optimization) available for any architecture. Bug: v8:13312 Change-Id: I3aa4eac03c099535c5d3a9a40221bd5f8bbcb0d1 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913036 Reviewed-by: Jakob Kummerow Reviewed-by: Thibaud Michaud Commit-Queue: Jakob Kummerow Cr-Commit-Position: refs/heads/main@{#83407} Refs: https://github.com/v8/v8/commit/b161a08231651531800cc867a29a82e514e4563b PR-URL: https://github.com/nodejs/node/pull/44741 Reviewed-By: Ben Noordhuis Reviewed-By: Jiawen Geng Reviewed-By: James M Snell --- common.gypi | 2 +- .../v8/src/trap-handler/handler-outside-simulator.cc | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/common.gypi b/common.gypi index ed0d11a619c357..af5098d898109d 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.7', + 'v8_embedder_string': '-node.8', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/src/trap-handler/handler-outside-simulator.cc b/deps/v8/src/trap-handler/handler-outside-simulator.cc index 179eab0659f923..286d7c8b9a8286 100644 --- a/deps/v8/src/trap-handler/handler-outside-simulator.cc +++ b/deps/v8/src/trap-handler/handler-outside-simulator.cc @@ -11,6 +11,17 @@ #define SYMBOL(name) #name #endif // !V8_OS_DARWIN +#if defined(_MSC_VER) && !defined(__clang__) +// MSVC does not accept inline assembly +#include +extern "C" uintptr_t ProbeMemory(uintptr_t address, uintptr_t pc) { + // @pc parameter is unused. + // This intrinsic guarantees that a load from address will be done. + __iso_volatile_load8(reinterpret_cast(address)); + return 0; +} +extern "C" void v8_probe_memory_continuation() {} +#else // Define the ProbeMemory function declared in trap-handler-simulators.h. asm( ".globl " SYMBOL(ProbeMemory) " \n" @@ -35,3 +46,4 @@ asm( SYMBOL(v8_probe_memory_continuation) ": \n" // If the trap handler continues here, it wrote the landing pad in %rax. " ret \n"); +#endif