Skip to content

Commit

Permalink
deps: V8: cherry-pick b161a0823165
Browse files Browse the repository at this point in the history
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: v8/v8@b161a08
PR-URL: #44741
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
targos committed Oct 11, 2022
1 parent 7a8fa2d commit c8ff2df
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -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 #####

Expand Down
12 changes: 12 additions & 0 deletions deps/v8/src/trap-handler/handler-outside-simulator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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

0 comments on commit c8ff2df

Please sign in to comment.