| Index: src/mips64/code-stubs-mips64.cc
|
| diff --git a/src/mips64/code-stubs-mips64.cc b/src/mips64/code-stubs-mips64.cc
|
| index af13405e09fa62e7374ccd8703be01f901e07387..36dfdc64594ffdea136c769482fb87a49753127a 100644
|
| --- a/src/mips64/code-stubs-mips64.cc
|
| +++ b/src/mips64/code-stubs-mips64.cc
|
| @@ -1123,20 +1123,23 @@ 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 numInstructionsToJump;
|
| 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) {
|
| + numInstructionsToJump = 4;
|
| + __ addiupc(ra, numInstructionsToJump + 1);
|
| + } else {
|
| + numInstructionsToJump = 5;
|
| + // 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, numInstructionsToJump * 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.
|
| @@ -1148,7 +1151,7 @@ void CEntryStub::Generate(MacroAssembler* masm) {
|
| // Set up sp in the delay slot.
|
| __ daddiu(sp, sp, -kCArgsSlotsSize);
|
| // Make sure the stored 'ra' points to this position.
|
| - DCHECK_EQ(kNumInstructionsToJump,
|
| + DCHECK_EQ(numInstructionsToJump,
|
| masm->InstructionsGeneratedSince(&find_ra));
|
| }
|
| if (result_size() > 2) {
|
|
|