Index: src/mips64/code-stubs-mips64.cc |
diff --git a/src/mips64/code-stubs-mips64.cc b/src/mips64/code-stubs-mips64.cc |
index 996ffc8ae343d7d9433352f9345808ca79bf8de7..959fe67d48f4b5219c49650befa1ef7e5ad94e0a 100644 |
--- a/src/mips64/code-stubs-mips64.cc |
+++ b/src/mips64/code-stubs-mips64.cc |
@@ -1123,20 +1123,21 @@ void CEntryStub::Generate(MacroAssembler* masm) { |
// we can store the address on the stack to be able to find it again and |
// we never have to restore it, because it will not change. |
{ Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm); |
- // This branch-and-link sequence is needed to find the current PC on mips, |
- // saved to the ra register. |
- // Use masm-> here instead of the double-underscore macro since extra |
- // coverage code can interfere with the proper calculation of ra. |
+ int kNumInstructionsToJump = 4; |
Label find_ra; |
- __ bal(&find_ra); // bal exposes branch delay slot. |
- __ nop(); |
- __ bind(&find_ra); |
- |
// Adjust the value in ra to point to the correct return location, 2nd |
// instruction past the real call into C code (the jalr(t9)), and push it. |
// This is the return address of the exit frame. |
- const int kNumInstructionsToJump = 5; |
- __ Daddu(ra, ra, kNumInstructionsToJump * kInt32Size); |
+ if (kArchVariant >= kMips64r6) { |
+ __ addiupc(ra, kNumInstructionsToJump + 1); |
+ } else { |
+ // This branch-and-link sequence is needed to find the current PC on mips |
+ // before r6, saved to the ra register. |
+ __ bal(&find_ra); // bal exposes branch delay slot. |
+ __ Daddu(ra, ra, kNumInstructionsToJump * Instruction::kInstrSize); |
+ } |
+ __ bind(&find_ra); |
+ |
// This spot was reserved in EnterExitFrame. |
__ sd(ra, MemOperand(sp, result_stack_size)); |
// Stack space reservation moved to the branch delay slot below. |