Skip to content

Commit c4f665f

Browse files
committedJan 5, 2023
deps: V8: cherry-pick d1d4c648e7ff
Original commit message: Disable cross-compilation of clobber-registers.cc This file uses inline assembly, but inline assembly does not work for cross-compilation. As this file only contains debug code, no-oping this file for cross-compilation seems acceptable. R=ishell@chromium.org Bug: v8:12926 Change-Id: I01276cf019e8c31e4db6f7f61a3d91526f660578 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3735165 Commit-Queue: Andreas Haas <ahaas@chromium.org> Reviewed-by: Igor Sheludko <ishell@chromium.org> Cr-Commit-Position: refs/heads/main@{#81466} Refs: v8/v8@d1d4c64 PR-URL: #46098 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Richard Lau <rlau@redhat.com>
1 parent bac6b7d commit c4f665f

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed
 

‎common.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
# Reset this number to 0 on major V8 upgrades.
3838
# Increment by one for each non-official patch applied to deps/v8.
39-
'v8_embedder_string': '-node.20',
39+
'v8_embedder_string': '-node.21',
4040

4141
##### V8 defaults for Node.js #####
4242

‎deps/v8/src/execution/clobber-registers.cc

+18-15
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,22 @@
55

66
#include "src/base/build_config.h"
77

8-
#if V8_HOST_ARCH_ARM
8+
// Check both {HOST_ARCH} and {TARGET_ARCH} to disable the functionality of this
9+
// file for cross-compilation. The reason is that the inline assembly code below
10+
// does not work for cross-compilation.
11+
#if V8_HOST_ARCH_ARM && V8_TARGET_ARCH_ARM
912
#include "src/codegen/arm/register-arm.h"
10-
#elif V8_HOST_ARCH_ARM64
13+
#elif V8_HOST_ARCH_ARM64 && V8_TARGET_ARCH_ARM64
1114
#include "src/codegen/arm64/register-arm64.h"
12-
#elif V8_HOST_ARCH_IA32
15+
#elif V8_HOST_ARCH_IA32 && V8_TARGET_ARCH_IA32
1316
#include "src/codegen/ia32/register-ia32.h"
14-
#elif V8_HOST_ARCH_X64
17+
#elif V8_HOST_ARCH_X64 && V8_TARGET_ARCH_X64
1518
#include "src/codegen/x64/register-x64.h"
16-
#elif V8_HOST_ARCH_LOONG64
19+
#elif V8_HOST_ARCH_LOONG64 && V8_TARGET_ARCH_LOONG64
1720
#include "src/codegen/loong64/register-loong64.h"
18-
#elif V8_HOST_ARCH_MIPS
21+
#elif V8_HOST_ARCH_MIPS && V8_TARGET_ARCH_MIPS
1922
#include "src/codegen/mips/register-mips.h"
20-
#elif V8_HOST_ARCH_MIPS64
23+
#elif V8_HOST_ARCH_MIPS64 && V8_TARGET_ARCH_MIPS64
2124
#include "src/codegen/mips64/register-mips64.h"
2225
#endif
2326

@@ -26,14 +29,15 @@ namespace internal {
2629

2730
#if V8_CC_MSVC
2831
// msvc only support inline assembly on x86
29-
#if V8_HOST_ARCH_IA32
32+
#if V8_HOST_ARCH_IA32 && V8_TARGET_ARCH_IA32
3033
#define CLOBBER_REGISTER(R) __asm xorps R, R
3134

3235
#endif
3336

3437
#else // !V8_CC_MSVC
3538

36-
#if V8_HOST_ARCH_X64 || V8_HOST_ARCH_IA32
39+
#if (V8_HOST_ARCH_X64 && V8_TARGET_ARCH_X64) || \
40+
(V8_HOST_ARCH_IA32 && V8_TARGET_ARCH_IA32)
3741
#define CLOBBER_REGISTER(R) \
3842
__asm__ volatile( \
3943
"xorps " \
@@ -42,20 +46,19 @@ namespace internal {
4246
"%%" #R :: \
4347
:);
4448

45-
#elif V8_HOST_ARCH_ARM64
49+
#elif V8_HOST_ARCH_ARM64 && V8_TARGET_ARCH_ARM64
4650
#define CLOBBER_REGISTER(R) __asm__ volatile("fmov " #R ",xzr" :::);
4751

48-
#elif V8_HOST_ARCH_LOONG64
52+
#elif V8_HOST_ARCH_LOONG64 && V8_TARGET_ARCH_LOONG64
4953
#define CLOBBER_REGISTER(R) __asm__ volatile("movgr2fr.d $" #R ",$zero" :::);
5054

51-
#elif V8_HOST_ARCH_MIPS
55+
#elif V8_HOST_ARCH_MIPS && V8_TARGET_ARCH_MIPS
5256
#define CLOBBER_USE_REGISTER(R) __asm__ volatile("mtc1 $zero,$" #R :::);
5357

54-
#elif V8_HOST_ARCH_MIPS64
58+
#elif V8_HOST_ARCH_MIPS64 && V8_TARGET_ARCH_MIPS64
5559
#define CLOBBER_USE_REGISTER(R) __asm__ volatile("dmtc1 $zero,$" #R :::);
5660

57-
#endif // V8_HOST_ARCH_X64 || V8_HOST_ARCH_IA32 || V8_HOST_ARCH_ARM64 ||
58-
// V8_HOST_ARCH_LOONG64 || V8_HOST_ARCH_MIPS || V8_HOST_ARCH_MIPS64
61+
#endif // V8_HOST_ARCH_XXX && V8_TARGET_ARCH_XXX
5962

6063
#endif // V8_CC_MSVC
6164

0 commit comments

Comments
 (0)
Please sign in to comment.