[riscv] Optimize ComputeCodeStartAddress func

We can only use auipc + add instr to get pc address.

Change-Id: I44d7dd1798c94d672bf506658c82c80de601a4af
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4039240
Reviewed-by: ji qiu <qiuji@iscas.ac.cn>
Commit-Queue: ji qiu <qiuji@iscas.ac.cn>
Auto-Submit: Yahan Lu <yahan@iscas.ac.cn>
Cr-Commit-Position: refs/heads/main@{#84415}
This commit is contained in:
Lu Yahan 2022-11-21 18:50:59 +08:00 committed by V8 LUCI CQ
parent f76262d87a
commit 8757293d7e

View File

@ -6171,17 +6171,9 @@ Register GetRegisterThatIsNotOneOf(Register reg1, Register reg2, Register reg3,
}
void TurboAssembler::ComputeCodeStartAddress(Register dst) {
// This push on ra and the pop below together ensure that we restore the
// register ra, which is needed while computing the code start address.
push(ra);
auipc(ra, 0);
addi(ra, ra, kInstrSize * 2); // ra = address of li
int pc = pc_offset();
li(dst, Operand(pc));
SubWord(dst, ra, dst);
pop(ra); // Restore ra
auto pc = -pc_offset();
auipc(dst, 0);
if(pc != 0) SubWord(dst, dst, pc);
}
void TurboAssembler::CallForDeoptimization(Builtin target, int, Label* exit,