Bug 1202222 - IonMonkey: MIPS32: Move compat functions to MacroAssemblerMIPSCompat. r=nbp
authorHeiher <r@hev.cc>
Thu, 10 Sep 2015 19:41:00 +0200
changeset 294534 95f8c872196f61ead39c27174fec47ad38dbb150
parent 294533 04aa9165c832254e43a9b168aeb02cac3da9aed8
child 294535 a9275e9bbcb438e941d65b7328b8ff50ae77fecf
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1202222
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1202222 - IonMonkey: MIPS32: Move compat functions to MacroAssemblerMIPSCompat. r=nbp
js/src/jit/mips32/MacroAssembler-mips32.cpp
js/src/jit/mips32/MacroAssembler-mips32.h
--- a/js/src/jit/mips32/MacroAssembler-mips32.cpp
+++ b/js/src/jit/mips32/MacroAssembler-mips32.cpp
@@ -25,47 +25,47 @@ using namespace jit;
 using mozilla::Abs;
 
 static const int32_t PAYLOAD_OFFSET = NUNBOX32_PAYLOAD_OFFSET;
 static const int32_t TAG_OFFSET = NUNBOX32_TYPE_OFFSET;
 
 static_assert(sizeof(intptr_t) == 4, "Not 64-bit clean.");
 
 void
-MacroAssemblerMIPS::convertBoolToInt32(Register src, Register dest)
+MacroAssemblerMIPSCompat::convertBoolToInt32(Register src, Register dest)
 {
     // Note that C++ bool is only 1 byte, so zero extend it to clear the
     // higher-order bits.
     ma_and(dest, src, Imm32(0xff));
 }
 
 void
-MacroAssemblerMIPS::convertInt32ToDouble(Register src, FloatRegister dest)
+MacroAssemblerMIPSCompat::convertInt32ToDouble(Register src, FloatRegister dest)
 {
     as_mtc1(src, dest);
     as_cvtdw(dest, dest);
 }
 
 void
-MacroAssemblerMIPS::convertInt32ToDouble(const Address& src, FloatRegister dest)
+MacroAssemblerMIPSCompat::convertInt32ToDouble(const Address& src, FloatRegister dest)
 {
     ma_lw(ScratchRegister, src);
     as_mtc1(ScratchRegister, dest);
     as_cvtdw(dest, dest);
 }
 
 void
-MacroAssemblerMIPS::convertInt32ToDouble(const BaseIndex& src, FloatRegister dest)
+MacroAssemblerMIPSCompat::convertInt32ToDouble(const BaseIndex& src, FloatRegister dest)
 {
     computeScaledAddress(src, SecondScratchReg);
     convertInt32ToDouble(Address(SecondScratchReg, src.offset), dest);
 }
 
 void
-MacroAssemblerMIPS::convertUInt32ToDouble(Register src, FloatRegister dest)
+MacroAssemblerMIPSCompat::convertUInt32ToDouble(Register src, FloatRegister dest)
 {
     // We use SecondScratchDoubleReg because MacroAssembler::loadFromTypedArray
     // calls with ScratchDoubleReg as dest.
     MOZ_ASSERT(dest != SecondScratchDoubleReg);
 
     // Subtract INT32_MIN to get a positive number
     ma_subu(ScratchRegister, src, Imm32(INT32_MIN));
 
@@ -74,17 +74,17 @@ MacroAssemblerMIPS::convertUInt32ToDoubl
     as_cvtdw(dest, dest);
 
     // Add unsigned value of INT32_MIN
     ma_lid(SecondScratchDoubleReg, 2147483648.0);
     as_addd(dest, dest, SecondScratchDoubleReg);
 }
 
 void
-MacroAssemblerMIPS::convertUInt32ToFloat32(Register src, FloatRegister dest)
+MacroAssemblerMIPSCompat::convertUInt32ToFloat32(Register src, FloatRegister dest)
 {
     Label positive, done;
     ma_b(src, src, &positive, NotSigned, ShortJump);
 
     // We cannot do the same as convertUInt32ToDouble because float32 doesn't
     // have enough precision.
     convertUInt32ToDouble(src, dest);
     convertDoubleToFloat32(dest, dest);
@@ -92,42 +92,42 @@ MacroAssemblerMIPS::convertUInt32ToFloat
 
     bind(&positive);
     convertInt32ToFloat32(src, dest);
 
     bind(&done);
 }
 
 void
