Skip to content

Commit

Permalink
[deoptimizer] Remove soft deopts
Browse files Browse the repository at this point in the history
.. since they are the same as eager deopts (% an unused counter).

Fixed: v8:12765
Change-Id: I2be6210e476ead4ac6629a49259f28321e965867
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3565717
Reviewed-by: Tobias Tebbi <[email protected]>
Reviewed-by: Leszek Swirski <[email protected]>
Commit-Queue: Jakob Linke <[email protected]>
Cr-Commit-Position: refs/heads/main@{#79729}
  • Loading branch information
schuay authored and V8 LUCI CQ committed Apr 4, 2022
1 parent d936623 commit 1ff685d
Show file tree
Hide file tree
Showing 57 changed files with 153 additions and 236 deletions.
4 changes: 2 additions & 2 deletions 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 = 10 * kApiSystemPointerSize;
static const int kBuiltinTier0TableSize = 10 * kApiSystemPointerSize;
static const int kBuiltinTier0EntryTableSize = 9 * kApiSystemPointerSize;
static const int kBuiltinTier0TableSize = 9 * kApiSystemPointerSize;

// IsolateData layout guarantees.
static const int kIsolateCageBaseOffset = 0;
Expand Down
4 changes: 0 additions & 4 deletions src/builtins/arm/builtins-arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3537,10 +3537,6 @@ void Builtins::Generate_DeoptimizationEntry_Eager(MacroAssembler* masm) {
Generate_DeoptimizationEntry(masm, DeoptimizeKind::kEager);
}

void Builtins::Generate_DeoptimizationEntry_Soft(MacroAssembler* masm) {
Generate_DeoptimizationEntry(masm, DeoptimizeKind::kSoft);
}

void Builtins::Generate_DeoptimizationEntry_Lazy(MacroAssembler* masm) {
Generate_DeoptimizationEntry(masm, DeoptimizeKind::kLazy);
}
Expand Down
4 changes: 0 additions & 4 deletions src/builtins/arm64/builtins-arm64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4055,10 +4055,6 @@ void Builtins::Generate_DeoptimizationEntry_Eager(MacroAssembler* masm) {
Generate_DeoptimizationEntry(masm, DeoptimizeKind::kEager);
}

void Builtins::Generate_DeoptimizationEntry_Soft(MacroAssembler* masm) {
Generate_DeoptimizationEntry(masm, DeoptimizeKind::kSoft);
}

void Builtins::Generate_DeoptimizationEntry_Lazy(MacroAssembler* masm) {
Generate_DeoptimizationEntry(masm, DeoptimizeKind::kLazy);
}
Expand Down
1 change: 0 additions & 1 deletion src/builtins/builtins-definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ namespace internal {
#define BUILTIN_LIST_BASE_TIER0(CPP, TFJ, TFC, TFS, TFH, ASM) \
/* Deoptimization entries. */ \
ASM(DeoptimizationEntry_Eager, DeoptimizationEntry) \
ASM(DeoptimizationEntry_Soft, DeoptimizationEntry) \
ASM(DeoptimizationEntry_Lazy, DeoptimizationEntry) \
\
/* GC write barrier. */ \
Expand Down
4 changes: 0 additions & 4 deletions src/builtins/ia32/builtins-ia32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4150,10 +4150,6 @@ void Builtins::Generate_DeoptimizationEntry_Eager(MacroAssembler* masm) {
Generate_DeoptimizationEntry(masm, DeoptimizeKind::kEager);
}

void Builtins::Generate_DeoptimizationEntry_Soft(MacroAssembler* masm) {
Generate_DeoptimizationEntry(masm, DeoptimizeKind::kSoft);
}

void Builtins::Generate_DeoptimizationEntry_Lazy(MacroAssembler* masm) {
Generate_DeoptimizationEntry(masm, DeoptimizeKind::kLazy);
}
Expand Down
4 changes: 0 additions & 4 deletions src/builtins/x64/builtins-x64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4973,10 +4973,6 @@ void Builtins::Generate_DeoptimizationEntry_Eager(MacroAssembler* masm) {
Generate_DeoptimizationEntry(masm, DeoptimizeKind::kEager);
}

void Builtins::Generate_DeoptimizationEntry_Soft(MacroAssembler* masm) {
Generate_DeoptimizationEntry(masm, DeoptimizeKind::kSoft);
}

void Builtins::Generate_DeoptimizationEntry_Lazy(MacroAssembler* masm) {
Generate_DeoptimizationEntry(masm, DeoptimizeKind::kLazy);
}
Expand Down
5 changes: 2 additions & 3 deletions src/codegen/arm/macro-assembler-arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2648,9 +2648,8 @@ void TurboAssembler::CallForDeoptimization(Builtin target, int, Label* exit,
MemOperand(kRootRegister, IsolateData::BuiltinEntrySlotOffset(target)));
Call(ip);
DCHECK_EQ(SizeOfCodeGeneratedSince(exit),
(kind == DeoptimizeKind::kLazy)
? Deoptimizer::kLazyDeoptExitSize
: Deoptimizer::kNonLazyDeoptExitSize);
(kind == DeoptimizeKind::kLazy) ? Deoptimizer::kLazyDeoptExitSize
: Deoptimizer::kEagerDeoptExitSize);

// The above code must not emit constants either.
DCHECK(!has_pending_constants());
Expand Down
5 changes: 2 additions & 3 deletions src/codegen/arm64/macro-assembler-arm64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2219,9 +2219,8 @@ void TurboAssembler::CallForDeoptimization(
BlockPoolsScope scope(this);
bl(jump_deoptimization_entry_label);
DCHECK_EQ(SizeOfCodeGeneratedSince(exit),
(kind == DeoptimizeKind::kLazy)
? Deoptimizer::kLazyDeoptExitSize
: Deoptimizer::kNonLazyDeoptExitSize);
(kind == DeoptimizeKind::kLazy) ? Deoptimizer::kLazyDeoptExitSize
: Deoptimizer::kEagerDeoptExitSize);
}

