Commit ca4bf755 authored by Junliang Yan's avatar Junliang Yan Committed by V8 LUCI CQ

ppc: Prevent trampoline emission on deoptimization table generation

The deoptimization table needs to be continuously, so we need to block
trampoline pool emission during the whole process.

bug: v8:11759
Change-Id: Ie5e0ffe27dc8e6cdb18985dc2cf26bdadeff318f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2881918
Commit-Queue: Junliang Yan <junyan@redhat.com>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74506}
parent 0adb40ef
...@@ -195,6 +195,12 @@ class Assembler : public AssemblerBase { ...@@ -195,6 +195,12 @@ class Assembler : public AssemblerBase {
void MaybeEmitOutOfLineConstantPool() { EmitConstantPool(); } void MaybeEmitOutOfLineConstantPool() { EmitConstantPool(); }
inline void CheckTrampolinePoolQuick(int extra_space = 0) {
if (pc_offset() >= next_trampoline_check_ - extra_space) {
CheckTrampolinePool();
}
}
// Label operations & relative jumps (PPUM Appendix D) // Label operations & relative jumps (PPUM Appendix D)
// //
// Takes a branch opcode (cc) and a label (L) and generates // Takes a branch opcode (cc) and a label (L) and generates
...@@ -1334,12 +1340,6 @@ class Assembler : public AssemblerBase { ...@@ -1334,12 +1340,6 @@ class Assembler : public AssemblerBase {
} }
inline void UntrackBranch(); inline void UntrackBranch();
void CheckTrampolinePoolQuick() {
if (pc_offset() >= next_trampoline_check_) {
CheckTrampolinePool();
}
}
// Instruction generation // Instruction generation
void a_form(Instr instr, DoubleRegister frt, DoubleRegister fra, void a_form(Instr instr, DoubleRegister frt, DoubleRegister fra,
DoubleRegister frb, RCBit r); DoubleRegister frb, RCBit r);
......
...@@ -416,23 +416,29 @@ void CodeGenerator::AssembleCode() { ...@@ -416,23 +416,29 @@ void CodeGenerator::AssembleCode() {
std::sort(deoptimization_exits_.begin(), deoptimization_exits_.end(), cmp); std::sort(deoptimization_exits_.begin(), deoptimization_exits_.end(), cmp);
} }
for (DeoptimizationExit* exit : deoptimization_exits_) { {
if (exit->emitted()) continue; #ifdef V8_TARGET_ARCH_PPC64
if (Deoptimizer::kSupportsFixedDeoptExitSizes) { v8::internal::Assembler::BlockTrampolinePoolScope block_trampoline_pool(
exit->set_deoptimization_id(next_deoptimization_id_++); tasm());
} #endif
result_ = AssembleDeoptimizerCall(exit); for (DeoptimizationExit* exit : deoptimization_exits_) {
if (result_ != kSuccess) return; if (exit->emitted()) continue;
if (Deoptimizer::kSupportsFixedDeoptExitSizes) {
// UpdateDeoptimizationInfo expects lazy deopts to be visited in pc_offset exit->set_deoptimization_id(next_deoptimization_id_++);
// order, which is always the case since they are added to }
// deoptimization_exits_ in that order, and the optional sort operation result_ = AssembleDeoptimizerCall(exit);
// above preserves that order. if (result_ != kSuccess) return;
if (exit->kind() == DeoptimizeKind::kLazy) {
int trampoline_pc = exit->label()->pos(); // UpdateDeoptimizationInfo expects lazy deopts to be visited in pc_offset
last_updated = safepoints()->UpdateDeoptimizationInfo( // order, which is always the case since they are added to
exit->pc_offset(), trampoline_pc, last_updated, // deoptimization_exits_ in that order, and the optional sort operation
exit->deoptimization_id()); // above preserves that order.
if (exit->kind() == DeoptimizeKind::kLazy) {
int trampoline_pc = exit->label()->pos();
last_updated = safepoints()->UpdateDeoptimizationInfo(
exit->pc_offset(), trampoline_pc, last_updated,
exit->deoptimization_id());
}
} }
} }
......
...@@ -4296,7 +4296,15 @@ void CodeGenerator::FinishCode() {} ...@@ -4296,7 +4296,15 @@ void CodeGenerator::FinishCode() {}
void CodeGenerator::PrepareForDeoptimizationExits( void CodeGenerator::PrepareForDeoptimizationExits(
ZoneDeque<DeoptimizationExit*>* exits) { ZoneDeque<DeoptimizationExit*>* exits) {
// __ EmitConstantPool(); int total_size = 0;
for (DeoptimizationExit* exit : deoptimization_exits_) {
total_size += (exit->kind() == DeoptimizeKind::kLazy)
? Deoptimizer::kLazyDeoptExitSize
: Deoptimizer::kNonLazyDeoptExitSize;
}
__ CheckTrampolinePoolQuick(total_size);
DCHECK(Deoptimizer::kSupportsFixedDeoptExitSizes);
} }
void CodeGenerator::AssembleMove(InstructionOperand* source, void CodeGenerator::AssembleMove(InstructionOperand* source,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment