From 742ffefb4449b69369ad8adb34f60a8e98b5f582 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Tue, 19 Apr 2022 10:01:34 +0200 Subject: [PATCH] deps: make V8 10.2 ABI-compatible with 10.1 Create an unused deopt kind to replace `DeoptimizeKind::kSoft`, which was removed. This ensures that the layout of IsolateData doesn't change. Refs: https://github.com/v8/v8/commit/1ff685d8b1a13794abaca3adf36cfd9838b1f6fc PR-URL: https://github.com/nodejs/node/pull/42740 Reviewed-By: Jiawen Geng Reviewed-By: Richard Lau --- common.gypi | 2 +- deps/v8/include/v8-internal.h | 4 ++-- deps/v8/src/builtins/arm/builtins-arm.cc | 4 ++++ deps/v8/src/builtins/arm64/builtins-arm64.cc | 4 ++++ deps/v8/src/builtins/builtins-definitions.h | 2 ++ deps/v8/src/builtins/ia32/builtins-ia32.cc | 4 ++++ deps/v8/src/builtins/loong64/builtins-loong64.cc | 4 ++++ deps/v8/src/builtins/mips/builtins-mips.cc | 4 ++++ deps/v8/src/builtins/mips64/builtins-mips64.cc | 4 ++++ deps/v8/src/builtins/ppc/builtins-ppc.cc | 4 ++++ deps/v8/src/builtins/riscv64/builtins-riscv64.cc | 4 ++++ deps/v8/src/builtins/s390/builtins-s390.cc | 4 ++++ deps/v8/src/builtins/x64/builtins-x64.cc | 4 ++++ deps/v8/src/common/globals.h | 4 ++++ deps/v8/src/deoptimizer/deoptimizer.cc | 7 +++++++ 15 files changed, 56 insertions(+), 3 deletions(-) diff --git a/common.gypi b/common.gypi index a879c4f93d8d45..ecb5dd907f2b75 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/include/v8-internal.h b/deps/v8/include/v8-internal.h index 37c5b336dad935..e6e9cc5f9f5bbc 100644 --- a/deps/v8/include/v8-internal.h +++ b/deps/v8/include/v8-internal.h @@ -365,8 +365,8 @@ class Internals { static const uint32_t kNumIsolateDataSlots = 4; static const int kStackGuardSize = 7 * kApiSystemPointerSize; - static const int kBuiltinTier0EntryTableSize = 9 * kApiSystemPointerSize; - static const int kBuiltinTier0TableSize = 9 * kApiSystemPointerSize; + static const int kBuiltinTier0EntryTableSize = 10 * kApiSystemPointerSize; + static const int kBuiltinTier0TableSize = 10 * kApiSystemPointerSize; // IsolateData layout guarantees. static const int kIsolateCageBaseOffset = 0; diff --git a/deps/v8/src/builtins/arm/builtins-arm.cc b/deps/v8/src/builtins/arm/builtins-arm.cc index 38a88c24efb56a..e3f78a86aa99d5 100644 --- a/deps/v8/src/builtins/arm/builtins-arm.cc +++ b/deps/v8/src/builtins/arm/builtins-arm.cc @@ -3537,6 +3537,10 @@ void Builtins::Generate_DeoptimizationEntry_Lazy(MacroAssembler* masm) { Generate_DeoptimizationEntry(masm, DeoptimizeKind::kLazy); } +void Builtins::Generate_DeoptimizationEntry_Unused(MacroAssembler* masm) { + Generate_DeoptimizationEntry(masm, DeoptimizeKind::kUnused); +} + namespace { // Restarts execution either at the current or next (in execution order) diff --git a/deps/v8/src/builtins/arm64/builtins-arm64.cc b/deps/v8/src/builtins/arm64/builtins-arm64.cc index 7bfd4f81906784..0cb649b15dddcc 100644 --- a/deps/v8/src/builtins/arm64/builtins-arm64.cc +++ b/deps/v8/src/builtins/arm64/builtins-arm64.cc @@ -4056,6 +4056,10 @@ void Builtins::Generate_DeoptimizationEntry_Lazy(MacroAssembler* masm) { Generate_DeoptimizationEntry(masm, DeoptimizeKind::kLazy); } +void Builtins::Generate_DeoptimizationEntry_Unused(MacroAssembler* masm) { + Generate_DeoptimizationEntry(masm, DeoptimizeKind::kUnused); +} + namespace { // Restarts execution either at the current or next (in execution order) diff --git a/deps/v8/src/builtins/builtins-definitions.h b/deps/v8/src/builtins/builtins-definitions.h index 6b43659d99d23b..e93ba60ea5efa5 100644 --- a/deps/v8/src/builtins/builtins-definitions.h +++ b/deps/v8/src/builtins/builtins-definitions.h @@ -46,6 +46,8 @@ namespace internal { /* Deoptimization entries. */ \ ASM(DeoptimizationEntry_Eager, DeoptimizationEntry) \ ASM(DeoptimizationEntry_Lazy, DeoptimizationEntry) \ + /* Replaces "Soft" for ABI compatibility. */ \ + ASM(DeoptimizationEntry_Unused, DeoptimizationEntry) \ \ /* GC write barrier. */ \ TFC(RecordWriteEmitRememberedSetSaveFP, WriteBarrier) \ diff --git a/deps/v8/src/builtins/ia32/builtins-ia32.cc b/deps/v8/src/builtins/ia32/builtins-ia32.cc index 7f32853d1f7cff..0a7b49d6ad71ca 100644 --- a/deps/v8/src/builtins/ia32/builtins-ia32.cc +++ b/deps/v8/src/builtins/ia32/builtins-ia32.cc @@ -4153,6 +4153,10 @@ void Builtins::Generate_DeoptimizationEntry_Lazy(MacroAssembler* masm) { Generate_DeoptimizationEntry(masm, DeoptimizeKind::kLazy); } +void Builtins::Generate_DeoptimizationEntry_Unused(MacroAssembler* masm) { + Generate_DeoptimizationEntry(masm, DeoptimizeKind::kUnused); +} + namespace { // Restarts execution either at the current or next (in execution order) diff --git a/deps/v8/src/builtins/loong64/builtins-loong64.cc b/deps/v8/src/builtins/loong64/builtins-loong64.cc index b94128f409d884..fa3bf4f32f0f8f 100644 --- a/deps/v8/src/builtins/loong64/builtins-loong64.cc +++ b/deps/v8/src/builtins/loong64/builtins-loong64.cc @@ -3554,6 +3554,10 @@ void Builtins::Generate_DeoptimizationEntry_Lazy(MacroAssembler* masm) { Generate_DeoptimizationEntry(masm, DeoptimizeKind::kLazy); } +void Builtins::Generate_DeoptimizationEntry_Unused(MacroAssembler* masm) { + Generate_DeoptimizationEntry(masm, DeoptimizeKind::kUnused); +} + namespace { // Restarts execution either at the current or next (in execution order) diff --git a/deps/v8/src/builtins/mips/builtins-mips.cc b/deps/v8/src/builtins/mips/builtins-mips.cc index 379af4b264891f..05e676a8837a29 100644 --- a/deps/v8/src/builtins/mips/builtins-mips.cc +++ b/deps/v8/src/builtins/mips/builtins-mips.cc @@ -4002,6 +4002,10 @@ void Builtins::Generate_DeoptimizationEntry_Lazy(MacroAssembler* masm) { Generate_DeoptimizationEntry(masm, DeoptimizeKind::kLazy); } +void Builtins::Generate_DeoptimizationEntry_Unused(MacroAssembler* masm) { + Generate_DeoptimizationEntry(masm, DeoptimizeKind::kUnused); +} + namespace { // Restarts execution either at the current or next (in execution order) diff --git a/deps/v8/src/builtins/mips64/builtins-mips64.cc b/deps/v8/src/builtins/mips64/builtins-mips64.cc index f1eb2e1847f8e7..90be59a884b1da 100644 --- a/deps/v8/src/builtins/mips64/builtins-mips64.cc +++ b/deps/v8/src/builtins/mips64/builtins-mips64.cc @@ -3581,6 +3581,10 @@ void Builtins::Generate_DeoptimizationEntry_Lazy(MacroAssembler* masm) { Generate_DeoptimizationEntry(masm, DeoptimizeKind::kLazy); } +void Builtins::Generate_DeoptimizationEntry_Unused(MacroAssembler* masm) { + Generate_DeoptimizationEntry(masm, DeoptimizeKind::kUnused); +} + namespace { // Restarts execution either at the current or next (in execution order) diff --git a/deps/v8/src/builtins/ppc/builtins-ppc.cc b/deps/v8/src/builtins/ppc/builtins-ppc.cc index 64b45555a1c1a5..754e7f1679c34c 100644 --- a/deps/v8/src/builtins/ppc/builtins-ppc.cc +++ b/deps/v8/src/builtins/ppc/builtins-ppc.cc @@ -3839,6 +3839,10 @@ void Builtins::Generate_DeoptimizationEntry_Lazy(MacroAssembler* masm) { Generate_DeoptimizationEntry(masm, DeoptimizeKind::kLazy); } +void Builtins::Generate_DeoptimizationEntry_Unused(MacroAssembler* masm) { + Generate_DeoptimizationEntry(masm, DeoptimizeKind::kUnused); +} + void Builtins::Generate_BaselineOrInterpreterEnterAtBytecode( MacroAssembler* masm) { // Implement on this platform, https://crrev.com/c/2695591. diff --git a/deps/v8/src/builtins/riscv64/builtins-riscv64.cc b/deps/v8/src/builtins/riscv64/builtins-riscv64.cc index d6fb8d279aafbc..6bccec0ef8a614 100644 --- a/deps/v8/src/builtins/riscv64/builtins-riscv64.cc +++ b/deps/v8/src/builtins/riscv64/builtins-riscv64.cc @@ -3668,6 +3668,10 @@ void Builtins::Generate_DeoptimizationEntry_Lazy(MacroAssembler* masm) { Generate_DeoptimizationEntry(masm, DeoptimizeKind::kLazy); } +void Builtins::Generate_DeoptimizationEntry_Unused(MacroAssembler* masm) { + Generate_DeoptimizationEntry(masm, DeoptimizeKind::kUnused); +} + namespace { // Restarts execution either at the current or next (in execution order) diff --git a/deps/v8/src/builtins/s390/builtins-s390.cc b/deps/v8/src/builtins/s390/builtins-s390.cc index afaae01b2a9552..d96115a74abe16 100644 --- a/deps/v8/src/builtins/s390/builtins-s390.cc +++ b/deps/v8/src/builtins/s390/builtins-s390.cc @@ -3836,6 +3836,10 @@ void Builtins::Generate_DeoptimizationEntry_Lazy(MacroAssembler* masm) { Generate_DeoptimizationEntry(masm, DeoptimizeKind::kLazy); } +void Builtins::Generate_DeoptimizationEntry_Unused(MacroAssembler* masm) { + Generate_DeoptimizationEntry(masm, DeoptimizeKind::kUnused); +} + void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { OnStackReplacement(masm, OsrSourceTier::kInterpreter); } diff --git a/deps/v8/src/builtins/x64/builtins-x64.cc b/deps/v8/src/builtins/x64/builtins-x64.cc index a59143273c070a..c5709e9d9e2dd8 100644 --- a/deps/v8/src/builtins/x64/builtins-x64.cc +++ b/deps/v8/src/builtins/x64/builtins-x64.cc @@ -5007,6 +5007,10 @@ void Builtins::Generate_DeoptimizationEntry_Lazy(MacroAssembler* masm) { Generate_DeoptimizationEntry(masm, DeoptimizeKind::kLazy); } +void Builtins::Generate_DeoptimizationEntry_Unused(MacroAssembler* masm) { + Generate_DeoptimizationEntry(masm, DeoptimizeKind::kUnused); +} + namespace { // Restarts execution either at the current or next (in execution order) diff --git a/deps/v8/src/common/globals.h b/deps/v8/src/common/globals.h index bc9a6eb1c3c79c..1b9f9a94b4d9a7 100644 --- a/deps/v8/src/common/globals.h +++ b/deps/v8/src/common/globals.h @@ -522,11 +522,13 @@ constexpr int kNoDeoptimizationId = -1; // Deoptimize bailout kind: // - Eager: a check failed in the optimized code and deoptimization happens // immediately. +// - Unused: replaces "Soft" for ABI compatibility. // - Lazy: the code has been marked as dependent on some assumption which // is checked elsewhere and can trigger deoptimization the next time the // code is executed. enum class DeoptimizeKind : uint8_t { kEager, + kUnused, kLazy, }; constexpr DeoptimizeKind kFirstDeoptimizeKind = DeoptimizeKind::kEager; @@ -540,6 +542,8 @@ constexpr const char* ToString(DeoptimizeKind kind) { switch (kind) { case DeoptimizeKind::kEager: return "Eager"; + case DeoptimizeKind::kUnused: + return "Unused"; case DeoptimizeKind::kLazy: return "Lazy"; } diff --git a/deps/v8/src/deoptimizer/deoptimizer.cc b/deps/v8/src/deoptimizer/deoptimizer.cc index ed78a06b3590c2..c8f4b7139678e7 100644 --- a/deps/v8/src/deoptimizer/deoptimizer.cc +++ b/deps/v8/src/deoptimizer/deoptimizer.cc @@ -460,6 +460,8 @@ const char* Deoptimizer::MessageFor(DeoptimizeKind kind) { switch (kind) { case DeoptimizeKind::kEager: return "deopt-eager"; + case DeoptimizeKind::kUnused: + return "deopt-unused"; case DeoptimizeKind::kLazy: return "deopt-lazy"; } @@ -585,6 +587,8 @@ Builtin Deoptimizer::GetDeoptimizationEntry(DeoptimizeKind kind) { switch (kind) { case DeoptimizeKind::kEager: return Builtin::kDeoptimizationEntry_Eager; + case DeoptimizeKind::kUnused: + return Builtin::kDeoptimizationEntry_Unused; case DeoptimizeKind::kLazy: return Builtin::kDeoptimizationEntry_Lazy; } @@ -599,6 +603,9 @@ bool Deoptimizer::IsDeoptimizationEntry(Isolate* isolate, Address addr, case Builtin::kDeoptimizationEntry_Eager: *type_out = DeoptimizeKind::kEager; return true; + case Builtin::kDeoptimizationEntry_Unused: + *type_out = DeoptimizeKind::kUnused; + return true; case Builtin::kDeoptimizationEntry_Lazy: *type_out = DeoptimizeKind::kLazy; return true;