Index: src/mips/assembler-mips-inl.h |
diff --git a/src/mips/assembler-mips-inl.h b/src/mips/assembler-mips-inl.h |
index 215c0efd886a9e782036dcafd5d3001e0ad76e5d..c843cc8663e61db90fc3e123b642c556ed98da08 100644 |
--- a/src/mips/assembler-mips-inl.h |
+++ b/src/mips/assembler-mips-inl.h |
@@ -121,8 +121,17 @@ Address RelocInfo::target_address_address() { |
// place, ready to be patched with the target. After jump optimization, |
// that is the address of the instruction that follows J/JAL/JR/JALR |
// instruction. |
- return reinterpret_cast<Address>( |
- pc_ + Assembler::kInstructionsFor32BitConstant * Assembler::kInstrSize); |
+ if (IsMipsArchVariant(kMips32r6)) { |
+ // On R6 we don't move to the end of the instructions to be patched, but one |
+ // instruction before, because if these instructions are at the end of the |
+ // code object it can cause errors in the deserializer. |
+ return reinterpret_cast<Address>( |
+ pc_ + |
+ (Assembler::kInstructionsFor32BitConstant - 1) * Assembler::kInstrSize); |
+ } else { |
+ return reinterpret_cast<Address>( |
+ pc_ + Assembler::kInstructionsFor32BitConstant * Assembler::kInstrSize); |
+ } |
} |