| Index: src/mips/codegen-mips.cc
|
| diff --git a/src/mips/codegen-mips.cc b/src/mips/codegen-mips.cc
|
| index 5c847fc8f6227e7896aaacb66163eb244dd59764..8737dee4bdb9d349dfcd7000edd203b5550ff5d9 100644
|
| --- a/src/mips/codegen-mips.cc
|
| +++ b/src/mips/codegen-mips.cc
|
| @@ -627,8 +627,8 @@ void Code::GetCodeAgeAndParity(byte* sequence, Age* age,
|
| *age = kNoAge;
|
| *parity = NO_MARKING_PARITY;
|
| } else {
|
| - Address target_address = Memory::Address_at(
|
| - sequence + Assembler::kInstrSize * (kNoCodeAgeSequenceLength - 1));
|
| + Address target_address = Assembler::target_address_at(
|
| + sequence + Assembler::kInstrSize);
|
| Code* stub = GetCodeFromTargetAddress(target_address);
|
| GetCodeAgeAndParity(stub, age, parity);
|
| }
|
| @@ -646,17 +646,19 @@ void Code::PatchPlatformCodeAge(byte* sequence,
|
| } else {
|
| Code* stub = GetCodeAgeStub(age, parity);
|
| CodePatcher patcher(sequence, young_length / Assembler::kInstrSize);
|
| - // Mark this code sequence for FindPlatformCodeAgeSequence()
|
| + // Mark this code sequence for FindPlatformCodeAgeSequence().
|
| patcher.masm()->nop(Assembler::CODE_AGE_MARKER_NOP);
|
| - // Save the function's original return address
|
| - // (it will be clobbered by Call(t9))
|
| - patcher.masm()->mov(at, ra);
|
| - // Load the stub address to t9 and call it
|
| - patcher.masm()->li(t9,
|
| - Operand(reinterpret_cast<uint32_t>(stub->instruction_start())));
|
| - patcher.masm()->Call(t9);
|
| - // Record the stub address in the empty space for GetCodeAgeAndParity()
|
| - patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start()));
|
| +
|
| + // Load the stub address to t9 and call it,
|
| + // GetCodeAgeAndParity() extracts the stub address from this instruction.
|
| + patcher.masm()->li(
|
| + t9,
|
| + Operand(reinterpret_cast<uint32_t>(stub->instruction_start())),
|
| + CONSTANT_SIZE);
|
| + patcher.masm()->nop(); // Prevent jalr to jal optimization.
|
| + patcher.masm()->jalr(t9, a0);
|
| + patcher.masm()->nop(); // Branch delay slot nop.
|
| + patcher.masm()->nop(); // Pad the empty space.
|
| }
|
| }
|
|
|
|
|