Commit 39abe9f6 authored by LiuYu's avatar LiuYu Committed by Commit Bot

[mips][Turboprop] Move dynamic check maps immediate args to deopt exit.

Port: 7bdb0fbb

Bug: v8:10582

Change-Id: I2a2227ddc45b86f7ad496b524514db96f423b185
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2598463Reviewed-by: 's avatarZhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Auto-Submit: Liu yu <liuyu@loongson.cn>
Cr-Commit-Position: refs/heads/master@{#71843}
parent 39194191
......@@ -3858,6 +3858,19 @@ void Builtins::Generate_DynamicCheckMapsTrampoline(MacroAssembler* masm) {
// to save all CallerSaved registers too.
if (FLAG_debug_code) registers |= kJSCallerSaved;
__ SaveRegisters(registers);
// Load the immediate arguments from the deopt exit to pass to the builtin.
Register slot_arg =
descriptor.GetRegisterParameter(DynamicCheckMapsDescriptor::kSlot);
Register handler_arg =
descriptor.GetRegisterParameter(DynamicCheckMapsDescriptor::kHandler);
__ Lw(handler_arg, MemOperand(fp, CommonFrameConstants::kCallerPCOffset));
__ Lw(slot_arg, MemOperand(handler_arg,
Deoptimizer::kEagerWithResumeImmedArgs1PcOffset));
__ Lw(
handler_arg,
MemOperand(handler_arg, Deoptimizer::kEagerWithResumeImmedArgs2PcOffset));
__ Call(BUILTIN_CODE(masm->isolate(), DynamicCheckMaps),
RelocInfo::CODE_TARGET);
......
......@@ -3420,6 +3420,18 @@ void Builtins::Generate_DynamicCheckMapsTrampoline(MacroAssembler* masm) {
// to save all CallerSaved registers too.
if (FLAG_debug_code) registers |= kJSCallerSaved;
__ SaveRegisters(registers);
// Load the immediate arguments from the deopt exit to pass to the builtin.
Register slot_arg =
descriptor.GetRegisterParameter(DynamicCheckMapsDescriptor::kSlot);
Register handler_arg =
descriptor.GetRegisterParameter(DynamicCheckMapsDescriptor::kHandler);
__ Ld(handler_arg, MemOperand(fp, CommonFrameConstants::kCallerPCOffset));
__ Uld(slot_arg, MemOperand(handler_arg,
Deoptimizer::kEagerWithResumeImmedArgs1PcOffset));
__ Uld(
handler_arg,
MemOperand(handler_arg, Deoptimizer::kEagerWithResumeImmedArgs2PcOffset));
__ Call(BUILTIN_CODE(masm->isolate(), DynamicCheckMaps),
RelocInfo::CODE_TARGET);
......
......@@ -5559,7 +5559,7 @@ void TurboAssembler::CallForDeoptimization(Builtins::Name target, int,
if (kind == DeoptimizeKind::kEagerWithResume) {
Branch(ret);
DCHECK_EQ(SizeOfCodeGeneratedSince(exit),
Deoptimizer::kEagerWithResumeDeoptExitSize);
Deoptimizer::kEagerWithResumeBeforeArgsSize);
}
}
......
......@@ -5979,7 +5979,7 @@ void TurboAssembler::CallForDeoptimization(Builtins::Name target, int,
if (kind == DeoptimizeKind::kEagerWithResume) {
Branch(ret);
DCHECK_EQ(SizeOfCodeGeneratedSince(exit),
Deoptimizer::kEagerWithResumeDeoptExitSize);
Deoptimizer::kEagerWithResumeBeforeArgsSize);
}
}
......
......@@ -867,7 +867,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
break;
case kArchDeoptimize: {
DeoptimizationExit* exit =
BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore());
BuildTranslation(instr, -1, 0, 0, OutputFrameStateCombine::Ignore());
__ Branch(exit->label());
break;
}
......
......@@ -846,7 +846,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
break;
case kArchDeoptimize: {
DeoptimizationExit* exit =
BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore());
BuildTranslation(instr, -1, 0, 0, OutputFrameStateCombine::Ignore());
__ Branch(exit->label());
break;
}
......@@ -1602,7 +1602,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
bool set_overflow_to_min_i64 = MiscField::decode(instr->opcode());
bool load_status = instr->OutputCount() > 1;
DCHECK_IMPLIES(set_overflow_to_min_i64, i.OutputCount() == 1);
DCHECK_IMPLIES(set_overflow_to_min_i64, instr->OutputCount() == 1);
if (load_status) {
// Save FCSR.
__ cfc1(tmp_fcsr, FCSR);
......
......@@ -10,7 +10,12 @@ namespace internal {
const bool Deoptimizer::kSupportsFixedDeoptExitSizes = true;
const int Deoptimizer::kNonLazyDeoptExitSize = 3 * kInstrSize;
const int Deoptimizer::kLazyDeoptExitSize = 3 * kInstrSize;
const int Deoptimizer::kEagerWithResumeDeoptExitSize = 5 * kInstrSize;
const int Deoptimizer::kEagerWithResumeBeforeArgsSize = 5 * kInstrSize;
const int Deoptimizer::kEagerWithResumeDeoptExitSize =
kEagerWithResumeBeforeArgsSize + 2 * kSystemPointerSize;
const int Deoptimizer::kEagerWithResumeImmedArgs1PcOffset = 2 * kInstrSize;
const int Deoptimizer::kEagerWithResumeImmedArgs2PcOffset =
2 * kInstrSize + kSystemPointerSize;
// Maximum size of a table entry generated below.
#ifdef _MIPS_ARCH_MIPS32R6
......
......@@ -10,7 +10,12 @@ namespace internal {
const bool Deoptimizer::kSupportsFixedDeoptExitSizes = true;
const int Deoptimizer::kNonLazyDeoptExitSize = 3 * kInstrSize;
const int Deoptimizer::kLazyDeoptExitSize = 3 * kInstrSize;
const int Deoptimizer::kEagerWithResumeDeoptExitSize = 5 * kInstrSize;
const int Deoptimizer::kEagerWithResumeBeforeArgsSize = 5 * kInstrSize;
const int Deoptimizer::kEagerWithResumeDeoptExitSize =
kEagerWithResumeBeforeArgsSize + 2 * kSystemPointerSize;
const int Deoptimizer::kEagerWithResumeImmedArgs1PcOffset = 2 * kInstrSize;
const int Deoptimizer::kEagerWithResumeImmedArgs2PcOffset =
2 * kInstrSize + kSystemPointerSize;
// Maximum size of a table entry generated below.
#ifdef _MIPS_ARCH_MIPS64R6
......
......@@ -1354,7 +1354,7 @@ TEST(DeoptExitSizeIsFixed) {
masm.CallForDeoptimization(target, 42, &before_exit, kind, &before_exit,
nullptr);
CHECK_EQ(masm.SizeOfCodeGeneratedSince(&before_exit),
Deoptimizer::kEagerWithResumeDeoptExitSize);
Deoptimizer::kEagerWithResumeBeforeArgsSize);
} else {
Builtins::Name target = Deoptimizer::GetDeoptimizationEntry(kind);
masm.CallForDeoptimization(target, 42, &before_exit, kind, &before_exit,
......
......@@ -1706,7 +1706,7 @@ TEST(DeoptExitSizeIsFixed) {
masm.CallForDeoptimization(target, 42, &before_exit, kind, &before_exit,
nullptr);
CHECK_EQ(masm.SizeOfCodeGeneratedSince(&before_exit),
Deoptimizer::kEagerWithResumeDeoptExitSize);
Deoptimizer::kEagerWithResumeBeforeArgsSize);
} else {
Builtins::Name target = Deoptimizer::GetDeoptimizationEntry(kind);
masm.CallForDeoptimization(target, 42, &before_exit, kind, &before_exit,
......
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