void MacroAssembler::LoadStackLimit(Register destination, StackLimitKind kind) {
Expand Down
5 changes: 2 additions & 3 deletions src/codegen/ia32/macro-assembler-ia32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2033,9 +2033,8 @@ void TurboAssembler::CallForDeoptimization(Builtin target, int, Label* exit,
ASM_CODE_COMMENT(this);
CallBuiltin(target);
DCHECK_EQ(SizeOfCodeGeneratedSince(exit),
(kind == DeoptimizeKind::kLazy)
? Deoptimizer::kLazyDeoptExitSize
: Deoptimizer::kNonLazyDeoptExitSize);
(kind == DeoptimizeKind::kLazy) ? Deoptimizer::kLazyDeoptExitSize
: Deoptimizer::kEagerDeoptExitSize);
}

void TurboAssembler::Trap() { int3(); }
Expand Down
5 changes: 2 additions & 3 deletions src/codegen/loong64/macro-assembler-loong64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4087,9 +4087,8 @@ void TurboAssembler::CallForDeoptimization(Builtin target, int, Label* exit,
MemOperand(kRootRegister, IsolateData::BuiltinEntrySlotOffset(target)));
Call(t7);
DCHECK_EQ(SizeOfCodeGeneratedSince(exit),
(kind == DeoptimizeKind::kLazy)
? Deoptimizer::kLazyDeoptExitSize
: Deoptimizer::kNonLazyDeoptExitSize);
(kind == DeoptimizeKind::kLazy) ? Deoptimizer::kLazyDeoptExitSize
: Deoptimizer::kEagerDeoptExitSize);
}

void TurboAssembler::LoadCodeObjectEntry(Register destination,
Expand Down
5 changes: 2 additions & 3 deletions src/codegen/mips/macro-assembler-mips.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5571,9 +5571,8 @@ void TurboAssembler::CallForDeoptimization(Builtin target, int, Label* exit,
MemOperand(kRootRegister, IsolateData::BuiltinEntrySlotOffset(target)));
Call(t9);
DCHECK_EQ(SizeOfCodeGeneratedSince(exit),
(kind == DeoptimizeKind::kLazy)
? Deoptimizer::kLazyDeoptExitSize
: Deoptimizer::kNonLazyDeoptExitSize);
(kind == DeoptimizeKind::kLazy) ? Deoptimizer::kLazyDeoptExitSize
: Deoptimizer::kEagerDeoptExitSize);
}

void TurboAssembler::LoadCodeObjectEntry(Register destination,
Expand Down
5 changes: 2 additions & 3 deletions src/codegen/mips64/macro-assembler-mips64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6114,9 +6114,8 @@ void TurboAssembler::CallForDeoptimization(Builtin target, int, Label* exit,
MemOperand(kRootRegister, IsolateData::BuiltinEntrySlotOffset(target)));
Call(t9);
DCHECK_EQ(SizeOfCodeGeneratedSince(exit),
(kind == DeoptimizeKind::kLazy)
? Deoptimizer::kLazyDeoptExitSize
: Deoptimizer::kNonLazyDeoptExitSize);
(kind == DeoptimizeKind::kLazy) ? Deoptimizer::kLazyDeoptExitSize
: Deoptimizer::kEagerDeoptExitSize);
}

void TurboAssembler::LoadCodeObjectEntry(Register destination,
Expand Down
5 changes: 2 additions & 3 deletions src/codegen/ppc/macro-assembler-ppc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3727,9 +3727,8 @@ void TurboAssembler::CallForDeoptimization(Builtin target, int, Label* exit,
IsolateData::BuiltinEntrySlotOffset(target)));
Call(ip);
DCHECK_EQ(SizeOfCodeGeneratedSince(exit),
(kind == DeoptimizeKind::kLazy)
? Deoptimizer::kLazyDeoptExitSize
: Deoptimizer::kNonLazyDeoptExitSize);
(kind == DeoptimizeKind::kLazy) ? Deoptimizer::kLazyDeoptExitSize
: Deoptimizer::kEagerDeoptExitSize);
}

void TurboAssembler::ZeroExtByte(Register dst, Register src) {
Expand Down
5 changes: 2 additions & 3 deletions src/codegen/riscv64/macro-assembler-riscv64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4987,9 +4987,8 @@ void TurboAssembler::CallForDeoptimization(Builtin target, int, Label* exit,
MemOperand(kRootRegister, IsolateData::BuiltinEntrySlotOffset(target)));
Call(t6);
DCHECK_EQ(SizeOfCodeGeneratedSince(exit),
(kind == DeoptimizeKind::kLazy)
? Deoptimizer::kLazyDeoptExitSize
: Deoptimizer::kNonLazyDeoptExitSize);
(kind == DeoptimizeKind::kLazy) ? Deoptimizer::kLazyDeoptExitSize
: Deoptimizer::kEagerDeoptExitSize);
}

void TurboAssembler::LoadCodeObjectEntry(Register destination,
Expand Down
5 changes: 2 additions & 3 deletions src/codegen/s390/macro-assembler-s390.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4826,9 +4826,8 @@ void TurboAssembler::CallForDeoptimization(Builtin target, int, Label* exit,
IsolateData::BuiltinEntrySlotOffset(target)));
Call(ip);
DCHECK_EQ(SizeOfCodeGeneratedSince(exit),
(kind == DeoptimizeKind::kLazy)
? Deoptimizer::kLazyDeoptExitSize
: Deoptimizer::kNonLazyDeoptExitSize);
(kind == DeoptimizeKind::kLazy) ? Deoptimizer::kLazyDeoptExitSize
: Deoptimizer::kEagerDeoptExitSize);
}

void TurboAssembler::Trap() { stop(); }
Expand Down
5 changes: 2 additions & 3 deletions src/codegen/x64/macro-assembler-x64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3125,9 +3125,8 @@ void TurboAssembler::CallForDeoptimization(Builtin target, int, Label* exit,
// performance tuning which emits a different instruction sequence.
call(EntryFromBuiltinAsOperand(target));
DCHECK_EQ(SizeOfCodeGeneratedSince(exit),
(kind == DeoptimizeKind::kLazy)
? Deoptimizer::kLazyDeoptExitSize
: Deoptimizer::kNonLazyDeoptExitSize);
(kind == DeoptimizeKind::kLazy) ? Deoptimizer::kLazyDeoptExitSize
: Deoptimizer::kEagerDeoptExitSize);
}

void TurboAssembler::Trap() { int3(); }
Expand Down
14 changes: 6 additions & 8 deletions src/common/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -518,11 +518,8 @@ constexpr int kNoDeoptimizationId = -1;
// - 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.
// - Soft: similar to lazy deoptimization, but does not contribute to the
// total deopt count which can lead to disabling optimization for a function.
enum class DeoptimizeKind : uint8_t {
kEager,
kSoft,
kLazy,
};
constexpr DeoptimizeKind kFirstDeoptimizeKind = DeoptimizeKind::kEager;
Expand All @@ -532,16 +529,17 @@ constexpr int kDeoptimizeKindCount = static_cast<int>(kLastDeoptimizeKind) + 1;
inline size_t hash_value(DeoptimizeKind kind) {
return static_cast<size_t>(kind);
}
inline std::ostream& operator<<(std::ostream& os, DeoptimizeKind kind) {
constexpr const char* ToString(DeoptimizeKind kind) {
switch (kind) {
case DeoptimizeKind::kEager:
return os << "Eager";
case DeoptimizeKind::kSoft:
return os << "Soft";
return "Eager";
case DeoptimizeKind::kLazy:
return os << "Lazy";
return "Lazy";
}
}
inline std::ostream& operator<<(std::ostream& os, DeoptimizeKind kind) {
return os << ToString(kind);
}

// Indicates whether the lookup is related to sloppy-mode block-scoped
// function hoisting, and is a synthetic assignment for that.
Expand Down
3 changes: 1 addition & 2 deletions src/compiler/backend/arm64/code-generator-arm64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3308,8 +3308,7 @@ void CodeGenerator::PrepareForDeoptimizationExits(
__ ForceConstantPoolEmissionWithoutJump();
// We are conservative here, reserving sufficient space for the largest deopt
// kind.
DCHECK_GE(Deoptimizer::kLazyDeoptExitSize,
Deoptimizer::kNonLazyDeoptExitSize);
DCHECK_GE(Deoptimizer::kLazyDeoptExitSize, Deoptimizer::kEagerDeoptExitSize);
__ CheckVeneerPool(
false, false,
static_cast<int>(exits->size()) * Deoptimizer::kLazyDeoptExitSize);
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/backend/code-generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall(
++lazy_deopt_count_;
tasm()->BindExceptionHandler(exit->label());
} else {
++non_lazy_deopt_count_;
++eager_deopt_count_;
tasm()->bind(exit->label());
}
Builtin target = Deoptimizer::GetDeoptimizationEntry(deopt_kind);
Expand Down Expand Up @@ -898,7 +898,7 @@ Handle<DeoptimizationData> CodeGenerator::GenerateDeoptimizationData() {
data->SetOptimizationId(Smi::FromInt(info->optimization_id()));

data->SetDeoptExitStart(Smi::FromInt(deopt_exit_start_offset_));
data->SetNonLazyDeoptCount(Smi::FromInt(non_lazy_deopt_count_));
data->SetEagerDeoptCount(Smi::FromInt(eager_deopt_count_));
data->SetLazyDeoptCount(Smi::FromInt(lazy_deopt_count_));

if (info->has_shared_info()) {
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/backend/code-generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ class V8_EXPORT_PRIVATE CodeGenerator final : public GapResolver::Assembler {
ZoneVector<HandlerInfo> handlers_;
int next_deoptimization_id_ = 0;
int deopt_exit_start_offset_ = 0;
int non_lazy_deopt_count_ = 0;
int eager_deopt_count_ = 0;
int lazy_deopt_count_ = 0;
ZoneDeque<DeoptimizationExit*> deoptimization_exits_;
ZoneDeque<DeoptimizationLiteral> deoptimization_literals_;
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/backend/ppc/code-generator-ppc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4250,7 +4250,7 @@ void CodeGenerator::PrepareForDeoptimizationExits(
for (DeoptimizationExit* exit : deoptimization_exits_) {
total_size += (exit->kind() == DeoptimizeKind::kLazy)
? Deoptimizer::kLazyDeoptExitSize
: Deoptimizer::kNonLazyDeoptExitSize;
: Deoptimizer::kEagerDeoptExitSize;
}

__ CheckTrampolinePoolQuick(total_size);
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/backend/riscv64/code-generator-riscv64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4075,7 +4075,7 @@ void CodeGenerator::PrepareForDeoptimizationExits(
for (DeoptimizationExit* exit : deoptimization_exits_) {
total_size += (exit->kind() == DeoptimizeKind::kLazy)
? Deoptimizer::kLazyDeoptExitSize
: Deoptimizer::kNonLazyDeoptExitSize;
: Deoptimizer::kEagerDeoptExitSize;
}

__ CheckTrampolinePoolQuick(total_size);
Expand Down
Loading

0 comments on commit 1ff685d

Please sign in to comment.