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

Port: 7bdb0fbb81

Bug: v8:10582

Change-Id: I2a2227ddc45b86f7ad496b524514db96f423b185
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2598463
Reviewed-by: Zhao 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}
This commit is contained in:
LiuYu 2020-12-19 16:20:58 +08:00 committed by Commit Bot
parent 391941911d
commit 39abe9f608
10 changed files with 44 additions and 9 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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,

View File

@ -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,