Commit f27d254a authored by Liu Yu's avatar Liu Yu Committed by V8 LUCI CQ

[mips][loong64] Modify the method of get a scratch register

Acquire a scratch register instead of passing scratch register
in JumpIfSmi and JumpIfNotSmi.

Change-Id: I21776e1cd9d19f0d55c25a5bb3f7efcc247c80e5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3135155Reviewed-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/main@{#76632}
parent 4dc425c5
......@@ -102,15 +102,11 @@ void BaselineAssembler::JumpIfNotRoot(Register value, RootIndex index,
}
void BaselineAssembler::JumpIfSmi(Register value, Label* target,
Label::Distance) {
ScratchRegisterScope temps(this);
Register temp = temps.AcquireScratch();
__ JumpIfSmi(value, target, temp);
__ JumpIfSmi(value, target);
}
void BaselineAssembler::JumpIfNotSmi(Register value, Label* target,
Label::Distance) {
ScratchRegisterScope temps(this);
Register temp = temps.AcquireScratch();
__ JumpIfNotSmi(value, target, temp);
__ JumpIfNotSmi(value, target);
}
void BaselineAssembler::CallBuiltin(Builtin builtin) {
......
......@@ -3643,16 +3643,18 @@ void TurboAssembler::SmiUntag(Register dst, const MemOperand& src) {
}
}
void TurboAssembler::JumpIfSmi(Register value, Label* smi_label,
Register scratch) {
void TurboAssembler::JumpIfSmi(Register value, Label* smi_label) {
DCHECK_EQ(0, kSmiTag);
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
andi(scratch, value, kSmiTagMask);
Branch(smi_label, eq, scratch, Operand(zero_reg));
}
void MacroAssembler::JumpIfNotSmi(Register value, Label* not_smi_label,
Register scratch) {
void MacroAssembler::JumpIfNotSmi(Register value, Label* not_smi_label) {
DCHECK_EQ(0, kSmiTag);
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
andi(scratch, value, kSmiTagMask);
Branch(not_smi_label, ne, scratch, Operand(zero_reg));
}
......
......@@ -664,7 +664,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
void Ceil_s(FPURegister fd, FPURegister fj);
// Jump the register contains a smi.
void JumpIfSmi(Register value, Label* smi_label, Register scratch = t7);
void JumpIfSmi(Register value, Label* smi_label);
void JumpIfEqual(Register a, int32_t b, Label* dest) {
UseScratchRegisterScope temps(this);
......@@ -994,7 +994,7 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
}
// Jump if the register contains a non-smi.
void JumpIfNotSmi(Register value, Label* not_smi_label, Register scratch);
void JumpIfNotSmi(Register value, Label* not_smi_label);
// Abort execution if argument is a smi, enabled via --debug-code.
void AssertNotSmi(Register object);
......
......@@ -4984,15 +4984,19 @@ void MacroAssembler::AssertStackIsAligned() {
}
void TurboAssembler::JumpIfSmi(Register value, Label* smi_label,
Register scratch, BranchDelaySlot bd) {
BranchDelaySlot bd) {
DCHECK_EQ(0, kSmiTag);
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
andi(scratch, value, kSmiTagMask);
Branch(bd, smi_label, eq, scratch, Operand(zero_reg));
}
void MacroAssembler::JumpIfNotSmi(Register value, Label* not_smi_label,
Register scratch, BranchDelaySlot bd) {
BranchDelaySlot bd) {
DCHECK_EQ(0, kSmiTag);
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
andi(scratch, value, kSmiTagMask);
Branch(bd, not_smi_label, ne, scratch, Operand(zero_reg));
}
......
......@@ -795,7 +795,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
// Jump the register contains a smi.
void JumpIfSmi(Register value, Label* smi_label,
Register scratch = kScratchReg, BranchDelaySlot bd = PROTECT);
BranchDelaySlot bd = PROTECT);
void JumpIfEqual(Register a, int32_t b, Label* dest) {
li(kScratchReg, Operand(b));
......@@ -1106,7 +1106,7 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
}
// Jump if the register contains a non-smi.
void JumpIfNotSmi(Register value, Label* not_smi_label, Register scratch = at,
void JumpIfNotSmi(Register value, Label* not_smi_label,
BranchDelaySlot bd = PROTECT);
// Abort execution if argument is a smi, enabled via --debug-code.
......
......@@ -5529,15 +5529,19 @@ void TurboAssembler::SmiUntag(Register dst, const MemOperand& src) {
}
void TurboAssembler::JumpIfSmi(Register value, Label* smi_label,
Register scratch, BranchDelaySlot bd) {
BranchDelaySlot bd) {
DCHECK_EQ(0, kSmiTag);
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
andi(scratch, value, kSmiTagMask);
Branch(bd, smi_label, eq, scratch, Operand(zero_reg));
}
void MacroAssembler::JumpIfNotSmi(Register value, Label* not_smi_label,
Register scratch, BranchDelaySlot bd) {
BranchDelaySlot bd) {
DCHECK_EQ(0, kSmiTag);
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
andi(scratch, value, kSmiTagMask);
Branch(bd, not_smi_label, ne, scratch, Operand(zero_reg));
}
......
......@@ -805,7 +805,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
void MSARoundD(MSARegister dst, MSARegister src, FPURoundingMode mode);
// Jump the register contains a smi.
void JumpIfSmi(Register value, Label* smi_label, Register scratch = at,
void JumpIfSmi(Register value, Label* smi_label,
BranchDelaySlot bd = PROTECT);
void JumpIfEqual(Register a, int32_t b, Label* dest) {
......@@ -1180,7 +1180,7 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
}
// Jump if the register contains a non-smi.
void JumpIfNotSmi(Register value, Label* not_smi_label, Register scratch = at,
void JumpIfNotSmi(Register value, Label* not_smi_label,
BranchDelaySlot bd = PROTECT);
// Abort execution if argument is a smi, enabled via --debug-code.
......
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