Commit 72600c8a authored by QiuJi's avatar QiuJi Committed by V8 LUCI CQ

[riscv64] Use BranchShort to generate directly branch.

This also fixes a little mistake from
https://chromium-review.googlesource.com/c/v8/v8/+/2992914.
The label must be far here.

Change-Id: Ie53cb3713b1b5db6c10e4ce6ed177a510da847f5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3031897Reviewed-by: 's avatarBrice Dobry <brice.dobry@futurewei.com>
Reviewed-by: 's avatarJi Qiu <qiuji@iscas.ac.cn>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Auto-Submit: Ji Qiu <qiuji@iscas.ac.cn>
Cr-Commit-Position: refs/heads/master@{#75832}
parent d44f2729
...@@ -2613,7 +2613,7 @@ void TurboAssembler::Branch(Label* L, Condition cond, Register rs, ...@@ -2613,7 +2613,7 @@ void TurboAssembler::Branch(Label* L, Condition cond, Register rs,
} }
} }
} else { } else {
if (is_trampoline_emitted()) { if (is_trampoline_emitted() && near_jump == Label::Distance::kFar) {
if (cond != cc_always) { if (cond != cc_always) {
Label skip; Label skip;
Condition neg_cond = NegateCondition(cond); Condition neg_cond = NegateCondition(cond);
...@@ -3934,7 +3934,7 @@ void TurboAssembler::Assert(Condition cc, AbortReason reason, Register rs, ...@@ -3934,7 +3934,7 @@ void TurboAssembler::Assert(Condition cc, AbortReason reason, Register rs,
void TurboAssembler::Check(Condition cc, AbortReason reason, Register rs, void TurboAssembler::Check(Condition cc, AbortReason reason, Register rs,
Operand rt) { Operand rt) {
Label L; Label L;
Branch(&L, cc, rs, rt); BranchShort(&L, cc, rs, rt);
Abort(reason); Abort(reason);
// Will not return here. // Will not return here.
bind(&L); bind(&L);
...@@ -4196,7 +4196,7 @@ void MacroAssembler::AssertStackIsAligned() { ...@@ -4196,7 +4196,7 @@ void MacroAssembler::AssertStackIsAligned() {
UseScratchRegisterScope temps(this); UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire(); Register scratch = temps.Acquire();
andi(scratch, sp, frame_alignment_mask); andi(scratch, sp, frame_alignment_mask);
Branch(&alignment_as_expected, eq, scratch, Operand(zero_reg)); BranchShort(&alignment_as_expected, eq, scratch, Operand(zero_reg));
} }
// Don't use Check here, as it will call Runtime_Abort re-entering here. // Don't use Check here, as it will call Runtime_Abort re-entering here.
ebreak(); ebreak();
...@@ -4317,13 +4317,13 @@ void MacroAssembler::AssertGeneratorObject(Register object) { ...@@ -4317,13 +4317,13 @@ void MacroAssembler::AssertGeneratorObject(Register object) {
Label done; Label done;
// Check if JSGeneratorObject // Check if JSGeneratorObject
Branch(&done, eq, kScratchReg, Operand(JS_GENERATOR_OBJECT_TYPE)); BranchShort(&done, eq, kScratchReg, Operand(JS_GENERATOR_OBJECT_TYPE));
// Check if JSAsyncFunctionObject (See MacroAssembler::CompareInstanceType) // Check if JSAsyncFunctionObject (See MacroAssembler::CompareInstanceType)
Branch(&done, eq, kScratchReg, Operand(JS_ASYNC_FUNCTION_OBJECT_TYPE)); BranchShort(&done, eq, kScratchReg, Operand(JS_ASYNC_FUNCTION_OBJECT_TYPE));
// Check if JSAsyncGeneratorObject // Check if JSAsyncGeneratorObject
Branch(&done, eq, kScratchReg, Operand(JS_ASYNC_GENERATOR_OBJECT_TYPE)); BranchShort(&done, eq, kScratchReg, Operand(JS_ASYNC_GENERATOR_OBJECT_TYPE));
Abort(AbortReason::kOperandIsNotAGeneratorObject); Abort(AbortReason::kOperandIsNotAGeneratorObject);
...@@ -4336,7 +4336,7 @@ void MacroAssembler::AssertUndefinedOrAllocationSite(Register object, ...@@ -4336,7 +4336,7 @@ void MacroAssembler::AssertUndefinedOrAllocationSite(Register object,
Label done_checking; Label done_checking;
AssertNotSmi(object); AssertNotSmi(object);
LoadRoot(scratch, RootIndex::kUndefinedValue); LoadRoot(scratch, RootIndex::kUndefinedValue);
Branch(&done_checking, eq, object, Operand(scratch)); BranchShort(&done_checking, eq, object, Operand(scratch));
GetObjectType(object, scratch, scratch); GetObjectType(object, scratch, scratch);
Assert(eq, AbortReason::kExpectedUndefinedOrCell, scratch, Assert(eq, AbortReason::kExpectedUndefinedOrCell, scratch,
Operand(ALLOCATION_SITE_TYPE)); Operand(ALLOCATION_SITE_TYPE));
...@@ -4510,7 +4510,7 @@ void TurboAssembler::CallCFunctionHelper(Register function, ...@@ -4510,7 +4510,7 @@ void TurboAssembler::CallCFunctionHelper(Register function,
UseScratchRegisterScope temps(this); UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire(); Register scratch = temps.Acquire();
And(scratch, sp, Operand(frame_alignment_mask)); And(scratch, sp, Operand(frame_alignment_mask));
Branch(&alignment_as_expected, eq, scratch, Operand(zero_reg)); BranchShort(&alignment_as_expected, eq, scratch, Operand(zero_reg));
} }
// Don't use Check here, as it will call Runtime_Abort possibly // Don't use Check here, as it will call Runtime_Abort possibly
// re-entering here. // re-entering here.
......
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