Index: src/mips64/macro-assembler-mips64.cc |
diff --git a/src/mips64/macro-assembler-mips64.cc b/src/mips64/macro-assembler-mips64.cc |
index 701420bfd653869cd172ad680538d9012411ba1a..f98e77f1a43940111fed0a5f991dcf52ecf0189e 100644 |
--- a/src/mips64/macro-assembler-mips64.cc |
+++ b/src/mips64/macro-assembler-mips64.cc |
@@ -3520,16 +3520,25 @@ void MacroAssembler::Jump(Register target, |
const Operand& rt, |
BranchDelaySlot bd) { |
BlockTrampolinePoolScope block_trampoline_pool(this); |
- if (cond == cc_always) { |
- jr(target); |
+ if (kArchVariant == kMips64r6 && bd == PROTECT) { |
+ if (cond == cc_always) { |
+ jic(target, 0); |
+ } else { |
+ BRANCH_ARGS_CHECK(cond, rs, rt); |
+ Branch(2, NegateCondition(cond), rs, rt); |
+ jic(target, 0); |
+ } |
} else { |
- BRANCH_ARGS_CHECK(cond, rs, rt); |
- Branch(2, NegateCondition(cond), rs, rt); |
- jr(target); |
+ if (cond == cc_always) { |
+ jr(target); |
+ } else { |
+ BRANCH_ARGS_CHECK(cond, rs, rt); |
+ Branch(2, NegateCondition(cond), rs, rt); |
+ jr(target); |
+ } |
+ // Emit a nop in the branch delay slot if required. |
+ if (bd == PROTECT) nop(); |
} |
- // Emit a nop in the branch delay slot if required. |
- if (bd == PROTECT) |
- nop(); |
} |
@@ -3587,8 +3596,7 @@ int MacroAssembler::CallSize(Register target, |
size += 3; |
} |
- if (bd == PROTECT) |
- size += 1; |
+ if (bd == PROTECT && kArchVariant != kMips64r6) size += 1; |
return size * kInstrSize; |
} |
@@ -3607,16 +3615,25 @@ void MacroAssembler::Call(Register target, |
BlockTrampolinePoolScope block_trampoline_pool(this); |
Label start; |
bind(&start); |
- if (cond == cc_always) { |
- jalr(target); |
+ if (kArchVariant == kMips64r6 && bd == PROTECT) { |
+ if (cond == cc_always) { |
+ jialc(target, 0); |
+ } else { |
+ BRANCH_ARGS_CHECK(cond, rs, rt); |
+ Branch(2, NegateCondition(cond), rs, rt); |
+ jialc(target, 0); |
+ } |
} else { |
- BRANCH_ARGS_CHECK(cond, rs, rt); |
- Branch(2, NegateCondition(cond), rs, rt); |
- jalr(target); |
+ if (cond == cc_always) { |
+ jalr(target); |
+ } else { |
+ BRANCH_ARGS_CHECK(cond, rs, rt); |
+ Branch(2, NegateCondition(cond), rs, rt); |
+ jalr(target); |
+ } |
+ // Emit a nop in the branch delay slot if required. |
+ if (bd == PROTECT) nop(); |
} |
- // Emit a nop in the branch delay slot if required. |
- if (bd == PROTECT) |
- nop(); |
#ifdef DEBUG |
CHECK_EQ(size + CallSize(target, cond, rs, rt, bd), |
@@ -3739,44 +3756,6 @@ void MacroAssembler::BranchAndLinkLong(Label* L, BranchDelaySlot bdslot) { |
} |
-void MacroAssembler::Jr(Label* L, BranchDelaySlot bdslot) { |
- BlockTrampolinePoolScope block_trampoline_pool(this); |
- |
- uint64_t imm64; |
- imm64 = 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); |
- li(at, Operand(imm64), ADDRESS_LOAD); |
- } |
- jr(at); |
- |
- // Emit a nop in the branch delay slot if required. |
- if (bdslot == PROTECT) |
- nop(); |
-} |
- |
- |
-void MacroAssembler::Jalr(Label* L, BranchDelaySlot bdslot) { |
- BlockTrampolinePoolScope block_trampoline_pool(this); |
- |
- uint64_t imm64; |
- imm64 = 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); |
- li(at, Operand(imm64), ADDRESS_LOAD); |
- } |
- jalr(at); |
- |
- // Emit a nop in the branch delay slot if required. |
- if (bdslot == PROTECT) |
- nop(); |
-} |
- |
- |
void MacroAssembler::DropAndRet(int drop) { |
DCHECK(is_int16(drop * kPointerSize)); |
Ret(USE_DELAY_SLOT); |