[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:
parent
f76262d87a
commit
8757293d7e
@ -6171,17 +6171,9 @@ Register GetRegisterThatIsNotOneOf(Register reg1, Register reg2, Register reg3,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TurboAssembler::ComputeCodeStartAddress(Register dst) {
|
void TurboAssembler::ComputeCodeStartAddress(Register dst) {
|
||||||
// This push on ra and the pop below together ensure that we restore the
|
auto pc = -pc_offset();
|
||||||
// register ra, which is needed while computing the code start address.
|
auipc(dst, 0);
|
||||||
push(ra);
|
if(pc != 0) SubWord(dst, dst, pc);
|
||||||
|
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TurboAssembler::CallForDeoptimization(Builtin target, int, Label* exit,
|
void TurboAssembler::CallForDeoptimization(Builtin target, int, Label* exit,
|
||||||
|
Loading…
Reference in New Issue
Block a user