0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-27 22:16:50 +01:00

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 <jkummerow@chromium.org>
    Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83407}

Refs: b161a08231
PR-URL: https://github.com/nodejs/node/pull/44741
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Michaël Zasso 2022-09-25 17:34:59 +02:00
parent 7a8fa2d517
commit c8ff2dfd11
No known key found for this signature in database
GPG Key ID: 770F7A9A5AE15600
2 changed files with 13 additions and 1 deletions

View File

@ -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 #####

View File

@ -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 <intrin.h>
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<char*>(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