Skip to content

Commit

Permalink
deps: make V8 10.2 ABI-compatible with 10.1
Browse files Browse the repository at this point in the history
Create an unused deopt kind to replace `DeoptimizeKind::kSoft`, which
was removed. This ensures that the layout of IsolateData doesn't change.

Refs: v8/v8@1ff685d

PR-URL: nodejs#42740
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
  • Loading branch information
targos authored and xtx1130 committed Apr 25, 2022
1 parent 09bbb56 commit 4baf048
Show file tree
Hide file tree
Showing 15 changed files with 56 additions and 3 deletions.
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
4 changes: 2 additions & 2 deletions deps/v8/include/v8-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions deps/v8/src/builtins/arm/builtins-arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions deps/v8/src/builtins/arm64/builtins-arm64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions deps/v8/src/builtins/builtins-definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down
4 changes: 4 additions & 0 deletions deps/v8/src/builtins/ia32/builtins-ia32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions deps/v8/src/builtins/loong64/builtins-loong64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions deps/v8/src/builtins/mips/builtins-mips.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions deps/v8/src/builtins/mips64/builtins-mips64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions deps/v8/src/builtins/ppc/builtins-ppc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions deps/v8/src/builtins/riscv64/builtins-riscv64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions deps/v8/src/builtins/s390/builtins-s390.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 4 additions & 0 deletions deps/v8/src/builtins/x64/builtins-x64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions deps/v8/src/common/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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";
}
Expand Down
7 changes: 7 additions & 0 deletions deps/v8/src/deoptimizer/deoptimizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down

0 comments on commit 4baf048

Please sign in to comment.