Index: src/mips/code-stubs-mips.cc |
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc |
index aab8d08e3141df0f1ef90bf6183138c58832398d..51162171a2ba992f1746a411cd65b60f650026f1 100644 |
--- a/src/mips/code-stubs-mips.cc |
+++ b/src/mips/code-stubs-mips.cc |
@@ -1125,20 +1125,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; |
- __ Addu(ra, ra, kNumInstructionsToJump * kPointerSize); |
+ if (kArchVariant >= kMips32r6) { |
+ __ 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. |
+ __ Addu(ra, ra, kNumInstructionsToJump * Instruction::kInstrSize); |
+ } |
+ __ bind(&find_ra); |
+ |
// This spot was reserved in EnterExitFrame. |
__ sw(ra, MemOperand(sp, result_stack_size)); |
// Stack space reservation moved to the branch delay slot below. |