Index: src/mips/macro-assembler-mips.cc |
diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc |
index ab97480918e5d920f8f7297a91bab7fd630ea913..71cda1514fc7d02c0328295dfaac43b731afe291 100644 |
--- a/src/mips/macro-assembler-mips.cc |
+++ b/src/mips/macro-assembler-mips.cc |
@@ -3102,18 +3102,36 @@ void MacroAssembler::BranchLong(Label* L, BranchDelaySlot bdslot) { |
BlockTrampolinePoolScope block_trampoline_pool(this); |
uint32_t imm32; |
imm32 = jump_address(L); |
- { |
- BlockGrowBufferScope block_buf_growth(this); |
- // Buffer growth (and relocation) must be blocked for internal references |
- // until associated instructions are emitted and available to be patched. |
- RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE_ENCODED); |
- lui(at, (imm32 & kHiMask) >> kLuiShift); |
- ori(at, at, (imm32 & kImm16Mask)); |
+ if (IsMipsArchVariant(kMips32r6) && bdslot != USE_DELAY_SLOT) { |
+ and_(at, at, at); |
paul.l...
2016/01/11 22:34:57
What's the reason for this and()? If it needs to b
miran.karic
2016/02/18 08:38:05
Done.
|
+ uint32_t lui_offset, jic_offset; |
+ unpackTargetAddressUnsigned(imm32, lui_offset, jic_offset); |
+ { |
+ BlockGrowBufferScope block_buf_growth(this); |
+ // Buffer growth (and relocation) must be blocked for internal |
+ // references until associated instructions are emitted and |
+ // available to be patched. |
+ RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE_ENCODED); |
+ lui(at, lui_offset); |
+ jic(at, jic_offset); |
+ } |
+ CheckBuffer(); |
+ } else { |
+ { |
+ BlockGrowBufferScope block_buf_growth(this); |
+ // Buffer growth (and relocation) must be blocked for internal |
+ // references |
+ // until associated instructions are emitted and available to be |
+ // patched. |
+ RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE_ENCODED); |
+ lui(at, (imm32 & kHiMask) >> kLuiShift); |
+ ori(at, at, (imm32 & kImm16Mask)); |
+ } |
+ CheckBuffer(); |
+ jr(at); |
+ // Emit a nop in the branch delay slot if required. |
+ if (bdslot == PROTECT) nop(); |
} |
- jr(at); |
- |
- // Emit a nop in the branch delay slot if required. |
- if (bdslot == PROTECT) nop(); |
} |
} |
@@ -3126,18 +3144,34 @@ void MacroAssembler::BranchAndLinkLong(Label* L, BranchDelaySlot bdslot) { |
BlockTrampolinePoolScope block_trampoline_pool(this); |
uint32_t imm32; |
imm32 = jump_address(L); |
- { |
- BlockGrowBufferScope block_buf_growth(this); |
- // Buffer growth (and relocation) must be blocked for internal references |
- // until associated instructions are emitted and available to be patched. |
- RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE_ENCODED); |
- lui(at, (imm32 & kHiMask) >> kLuiShift); |
- ori(at, at, (imm32 & kImm16Mask)); |
+ if (IsMipsArchVariant(kMips32r6) && bdslot != USE_DELAY_SLOT) { |
+ uint32_t lui_offset, jic_offset; |
+ unpackTargetAddressUnsigned(imm32, lui_offset, jic_offset); |
+ { |
+ BlockGrowBufferScope block_buf_growth(this); |
+ // Buffer growth (and relocation) must be blocked for internal |
+ // references until associated instructions are emitted and |
+ // available to be patched. |
+ RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE_ENCODED); |
+ lui(at, lui_offset); |
+ jialc(at, jic_offset); |
+ } |
+ CheckBuffer(); |
+ } else { |
+ { |
+ BlockGrowBufferScope block_buf_growth(this); |
+ // Buffer growth (and relocation) must be blocked for internal |
+ // references |
+ // until associated instructions are emitted and available to be |
+ // patched. |
+ RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE_ENCODED); |
+ lui(at, (imm32 & kHiMask) >> kLuiShift); |
+ ori(at, at, (imm32 & kImm16Mask)); |
+ } |
+ jalr(at); |
+ // Emit a nop in the branch delay slot if required. |
+ if (bdslot == PROTECT) nop(); |
} |
- jalr(at); |
- |
- // Emit a nop in the branch delay slot if required. |
- if (bdslot == PROTECT) nop(); |
} |
} |