-MacroAssemblerMIPS::convertDoubleToFloat32(FloatRegister src, FloatRegister dest)
+MacroAssemblerMIPSCompat::convertDoubleToFloat32(FloatRegister src, FloatRegister dest)
 {
     as_cvtsd(dest, src);
 }
 
 // Convert the floating point value to an integer, if it did not fit, then it
 // was clamped to INT32_MIN/INT32_MAX, and we can test it.
 // NOTE: if the value really was supposed to be INT32_MAX / INT32_MIN then it
 // will be wrong.
 void
-MacroAssemblerMIPS::branchTruncateDouble(FloatRegister src, Register dest,
+MacroAssemblerMIPSCompat::branchTruncateDouble(FloatRegister src, Register dest,
                                          Label* fail)
 {
     Label test, success;
     as_truncwd(ScratchDoubleReg, src);
     as_mfc1(dest, ScratchDoubleReg);
 
     ma_b(dest, Imm32(INT32_MAX), fail, Assembler::Equal);
     ma_b(dest, Imm32(INT32_MIN), fail, Assembler::Equal);
 }
 
 // Checks whether a double is representable as a 32-bit integer. If so, the
 // integer is written to the output register. Otherwise, a bailout is taken to
 // the given snapshot. This function overwrites the scratch float register.
 void
-MacroAssemblerMIPS::convertDoubleToInt32(FloatRegister src, Register dest,
+MacroAssemblerMIPSCompat::convertDoubleToInt32(FloatRegister src, Register dest,
                                          Label* fail, bool negativeZeroCheck)
 {
     // Convert double to int, then convert back and check if we have the
     // same number.
     as_cvtwd(ScratchDoubleReg, src);
     as_mfc1(dest, ScratchDoubleReg);
     as_cvtdw(ScratchDoubleReg, ScratchDoubleReg);
     ma_bc1d(src, ScratchDoubleReg, fail, Assembler::DoubleNotEqualOrUnordered);
@@ -143,17 +143,17 @@ MacroAssemblerMIPS::convertDoubleToInt32
         bind(&notZero);
     }
 }
 
 // Checks whether a float32 is representable as a 32-bit integer. If so, the
 // integer is written to the output register. Otherwise, a bailout is taken to
 // the given snapshot. This function overwrites the scratch float register.
 void
-MacroAssemblerMIPS::convertFloat32ToInt32(FloatRegister src, Register dest,
+MacroAssemblerMIPSCompat::convertFloat32ToInt32(FloatRegister src, Register dest,
                                           Label* fail, bool negativeZeroCheck)
 {
     // Converting the floating point value to an integer and then converting it
     // back to a float32 would not work, as float to int32 conversions are
     // clamping (e.g. float(INT32_MAX + 1) would get converted into INT32_MAX
     // and then back to float(INT32_MAX + 1)).  If this ever happens, we just
     // bail out.
     as_cvtws(ScratchFloat32Reg, src);
@@ -172,79 +172,79 @@ MacroAssemblerMIPS::convertFloat32ToInt3
         // if it is non-zero, then the original value was -0.0
         moveFromDoubleHi(src, dest);
         ma_b(dest, Imm32(INT32_MIN), fail, Assembler::Equal);
         bind(&notZero);
     }
 }
 
 void
-MacroAssemblerMIPS::convertFloat32ToDouble(FloatRegister src, FloatRegister dest)
+MacroAssemblerMIPSCompat::convertFloat32ToDouble(FloatRegister src, FloatRegister dest)
 {
     as_cvtds(dest, src);
 }
 
 void
-MacroAssemblerMIPS::branchTruncateFloat32(FloatRegister src, Register dest,
+MacroAssemblerMIPSCompat::branchTruncateFloat32(FloatRegister src, Register dest,
                                           Label* fail)
 {
     Label test, success;
     as_truncws(ScratchFloat32Reg, src);
     as_mfc1(dest, ScratchFloat32Reg);
 
     ma_b(dest, Imm32(INT32_MAX), fail, Assembler::Equal);
 }
 
 void
-MacroAssemblerMIPS::convertInt32ToFloat32(Register src, FloatRegister dest)
+MacroAssemblerMIPSCompat::convertInt32ToFloat32(Register src, FloatRegister dest)
 {
     as_mtc1(src, dest);
     as_cvtsw(dest, dest);
 }
 
 void
-MacroAssemblerMIPS::convertInt32ToFloat32(const Address& src, FloatRegister dest)
+MacroAssemblerMIPSCompat::convertInt32ToFloat32(const Address& src, FloatRegister dest)
 {
     ma_lw(ScratchRegister, src);
     as_mtc1(ScratchRegister, dest);
     as_cvtsw(dest, dest);
 }
 
 void
-MacroAssemblerMIPS::addDouble(FloatRegister src, FloatRegister dest)
+MacroAssemblerMIPSCompat::addDouble(FloatRegister src, FloatRegister dest)
 {
     as_addd(dest, dest, src);
 }
 
 void
-MacroAssemblerMIPS::subDouble(FloatRegister src, FloatRegister dest)
+MacroAssemblerMIPSCompat::subDouble(FloatRegister src, FloatRegister dest)
 {
     as_subd(dest, dest, src);
 }
 
 void
-MacroAssemblerMIPS::mulDouble(FloatRegister src, FloatRegister dest)
+MacroAssemblerMIPSCompat::mulDouble(FloatRegister src, FloatRegister dest)
 {
     as_muld(dest, dest, src);
 }
 
 void
-MacroAssemblerMIPS::divDouble(FloatRegister src, FloatRegister dest)
+MacroAssemblerMIPSCompat::divDouble(FloatRegister src, FloatRegister dest)
 {
     as_divd(dest, dest, src);
 }
 
 void
-MacroAssemblerMIPS::negateDouble(FloatRegister reg)
+MacroAssemblerMIPSCompat::negateDouble(FloatRegister reg)
 {
     as_negd(reg, reg);
 }
 
 void
-MacroAssemblerMIPS::inc64(AbsoluteAddress dest)
+MacroAssemblerMIPSCompat::inc64(AbsoluteAddress dest)
 {
     ma_li(ScratchRegister, Imm32((int32_t)dest.addr));
     as_lw(SecondScratchReg, ScratchRegister, 0);
 
     as_addiu(SecondScratchReg, SecondScratchReg, 1);
     as_sw(SecondScratchReg, ScratchRegister, 0);
 
     as_sltiu(SecondScratchReg, SecondScratchReg, 1);
@@ -753,17 +753,17 @@ MacroAssemblerMIPS::ma_load(Register des
         MOZ_CRASH("Invalid argument for ma_load");
     }
 }
 
 void
 MacroAssemblerMIPS::ma_load(Register dest, const BaseIndex& src,
                             LoadStoreSize size, LoadStoreExtension extension)
 {
-    computeScaledAddress(src, SecondScratchReg);
+    asMasm().computeScaledAddress(src, SecondScratchReg);
     ma_load(dest, Address(SecondScratchReg, src.offset), size, extension);
 }
 
 void
 MacroAssemblerMIPS::ma_store(Register data, Address address, LoadStoreSize size,
                              LoadStoreExtension extension)
 {
     int16_t encodedOffset;
@@ -792,38 +792,38 @@ MacroAssemblerMIPS::ma_store(Register da
         MOZ_CRASH("Invalid argument for ma_store");
     }
 }
 
 void
 MacroAssemblerMIPS::ma_store(Register data, const BaseIndex& dest,
                              LoadStoreSize size, LoadStoreExtension extension)
 {
-    computeScaledAddress(dest, SecondScratchReg);
+    asMasm().computeScaledAddress(dest, SecondScratchReg);
     ma_store(data, Address(SecondScratchReg, dest.offset), size, extension);
 }
 
 void
 MacroAssemblerMIPS::ma_store(Imm32 imm, const BaseIndex& dest,
                              LoadStoreSize size, LoadStoreExtension extension)
 {
     // Make sure that SecondScratchReg contains absolute address so that
     // offset is 0.
-    computeEffectiveAddress(dest, SecondScratchReg);
+    asMasm().computeEffectiveAddress(dest, SecondScratchReg);
 
     // Scrach register is free now, use it for loading imm value
     ma_li(ScratchRegister, imm);
 
     // with offset=0 ScratchRegister will not be used in ma_store()
     // so we can use it as a parameter here
     ma_store(ScratchRegister, Address(SecondScratchReg, 0), size, extension);
 }
 
 void
-MacroAssemblerMIPS::computeScaledAddress(const BaseIndex& address, Register dest)
+MacroAssemblerMIPSCompat::computeScaledAddress(const BaseIndex& address, Register dest)
 {
     int32_t shift = Imm32::ShiftOf(address.scale).value;
     if (shift) {
         ma_sll(ScratchRegister, address.index, Imm32(shift));
         as_addu(dest, address.base, ScratchRegister);
     } else {
         as_addu(dest, address.base, address.index);
     }
@@ -1443,17 +1443,17 @@ MacroAssemblerMIPS::ma_sd(FloatRegister 
         as_ss(ft, ScratchRegister, PAYLOAD_OFFSET);
         as_ss(getOddPair(ft), ScratchRegister, TAG_OFFSET);
     }
 }
 
 void
 MacroAssemblerMIPS::ma_sd(FloatRegister ft, BaseIndex address)
 {
-    computeScaledAddress(address, SecondScratchReg);
+    asMasm().computeScaledAddress(address, SecondScratchReg);
     ma_sd(ft, Address(SecondScratchReg, address.offset));
 }
 
 void
 MacroAssemblerMIPS::ma_ss(FloatRegister ft, Address address)
 {
     if (Imm16::IsInSignedRange(address.offset)) {
         as_ss(ft, address.base, address.offset);
@@ -1462,17 +1462,17 @@ MacroAssemblerMIPS::ma_ss(FloatRegister 
         as_addu(ScratchRegister, address.base, ScratchRegister);
         as_ss(ft, ScratchRegister, 0);
     }
 }
 
 void
 MacroAssemblerMIPS::ma_ss(FloatRegister ft, BaseIndex address)
 {
-    computeScaledAddress(address, SecondScratchReg);
+    asMasm().computeScaledAddress(address, SecondScratchReg);
     ma_ss(ft, Address(SecondScratchReg, address.offset));
 }
 
 void
 MacroAssemblerMIPS::ma_pop(FloatRegister fs)
 {
     ma_ld(fs.doubleOverlay(0), Address(StackPointer, 0));
     as_addiu(StackPointer, StackPointer, sizeof(double));
@@ -2065,23 +2065,23 @@ void
 MacroAssemblerMIPSCompat::branchFloat(DoubleCondition cond, FloatRegister lhs,
                                       FloatRegister rhs, Label* label)
 {
     ma_bc1s(lhs, rhs, label, cond);
 }
 
 // higher level tag testing code
 Operand
-MacroAssemblerMIPS::ToPayload(Operand base)
+MacroAssemblerMIPSCompat::ToPayload(Operand base)
 {
     return Operand(Register::FromCode(base.base()), base.disp() + PAYLOAD_OFFSET);
 }
 
 Operand
-MacroAssemblerMIPS::ToType(Operand base)
+MacroAssemblerMIPSCompat::ToType(Operand base)
 {
     return Operand(Register::FromCode(base.base()), base.disp() + TAG_OFFSET);
 }
 
 void
 MacroAssemblerMIPSCompat::branchTestGCThing(Condition cond, const Address& address, Label* label)
 {
     MOZ_ASSERT(cond == Equal || cond == NotEqual);
@@ -3257,23 +3257,23 @@ MacroAssemblerMIPSCompat::profilerEnterF
 
 void
 MacroAssemblerMIPSCompat::profilerExitFrame()
 {
     branch(GetJitContext()->runtime->jitRuntime()->getProfilerExitFrameTail());
 }
 
 MacroAssembler&
-MacroAssemblerMIPSCompat::asMasm()
+MacroAssemblerMIPS::asMasm()
 {
     return *static_cast<MacroAssembler*>(this);
 }
 
 const MacroAssembler&
-MacroAssemblerMIPSCompat::asMasm() const
+MacroAssemblerMIPS::asMasm() const
 {
     return *static_cast<const MacroAssembler*>(this);
 }
 
 //{{{ check_macroassembler_style
 // ===============================================================
 // Stack manipulation functions.
 
--- a/js/src/jit/mips32/MacroAssembler-mips32.h
+++ b/js/src/jit/mips32/MacroAssembler-mips32.h
@@ -62,59 +62,29 @@ static const ValueOperand JSReturnOperan
 static const ValueOperand softfpReturnOperand = ValueOperand(v1, v0);
 
 static Register CallReg = t9;
 static const int defaultShift = 3;
 static_assert(1 << defaultShift == sizeof(JS::Value), "The defaultShift is wrong");
 
 class MacroAssemblerMIPS : public Assembler
 {
-  public:
-    // higher level tag testing code
-    Operand ToPayload(Operand base);
-    Address ToPayload(Address base) {
-        return ToPayload(Operand(base)).toAddress();
-    }
   protected:
-    Operand ToType(Operand base);
-    Address ToType(Address base) {
-        return ToType(Operand(base)).toAddress();
-    }
+    // Perform a downcast. Should be removed by Bug 996602.
+    MacroAssembler& asMasm();
+    const MacroAssembler& asMasm() const;
+
+    void branchWithCode(InstImm code, Label* label, JumpKind jumpKind);
+    Condition ma_cmp(Register rd, Register lhs, Register rhs, Condition c);
+
+    void compareFloatingPoint(FloatFormat fmt, FloatRegister lhs, FloatRegister rhs,
+                              DoubleCondition c, FloatTestKind* testKind,
+                              FPConditionBit fcc = FCC0);
 
   public:
-
-    void convertBoolToInt32(Register source, Register dest);
-    void convertInt32ToDouble(Register src, FloatRegister dest);
-    void convertInt32ToDouble(const Address& src, FloatRegister dest);
-    void convertInt32ToDouble(const BaseIndex& src, FloatRegister dest);
-    void convertUInt32ToDouble(Register src, FloatRegister dest);
-    void convertUInt32ToFloat32(Register src, FloatRegister dest);
-    void convertDoubleToFloat32(FloatRegister src, FloatRegister dest);
-    void branchTruncateDouble(FloatRegister src, Register dest, Label* fail);
-    void convertDoubleToInt32(FloatRegister src, Register dest, Label* fail,
-                              bool negativeZeroCheck = true);
-    void convertFloat32ToInt32(FloatRegister src, Register dest, Label* fail,
-                               bool negativeZeroCheck = true);
-
-    void convertFloat32ToDouble(FloatRegister src, FloatRegister dest);
-    void branchTruncateFloat32(FloatRegister src, Register dest, Label* fail);
-    void convertInt32ToFloat32(Register src, FloatRegister dest);
-    void convertInt32ToFloat32(const Address& src, FloatRegister dest);
-
-
-    void addDouble(FloatRegister src, FloatRegister dest);
-    void subDouble(FloatRegister src, FloatRegister dest);
-    void mulDouble(FloatRegister src, FloatRegister dest);
-    void divDouble(FloatRegister src, FloatRegister dest);
-
-    void negateDouble(FloatRegister reg);
-    void inc64(AbsoluteAddress dest);
-
-  public:
-
     void ma_move(Register rd, Register rs);
 
     void ma_li(Register dest, ImmGCPtr ptr);
 
     void ma_li(Register dest, AbsoluteLabel* label);
 
     void ma_li(Register dest, Imm32 imm);
     void ma_liPatchable(Register dest, Imm32 imm);
@@ -165,29 +135,16 @@ class MacroAssemblerMIPS : public Assemb
     // store
     void ma_store(Register data, Address address, LoadStoreSize size = SizeWord,
                   LoadStoreExtension extension = SignExtend);
     void ma_store(Register data, const BaseIndex& dest, LoadStoreSize size = SizeWord,
                   LoadStoreExtension extension = SignExtend);
     void ma_store(Imm32 imm, const BaseIndex& dest, LoadStoreSize size = SizeWord,
                   LoadStoreExtension extension = SignExtend);
 
-    void computeScaledAddress(const BaseIndex& address, Register dest);
-
-    void computeEffectiveAddress(const Address& address, Register dest) {
-        ma_addu(dest, address.base, Imm32(address.offset));
-    }
-
-    void computeEffectiveAddress(const BaseIndex& address, Register dest) {
-        computeScaledAddress(address, dest);
-        if (address.offset) {
-            ma_addu(dest, dest, Imm32(address.offset));
-        }
-    }
-
     // arithmetic based ops
     // add
     void ma_addu(Register rd, Register rs, Imm32 imm);
     void ma_addu(Register rd, Register rs, Register rt);
     void ma_addu(Register rd, Register rs);
     void ma_addu(Register rd, Imm32 imm);
     void ma_addTestOverflow(Register rd, Register rs, Register rt, Label* overflow);
     void ma_addTestOverflow(Register rd, Register rs, Imm32 imm, Label* overflow);
@@ -275,16 +232,34 @@ class MacroAssemblerMIPS : public Assemb
     void ma_push(FloatRegister fs);
 
     //FP branches
     void ma_bc1s(FloatRegister lhs, FloatRegister rhs, Label* label, DoubleCondition c,
                  JumpKind jumpKind = LongJump, FPConditionBit fcc = FCC0);
     void ma_bc1d(FloatRegister lhs, FloatRegister rhs, Label* label, DoubleCondition c,
                  JumpKind jumpKind = LongJump, FPConditionBit fcc = FCC0);
 
+    void ma_call(ImmPtr dest);
+
+    void ma_jump(ImmPtr dest);
+
+    void ma_cmp_set(Register dst, Register lhs, Register rhs, Condition c);
+    void ma_cmp_set(Register dst, Register lhs, Imm32 imm, Condition c);
+    void ma_cmp_set(Register dst, Register lhs, ImmPtr imm, Condition c) {
+        ma_cmp_set(dst, lhs, Imm32(uint32_t(imm.value)), c);
+    }
+    void ma_cmp_set(Register rd, Register rs, Address addr, Condition c);
+    void ma_cmp_set(Register dst, Address lhs, Register rhs, Condition c);
+    void ma_cmp_set(Register dst, Address lhs, ImmPtr imm, Condition c) {
+        ma_lw(ScratchRegister, lhs);
+        ma_li(SecondScratchReg, Imm32(uint32_t(imm.value)));
+        ma_cmp_set(dst, ScratchRegister, SecondScratchReg, c);
+    }
+    void ma_cmp_set_double(Register dst, FloatRegister lhs, FloatRegister rhs, DoubleCondition c);
+    void ma_cmp_set_float32(Register dst, FloatRegister lhs, FloatRegister rhs, DoubleCondition c);
 
     // These fuctions abstract the access to high part of the double precision
     // float register. It is intended to work on both 32 bit and 64 bit
     // floating point coprocessor.
     // :TODO: (Bug 985881) Modify this for N32 ABI to use mthc1 and mfhc1
     void moveToDoubleHi(Register src, FloatRegister dest) {
         as_mtc1(src, getOddPair(dest));
     }
@@ -300,61 +275,66 @@ class MacroAssemblerMIPS : public Assemb
     }
 
     void moveToFloat32(Register src, FloatRegister dest) {
         as_mtc1(src, dest);
     }
     void moveFromFloat32(FloatRegister src, Register dest) {
         as_mfc1(dest, src);
     }
-
-  protected:
-    void branchWithCode(InstImm code, Label* label, JumpKind jumpKind);
-    Condition ma_cmp(Register rd, Register lhs, Register rhs, Condition c);
-
-    void compareFloatingPoint(FloatFormat fmt, FloatRegister lhs, FloatRegister rhs,
-                              DoubleCondition c, FloatTestKind* testKind,
-                              FPConditionBit fcc = FCC0);
-
-  public:
-    void ma_call(ImmPtr dest);
-
-    void ma_jump(ImmPtr dest);
-
-    void ma_cmp_set(Register dst, Register lhs, Register rhs, Condition c);
-    void ma_cmp_set(Register dst, Register lhs, Imm32 imm, Condition c);
-    void ma_cmp_set(Register dst, Register lhs, ImmPtr imm, Condition c) {
-        ma_cmp_set(dst, lhs, Imm32(uint32_t(imm.value)), c);
-    }
-    void ma_cmp_set(Register rd, Register rs, Address addr, Condition c);
-    void ma_cmp_set(Register dst, Address lhs, Register rhs, Condition c);
-    void ma_cmp_set(Register dst, Address lhs, ImmPtr imm, Condition c) {
-        ma_lw(ScratchRegister, lhs);
-        ma_li(SecondScratchReg, Imm32(uint32_t(imm.value)));
-        ma_cmp_set(dst, ScratchRegister, SecondScratchReg, c);
-    }
-    void ma_cmp_set_double(Register dst, FloatRegister lhs, FloatRegister rhs, DoubleCondition c);
-    void ma_cmp_set_float32(Register dst, FloatRegister lhs, FloatRegister rhs, DoubleCondition c);
 };
 
 class MacroAssembler;
 
 class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS
 {
-  private:
-    // Perform a downcast. Should be removed by Bug 996602.
-    MacroAssembler& asMasm();
-    const MacroAssembler& asMasm() const;
+  public:
+    using MacroAssemblerMIPS::call;
 
-  public:
     MacroAssemblerMIPSCompat()
     { }
 
-  public:
-    using MacroAssemblerMIPS::call;
+    void convertBoolToInt32(Register source, Register dest);
+    void convertInt32ToDouble(Register src, FloatRegister dest);
+    void convertInt32ToDouble(const Address& src, FloatRegister dest);
+    void convertInt32ToDouble(const BaseIndex& src, FloatRegister dest);
+    void convertUInt32ToDouble(Register src, FloatRegister dest);
+    void convertUInt32ToFloat32(Register src, FloatRegister dest);
+    void convertDoubleToFloat32(FloatRegister src, FloatRegister dest);
+    void branchTruncateDouble(FloatRegister src, Register dest, Label* fail);
+    void convertDoubleToInt32(FloatRegister src, Register dest, Label* fail,
+                              bool negativeZeroCheck = true);
+    void convertFloat32ToInt32(FloatRegister src, Register dest, Label* fail,
+                               bool negativeZeroCheck = true);
+
+    void convertFloat32ToDouble(FloatRegister src, FloatRegister dest);
+    void branchTruncateFloat32(FloatRegister src, Register dest, Label* fail);
+    void convertInt32ToFloat32(Register src, FloatRegister dest);
+    void convertInt32ToFloat32(const Address& src, FloatRegister dest);
+
+    void addDouble(FloatRegister src, FloatRegister dest);
+    void subDouble(FloatRegister src, FloatRegister dest);
+    void mulDouble(FloatRegister src, FloatRegister dest);
+    void divDouble(FloatRegister src, FloatRegister dest);
+
+    void negateDouble(FloatRegister reg);
+    void inc64(AbsoluteAddress dest);
+
+    void computeScaledAddress(const BaseIndex& address, Register dest);
+
+    void computeEffectiveAddress(const Address& address, Register dest) {
+        ma_addu(dest, address.base, Imm32(address.offset));
+    }
+
+    void computeEffectiveAddress(const BaseIndex& address, Register dest) {
+        computeScaledAddress(address, dest);
+        if (address.offset) {
+            ma_addu(dest, dest, Imm32(address.offset));
+        }
+    }
 
     void j(Label* dest) {
         ma_b(dest);
     }
 
     void mov(Register src, Register dest) {
         as_or(dest, src, zero);
     }
@@ -710,20 +690,31 @@ class MacroAssemblerMIPSCompat : public 
     void branchPtr(Condition cond, Register lhs, Imm32 imm, Label* label) {
         ma_b(lhs, imm, label, cond);
     }
     void decBranchPtr(Condition cond, Register lhs, Imm32 imm, Label* label) {
         subPtr(imm, lhs);
         branch32(cond, lhs, Imm32(0), label);
     }
 
-protected:
+    // higher level tag testing code
+    Operand ToPayload(Operand base);
+    Address ToPayload(Address base) {
+        return ToPayload(Operand(base)).toAddress();
+    }
+
+  protected:
+    Operand ToType(Operand base);
+    Address ToType(Address base) {
+        return ToType(Operand(base)).toAddress();
+    }
+
     uint32_t getType(const Value& val);
     void moveData(const Value& val, Register data);
-public:
+  public:
     void moveValue(const Value& val, Register type, Register data);
 
     CodeOffsetJump backedgeJump(RepatchLabel* label, Label* documentation = nullptr);
     CodeOffsetJump jumpWithPatch(RepatchLabel* label, Label* documentation = nullptr);
 
     template <typename T>
     CodeOffsetJump branchPtrWithPatch(Condition cond, Register reg, T ptr, RepatchLabel* label) {
         movePtr(ptr, ScratchRegister);