summaryrefslogtreecommitdiff
path: root/js/src/jit/mips64
diff options
context:
space:
mode:
authorJiaxun Yang <jiaxun.yang@flygoat.com>2020-05-12 12:40:13 +0800
committerJiaxun Yang <jiaxun.yang@flygoat.com>2020-05-14 16:31:59 +0800
commit9679f714f7c3a1da7af0ddd1c2005f8f7ffd039b (patch)
treec8e7c6b7ae75be9131ae3add2fc4af7be80b3cbe /js/src/jit/mips64
parent53662b791d5f860791fea476c6377438cc60f921 (diff)
downloaduxp-9679f714f7c3a1da7af0ddd1c2005f8f7ffd039b.tar.gz
Bug 1441521 : [MIPS] Optimize comparation with small constants
Tag: #1542
Diffstat (limited to 'js/src/jit/mips64')
-rw-r--r--js/src/jit/mips64/MacroAssembler-mips64-inl.h5
-rw-r--r--js/src/jit/mips64/MacroAssembler-mips64.cpp23
2 files changed, 10 insertions, 18 deletions
diff --git a/js/src/jit/mips64/MacroAssembler-mips64-inl.h b/js/src/jit/mips64/MacroAssembler-mips64-inl.h
index 7d42c249c0..e88122f578 100644
--- a/js/src/jit/mips64/MacroAssembler-mips64-inl.h
+++ b/js/src/jit/mips64/MacroAssembler-mips64-inl.h
@@ -726,9 +726,8 @@ inline void
MacroAssembler::cmpPtrSet(Assembler::Condition cond, Address lhs, ImmPtr rhs,
Register dest)
{
- loadPtr(lhs, ScratchRegister);
- movePtr(rhs, SecondScratchReg);
- cmpPtrSet(cond, ScratchRegister, SecondScratchReg, dest);
+ loadPtr(lhs, SecondScratchReg);
+ cmpPtrSet(cond, SecondScratchReg, rhs, dest);
}
template<>
diff --git a/js/src/jit/mips64/MacroAssembler-mips64.cpp b/js/src/jit/mips64/MacroAssembler-mips64.cpp
index d283d0b4c3..9604e38a4d 100644
--- a/js/src/jit/mips64/MacroAssembler-mips64.cpp
+++ b/js/src/jit/mips64/MacroAssembler-mips64.cpp
@@ -719,14 +719,8 @@ MacroAssemblerMIPS64::ma_push(Register r)
void
MacroAssemblerMIPS64::ma_b(Register lhs, ImmWord imm, Label* label, Condition c, JumpKind jumpKind)
{
- MOZ_ASSERT(c != Overflow);
- if (imm.value == 0) {
- if (c == Always || c == AboveOrEqual)
- ma_b(label, jumpKind);
- else if (c == Below)
- ; // This condition is always false. No branch required.
- else
- branchWithCode(getBranchCode(lhs, c), label, jumpKind);
+ if (imm.value <= INT32_MAX) {
+ ma_b(lhs, Imm32(uint32_t(imm.value)), label, c, jumpKind);
} else {
MOZ_ASSERT(lhs != ScratchRegister);
ma_li(ScratchRegister, imm);
@@ -759,19 +753,18 @@ MacroAssemblerMIPS64::ma_b(Address addr, ImmGCPtr imm, Label* label, Condition c
void
MacroAssemblerMIPS64::ma_cmp_set(Register rd, Register rs, ImmWord imm, Condition c)
{
- if (imm.value == 0) {
- ma_cmp_set(rd, rs, zero, c);
- return;
+ if (imm.value <= INT32_MAX) {
+ ma_cmp_set(rd, rs, Imm32(uint32_t(imm.value)), c);
+ } else {
+ ma_li(ScratchRegister, imm);
+ ma_cmp_set(rd, rs, ScratchRegister, c);
}
- ma_li(ScratchRegister, imm);
- ma_cmp_set(rd, rs, ScratchRegister, c);
}
void
MacroAssemblerMIPS64::ma_cmp_set(Register rd, Register rs, ImmPtr imm, Condition c)
{
- ma_li(ScratchRegister, ImmWord(uintptr_t(imm.value)));
- ma_cmp_set(rd, rs, ScratchRegister, c);
+ ma_cmp_set(rd, rs, ImmWord(uintptr_t(imm.value)), c);
}
// fp instructions