Bug 1229057 - Part 1: Move MacroAssembler::addPtr into generic macro assembler. r=nbp
authorTooru Fujisawa <arai_a@mac.com>
Tue, 01 Dec 2015 17:02:09 +0900
changeset 316141 2145800218a3d07f1b9d22c3358e5240f9dafefb
parent 316140 6db8fd96938ee038670b434dbd41ce00ead78b0c
child 316142 27f2890d8b27268e1126dba1536e995bd85baad9
push id8516
push userjlund@mozilla.com
push dateFri, 18 Dec 2015 00:52:34 +0000
reviewersnbp
bugs1229057
milestone46.0a1
Bug 1229057 - Part 1: Move MacroAssembler::addPtr into generic macro assembler. r=nbp
js/src/jit/MacroAssembler-inl.h
js/src/jit/MacroAssembler.h
js/src/jit/arm/MacroAssembler-arm-inl.h
js/src/jit/arm/MacroAssembler-arm.cpp
js/src/jit/arm/MacroAssembler-arm.h
js/src/jit/arm64/MacroAssembler-arm64-inl.h
js/src/jit/arm64/MacroAssembler-arm64.cpp
js/src/jit/arm64/MacroAssembler-arm64.h
js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h
js/src/jit/mips32/MacroAssembler-mips32-inl.h
js/src/jit/mips32/MacroAssembler-mips32.cpp
js/src/jit/mips32/MacroAssembler-mips32.h
js/src/jit/mips64/MacroAssembler-mips64-inl.h
js/src/jit/mips64/MacroAssembler-mips64.cpp
js/src/jit/mips64/MacroAssembler-mips64.h
js/src/jit/none/MacroAssembler-none.h
js/src/jit/x64/MacroAssembler-x64-inl.h
js/src/jit/x64/MacroAssembler-x64.cpp
js/src/jit/x64/MacroAssembler-x64.h
js/src/jit/x86-shared/MoveEmitter-x86-shared.cpp
js/src/jit/x86/MacroAssembler-x86-inl.h
js/src/jit/x86/MacroAssembler-x86.cpp
js/src/jit/x86/MacroAssembler-x86.h
--- a/js/src/jit/MacroAssembler-inl.h
+++ b/js/src/jit/MacroAssembler-inl.h
@@ -308,16 +308,25 @@ MacroAssembler::leaveExitFrame(size_t ex
 }
 
 bool
 MacroAssembler::hasSelfReference() const
 {
     return selfReferencePatch_.bound();
 }
 
+// ===============================================================
+// Arithmetic functions
+
+void
+MacroAssembler::addPtr(ImmPtr imm, Register dest)
+{
+    addPtr(ImmWord(uintptr_t(imm.value)), dest);
+}
+
 //}}} check_macroassembler_style
 // ===============================================================
 
 void
 MacroAssembler::branchFunctionKind(Condition cond, JSFunction::FunctionKind kind, Register fun,
                                    Register scratch, Label* label)
 {
     // 16-bit loads are slow and unaligned 32-bit loads may be too so
--- a/js/src/jit/MacroAssembler.h
+++ b/js/src/jit/MacroAssembler.h
@@ -726,16 +726,26 @@ class MacroAssembler : public MacroAssem
     inline void xor32(Imm32 imm, Register dest) PER_SHARED_ARCH;
 
     inline void xorPtr(Register src, Register dest) PER_ARCH;
     inline void xorPtr(Imm32 imm, Register dest) PER_ARCH;
 
     // ===============================================================
     // Arithmetic functions
 
+    inline void addPtr(Register src, Register dest) PER_ARCH;
+    inline void addPtr(Register src1, Register src2, Register dest) DEFINED_ON(arm64);
+    inline void addPtr(Imm32 imm, Register dest) PER_ARCH;
+    inline void addPtr(Imm32 imm, Register src, Register dest) DEFINED_ON(arm64);
+    inline void addPtr(ImmWord imm, Register dest) PER_ARCH;
+    inline void addPtr(ImmPtr imm, Register dest);
+    inline void addPtr(Imm32 imm, const Address& dest) DEFINED_ON(mips_shared, arm, arm64, x86, x64);
+    inline void addPtr(Imm32 imm, const AbsoluteAddress& dest) DEFINED_ON(x86, x64);
+    inline void addPtr(const Address& src, Register dest) DEFINED_ON(mips_shared, arm, arm64, x86, x64);
+
     inline void sub32(const Address& src, Register dest) PER_SHARED_ARCH;
     inline void sub32(Register src, Register dest) PER_SHARED_ARCH;
     inline void sub32(Imm32 imm, Register dest) PER_SHARED_ARCH;
 
     inline void add64(Register64 src, Register64 dest) PER_ARCH;
 
     // ===============================================================
     // Shift functions
--- a/js/src/jit/arm/MacroAssembler-arm-inl.h
+++ b/js/src/jit/arm/MacroAssembler-arm-inl.h
@@ -134,16 +134,51 @@ MacroAssembler::xorPtr(Imm32 imm, Regist
 {
     ma_eor(imm, dest);
 }
 
 // ===============================================================
 // Arithmetic functions
 
 void
+MacroAssembler::addPtr(Register src, Register dest)
+{
+    ma_add(src, dest);
+}
+
+void
+MacroAssembler::addPtr(Imm32 imm, Register dest)
+{
+    ma_add(imm, dest);
+}
+
+void
+MacroAssembler::addPtr(ImmWord imm, Register dest)
+{
+    addPtr(Imm32(imm.value), dest);
+}
+
+void
+MacroAssembler::addPtr(Imm32 imm, const Address& dest)
+{
+    ScratchRegisterScope scratch(*this);
+    loadPtr(dest, scratch);
+    addPtr(imm, scratch);
+    storePtr(scratch, dest);
+}
+
+void
+MacroAssembler::addPtr(const Address& src, Register dest)
+{
+    ScratchRegisterScope scratch(*this);
+    load32(src, scratch);
+    ma_add(scratch, dest, SetCC);
+}
+
+void
 MacroAssembler::add64(Register64 src, Register64 dest)
 {
     ma_add(src.low, dest.low, SetCC);
     ma_adc(src.high, dest.high);
 }
 
 void
 MacroAssembler::sub32(Register src, Register dest)
--- a/js/src/jit/arm/MacroAssembler-arm.cpp
+++ b/js/src/jit/arm/MacroAssembler-arm.cpp
@@ -1964,30 +1964,16 @@ MacroAssemblerARMCompat::add32(Imm32 imm
 {
     ScratchRegisterScope scratch(asMasm());
     load32(dest, scratch);
     ma_add(imm, scratch, SetCC);
     store32(scratch, dest);
 }
 
 void
-MacroAssemblerARMCompat::addPtr(Register src, Register dest)
-{
-    ma_add(src, dest);
-}
-
-void
-MacroAssemblerARMCompat::addPtr(const Address& src, Register dest)
-{
-    ScratchRegisterScope scratch(asMasm());
-    load32(src, scratch);
-    ma_add(scratch, dest, SetCC);
-}
-
-void
 MacroAssemblerARMCompat::move32(Imm32 imm, Register dest)
 {
     ma_mov(imm, dest);
 }
 
 void
 MacroAssemblerARMCompat::move32(Register src, Register dest)
 {
@@ -2651,31 +2637,16 @@ MacroAssemblerARMCompat::subPtr(Register
 {
     ScratchRegisterScope scratch(asMasm());
     loadPtr(dest, scratch);
     ma_sub(src, scratch);
     storePtr(scratch, dest);
 }
 
 void
-MacroAssemblerARMCompat::addPtr(Imm32 imm, const Register dest)
-{
-    ma_add(imm, dest);
-}
-
-void
-MacroAssemblerARMCompat::addPtr(Imm32 imm, const Address& dest)
-{
-    ScratchRegisterScope scratch(asMasm());
-    loadPtr(dest, scratch);
-    addPtr(imm, scratch);
-    storePtr(scratch, dest);
-}
-
-void
 MacroAssemblerARMCompat::compareDouble(FloatRegister lhs, FloatRegister rhs)
 {
     // Compare the doubles, setting vector status flags.
     if (rhs.isMissing())
         ma_vcmpz(lhs);
     else
         ma_vcmp(lhs, rhs);
 
--- a/js/src/jit/arm/MacroAssembler-arm.h
+++ b/js/src/jit/arm/MacroAssembler-arm.h
@@ -1194,18 +1194,16 @@ class MacroAssemblerARMCompat : public M
         j(cond, label);
     }
     template <typename T>
     void branchSub32(Condition cond, T src, Register dest, Label* label) {
         ma_sub(src, dest, SetCC);
         j(cond, label);
     }
 
-    void addPtr(Register src, Register dest);
-    void addPtr(const Address& src, Register dest);
     void add64(Imm32 imm, Register64 dest) {
         ma_add(imm, dest.low, SetCC);
         ma_adc(Imm32(0), dest.high, LeaveCC);
     }
     void not32(Register reg);
 
     void move32(Imm32 imm, Register dest);
     void move32(Register src, Register dest);
@@ -1650,24 +1648,16 @@ class MacroAssemblerARMCompat : public M
     void cmpPtr(const Address& lhs, ImmPtr rhs);
     void cmpPtr(const Address& lhs, ImmGCPtr rhs);
     void cmpPtr(const Address& lhs, Imm32 rhs);
 
     void subPtr(Imm32 imm, const Register dest);
     void subPtr(const Address& addr, const Register dest);
     void subPtr(Register src, Register dest);
     void subPtr(Register src, const Address& dest);
-    void addPtr(Imm32 imm, const Register dest);
-    void addPtr(Imm32 imm, const Address& dest);
-    void addPtr(ImmWord imm, const Register dest) {
-        addPtr(Imm32(imm.value), dest);
-    }
-    void addPtr(ImmPtr imm, const Register dest) {
-        addPtr(ImmWord(uintptr_t(imm.value)), dest);
-    }
     void mulBy3(const Register& src, const Register& dest) {
         as_add(dest, src, lsl(src, 1));
     }
     void mul64(Imm64 imm, const Register64& dest) {
         // LOW32  = LOW(LOW(dest) * LOW(imm));
         // HIGH32 = LOW(HIGH(dest) * LOW(imm)) [multiply imm into upper bits]
         //        + LOW(LOW(dest) * HIGH(imm)) [multiply dest into upper bits]
         //        + HIGH(LOW(dest) * LOW(imm)) [carry]
--- a/js/src/jit/arm64/MacroAssembler-arm64-inl.h
+++ b/js/src/jit/arm64/MacroAssembler-arm64-inl.h
@@ -146,16 +146,69 @@ MacroAssembler::xorPtr(Imm32 imm, Regist
 {
     Eor(ARMRegister(dest, 64), ARMRegister(dest, 64), Operand(imm.value));
 }
 
 // ===============================================================
 // Arithmetic functions
 
 void
+MacroAssembler::addPtr(Register src, Register dest)
+{
+    addPtr(src, dest, dest);
+}
+
+void
+MacroAssembler::addPtr(Register src1, Register src2, Register dest)
+{
+    Add(ARMRegister(dest, 64), ARMRegister(src1, 64), Operand(ARMRegister(src2, 64)));
+}
+
+void
+MacroAssembler::addPtr(Imm32 imm, Register dest)
+{
+    addPtr(imm, dest, dest);
+}
+
+void
+MacroAssembler::addPtr(Imm32 imm, Register src, Register dest)
+{
+    Add(ARMRegister(dest, 64), ARMRegister(src, 64), Operand(imm.value));
+}
+
+void
+MacroAssembler::addPtr(ImmWord imm, Register dest)
+{
+    Add(ARMRegister(dest, 64), ARMRegister(dest, 64), Operand(imm.value));
+}
+
+void
+MacroAssembler::addPtr(Imm32 imm, const Address& dest)
+{
+    vixl::UseScratchRegisterScope temps(this);
+    const ARMRegister scratch64 = temps.AcquireX();
+    MOZ_ASSERT(scratch64.asUnsized() != dest.base);
+
+    Ldr(scratch64, MemOperand(ARMRegister(dest.base, 64), dest.offset));
+    Add(scratch64, scratch64, Operand(imm.value));
+    Str(scratch64, MemOperand(ARMRegister(dest.base, 64), dest.offset));
+}
+
+void
+MacroAssembler::addPtr(const Address& src, Register dest)
+{
+    vixl::UseScratchRegisterScope temps(this);
+    const ARMRegister scratch64 = temps.AcquireX();
+    MOZ_ASSERT(scratch64.asUnsized() != src.base);
+
+    Ldr(scratch64, MemOperand(ARMRegister(src.base, 64), src.offset));
+    Add(ARMRegister(dest, 64), ARMRegister(dest, 64), Operand(scratch64));
+}
+
+void
 MacroAssembler::add64(Register64 src, Register64 dest)
 {
     addPtr(src.reg, dest.reg);
 }
 
 void
 MacroAssembler::sub32(Imm32 imm, Register dest)
 {
@@ -217,16 +270,30 @@ MacroAssembler::rshift64(Imm32 imm, Regi
     rshiftPtr(imm, dest.reg);
 }
 
 //}}} check_macroassembler_style
 // ===============================================================
 
 template <typename T>
 void
+MacroAssemblerCompat::addToStackPtr(T t)
+{
+    asMasm().addPtr(t, getStackPointer());
+}
+
+template <typename T>
+void
+MacroAssemblerCompat::addStackPtrTo(T t)
+{
+    asMasm().addPtr(getStackPointer(), t);
+}
+
+template <typename T>
+void
 MacroAssemblerCompat::andToStackPtr(T t)
 {
     asMasm().andPtr(t, getStackPointer());
     syncStackPtr();
 }
 
 template <typename T>
 void
--- a/js/src/jit/arm64/MacroAssembler-arm64.cpp
+++ b/js/src/jit/arm64/MacroAssembler-arm64.cpp
@@ -221,17 +221,17 @@ MacroAssemblerCompat::branchPtrInNursery
 {
     MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual);
     MOZ_ASSERT(ptr != temp);
     MOZ_ASSERT(ptr != ScratchReg && ptr != ScratchReg2); // Both may be used internally.
     MOZ_ASSERT(temp != ScratchReg && temp != ScratchReg2);
 
     const Nursery& nursery = GetJitContext()->runtime->gcNursery();
     movePtr(ImmWord(-ptrdiff_t(nursery.start())), temp);
-    addPtr(ptr, temp);
+    asMasm().addPtr(ptr, temp);
     branchPtr(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual,
               temp, ImmWord(nursery.nurserySize()), label);
 }
 
 void
 MacroAssemblerCompat::branchValueIsNurseryObject(Condition cond, ValueOperand value, Register temp,
                                                  Label* label)
 {
@@ -243,17 +243,17 @@ MacroAssemblerCompat::branchValueIsNurse
     // Avoid creating a bogus ObjectValue below.
     if (!nursery.exists())
         return;
 
     // 'Value' representing the start of the nursery tagged as a JSObject
     Value start = ObjectValue(*reinterpret_cast<JSObject*>(nursery.start()));
 
     movePtr(ImmWord(-ptrdiff_t(start.asRawBits())), temp);
-    addPtr(value.valueReg(), temp);
+    asMasm().addPtr(value.valueReg(), temp);
     branchPtr(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual,
               temp, ImmWord(nursery.nurserySize()), label);
 }
 
 void
 MacroAssemblerCompat::breakpoint()
 {
     static int code = 0xA77;
--- a/js/src/jit/arm64/MacroAssembler-arm64.h
+++ b/js/src/jit/arm64/MacroAssembler-arm64.h
@@ -1024,20 +1024,18 @@ class MacroAssemblerCompat : public vixl
     void storeAlignedFloat32x4(FloatRegister src, const Address& addr) { MOZ_CRASH("NYI"); }
     void storeAlignedFloat32x4(FloatRegister src, const BaseIndex& addr) { MOZ_CRASH("NYI"); }
     void loadUnalignedFloat32x4(const Address& addr, FloatRegister dest) { MOZ_CRASH("NYI"); }
     void loadUnalignedFloat32x4(const BaseIndex& addr, FloatRegister dest) { MOZ_CRASH("NYI"); }
     void storeUnalignedFloat32x4(FloatRegister dest, const Address& addr) { MOZ_CRASH("NYI"); }
     void storeUnalignedFloat32x4(FloatRegister dest, const BaseIndex& addr) { MOZ_CRASH("NYI"); }
 
     // StackPointer manipulation.
-    template <typename T>
-    void addToStackPtr(T t) { addPtr(t, getStackPointer()); }
-    template <typename T>
-    void addStackPtrTo(T t) { addPtr(getStackPointer(), t); }
+    template <typename T> void addToStackPtr(T t);
+    template <typename T> void addStackPtrTo(T t);
 
     template <typename T>
     void subFromStackPtr(T t) { subPtr(t, getStackPointer()); syncStackPtr(); }
     template <typename T>
     void subStackPtrFrom(T t) { subPtr(getStackPointer(), t); }
 
     template <typename T> void andToStackPtr(T t);
     template <typename T> void andStackPtrTo(T t);
@@ -1365,53 +1363,16 @@ class MacroAssemblerCompat : public vixl
 
     void subs32(Imm32 imm, Register dest) {
         Subs(ARMRegister(dest, 32), ARMRegister(dest, 32), Operand(imm.value));
     }
     void subs32(Register src, Register dest) {
         Subs(ARMRegister(dest, 32), ARMRegister(dest, 32), Operand(ARMRegister(src, 32)));
     }
 
-    void addPtr(Register src, Register dest) {
-        Add(ARMRegister(dest, 64), ARMRegister(dest, 64), Operand(ARMRegister(src, 64)));
-    }
-    void addPtr(Register src1, Register src2, Register dest) {
-        Add(ARMRegister(dest, 64), ARMRegister(src1, 64), Operand(ARMRegister(src2, 64)));
-    }
-
-    void addPtr(Imm32 imm, Register dest) {
-        Add(ARMRegister(dest, 64), ARMRegister(dest, 64), Operand(imm.value));
-    }
-    void addPtr(Imm32 imm, Register src, Register dest) {
-        Add(ARMRegister(dest, 64), ARMRegister(src, 64), Operand(imm.value));
-    }
-
-    void addPtr(Imm32 imm, const Address& dest) {
-        vixl::UseScratchRegisterScope temps(this);
-        const ARMRegister scratch64 = temps.AcquireX();
-        MOZ_ASSERT(scratch64.asUnsized() != dest.base);
-
-        Ldr(scratch64, MemOperand(ARMRegister(dest.base, 64), dest.offset));
-        Add(scratch64, scratch64, Operand(imm.value));
-        Str(scratch64, MemOperand(ARMRegister(dest.base, 64), dest.offset));
-    }
-    void addPtr(ImmWord imm, Register dest) {
-        Add(ARMRegister(dest, 64), ARMRegister(dest, 64), Operand(imm.value));
-    }
-    void addPtr(ImmPtr imm, Register dest) {
-        Add(ARMRegister(dest, 64), ARMRegister(dest, 64), Operand(uint64_t(imm.value)));
-    }
-    void addPtr(const Address& src, Register dest) {
-        vixl::UseScratchRegisterScope temps(this);
-        const ARMRegister scratch64 = temps.AcquireX();
-        MOZ_ASSERT(scratch64.asUnsized() != src.base);
-
-        Ldr(scratch64, MemOperand(ARMRegister(src.base, 64), src.offset));
-        Add(ARMRegister(dest, 64), ARMRegister(dest, 64), Operand(scratch64));
-    }
     void subPtr(Imm32 imm, Register dest) {
         Sub(ARMRegister(dest, 64), ARMRegister(dest, 64), Operand(imm.value));
     }
     void subPtr(Register src, Register dest) {
         Sub(ARMRegister(dest, 64), ARMRegister(dest, 64), Operand(ARMRegister(src, 64)));
     }
     void subPtr(const Address& addr, Register dest) {
         vixl::UseScratchRegisterScope temps(this);
--- a/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h
+++ b/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h
@@ -74,16 +74,31 @@ MacroAssembler::xor32(Imm32 imm, Registe
 {
     ma_xor(dest, imm);
 }
 
 // ===============================================================
 // Arithmetic instructions
 
 void
+MacroAssembler::addPtr(Imm32 imm, const Address& dest)
+{
+    loadPtr(dest, ScratchRegister);
+    addPtr(imm, ScratchRegister);
+    storePtr(ScratchRegister, dest);
+}
+
+void
+MacroAssembler::addPtr(const Address& src, Register dest)
+{
+    loadPtr(src, ScratchRegister);
+    addPtr(ScratchRegister, dest);
+}
+
+void
 MacroAssembler::sub32(Register src, Register dest)
 {
     as_subu(dest, dest, src);
 }
 
 void
 MacroAssembler::sub32(Imm32 imm, Register dest)
 {
--- a/js/src/jit/mips32/MacroAssembler-mips32-inl.h
+++ b/js/src/jit/mips32/MacroAssembler-mips32-inl.h
@@ -74,16 +74,34 @@ MacroAssembler::xorPtr(Imm32 imm, Regist
 {
     ma_xor(dest, imm);
 }
 
 // ===============================================================
 // Arithmetic functions
 
 void
+MacroAssembler::addPtr(Register src, Register dest)
+{
+    ma_addu(dest, src);
+}
+
+void
+MacroAssembler::addPtr(Imm32 imm, Register dest)
+{
+    ma_addu(dest, imm);
+}
+
+void
+MacroAssembler::addPtr(ImmWord imm, Register dest)
+{
+    addPtr(Imm32(imm.value), dest);
+}
+
+void
 MacroAssembler::add64(Register64 src, Register64 dest)
 {
     as_addu(dest.low, dest.low, src.low);
     as_sltu(ScratchRegister, dest.low, src.low);
     as_addu(dest.high, dest.high, src.high);
     as_addu(dest.high, dest.high, ScratchRegister);
 }
 
@@ -126,12 +144,29 @@ MacroAssembler::rshift64(Imm32 imm, Regi
     as_sll(scratch, dest.high, 32 - imm.value);
     as_or(dest.low, dest.low, scratch);
     as_srl(dest.high, dest.high, imm.value);
 }
 
 //}}} check_macroassembler_style
 // ===============================================================
 
+void
+MacroAssemblerMIPSCompat::computeEffectiveAddress(const BaseIndex& address, Register dest)
+{
+    computeScaledAddress(address, dest);
+    if (address.offset)
+        asMasm().addPtr(Imm32(address.offset), dest);
+}
+
+void
+MacroAssemblerMIPSCompat::retn(Imm32 n) {
+    // pc <- [sp]; sp += n
+    loadPtr(Address(StackPointer, 0), ra);
+    asMasm().addPtr(n, StackPointer);
+    as_jr(ra);
+    as_nop();
+}
+
 } // namespace jit
 } // namespace js
 
 #endif /* jit_mips32_MacroAssembler_mips32_inl_h */
--- a/js/src/jit/mips32/MacroAssembler-mips32.cpp
+++ b/js/src/jit/mips32/MacroAssembler-mips32.cpp
@@ -829,29 +829,16 @@ void
 MacroAssemblerMIPSCompat::add32(Imm32 imm, const Address& dest)
 {
     load32(dest, SecondScratchReg);
     ma_addu(SecondScratchReg, imm);
     store32(SecondScratchReg, dest);
 }
 
 void
-MacroAssemblerMIPSCompat::addPtr(Register src, Register dest)
-{
-    ma_addu(dest, src);
-}
-
-void
-MacroAssemblerMIPSCompat::addPtr(const Address& src, Register dest)
-{
-    loadPtr(src, ScratchRegister);
-    ma_addu(dest, ScratchRegister);
-}
-
-void
 MacroAssemblerMIPSCompat::subPtr(Register src, Register dest)
 {
     as_subu(dest, dest, src);
 }
 
 void
 MacroAssemblerMIPSCompat::move32(Imm32 imm, Register dest)
 {
@@ -1258,30 +1245,16 @@ void
 MacroAssemblerMIPSCompat::subPtr(Register src, const Address& dest)
 {
     loadPtr(dest, SecondScratchReg);
     subPtr(src, SecondScratchReg);
     storePtr(SecondScratchReg, dest);
 }
 
 void
-MacroAssemblerMIPSCompat::addPtr(Imm32 imm, const Register dest)
-{
-    ma_addu(dest, imm);
-}
-
-void
-MacroAssemblerMIPSCompat::addPtr(Imm32 imm, const Address& dest)
-{
-    loadPtr(dest, ScratchRegister);
-    addPtr(imm, ScratchRegister);
-    storePtr(ScratchRegister, dest);
-}
-
-void
 MacroAssemblerMIPSCompat::branchDouble(DoubleCondition cond, FloatRegister lhs,
                                        FloatRegister rhs, Label* label)
 {
     ma_bc1d(lhs, rhs, label, cond);
 }
 
 void
 MacroAssemblerMIPSCompat::branchFloat(DoubleCondition cond, FloatRegister lhs,
@@ -2543,17 +2516,17 @@ MacroAssemblerMIPSCompat::branchPtrInNur
                                                   Label* label)
 {
     MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual);
     MOZ_ASSERT(ptr != temp);
     MOZ_ASSERT(ptr != SecondScratchReg);
 
     const Nursery& nursery = GetJitContext()->runtime->gcNursery();
     movePtr(ImmWord(-ptrdiff_t(nursery.start())), SecondScratchReg);
-    addPtr(ptr, SecondScratchReg);
+    asMasm().addPtr(ptr, SecondScratchReg);
     branchPtr(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual,
               SecondScratchReg, Imm32(nursery.nurserySize()), label);
 }
 
 void
 MacroAssemblerMIPSCompat::branchValueIsNurseryObject(Condition cond, ValueOperand value,
                                                      Register temp, Label* label)
 {
--- a/js/src/jit/mips32/MacroAssembler-mips32.h
+++ b/js/src/jit/mips32/MacroAssembler-mips32.h
@@ -184,22 +184,17 @@ class MacroAssemblerMIPSCompat : public 
     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) {
-            addPtr(Imm32(address.offset), dest);
-        }
-    }
+    inline void computeEffectiveAddress(const BaseIndex& address, Register dest);
 
     void j(Label* dest) {
         ma_b(dest);
     }
 
     void mov(Register src, Register dest) {
         as_ori(dest, src, 0);
     }
@@ -230,23 +225,17 @@ class MacroAssemblerMIPSCompat : public 
     void nop() {
         as_nop();
     }
     void ret() {
         ma_pop(ra);
         as_jr(ra);
         as_nop();
     }
-    void retn(Imm32 n) {
-        // pc <- [sp]; sp += n
-        loadPtr(Address(StackPointer, 0), ra);
-        addPtr(n, StackPointer);
-        as_jr(ra);
-        as_nop();
-    }
+    inline void retn(Imm32 n);
     void push(Imm32 imm) {
         ma_li(ScratchRegister, imm);
         ma_push(ScratchRegister);
     }
     void push(ImmWord imm) {
         ma_li(ScratchRegister, imm);
         ma_push(ScratchRegister);
     }
@@ -1106,19 +1095,17 @@ class MacroAssemblerMIPSCompat : public 
             ma_subu(dest, src);
             ma_b(dest, dest, overflow, cond);
             break;
           default:
             MOZ_CRASH("NYI");
         }
     }
 
-    void addPtr(Register src, Register dest);
     void subPtr(Register src, Register dest);
-    void addPtr(const Address& src, Register dest);
 
     void move32(Imm32 imm, Register dest);
     void move32(Register src, Register dest);
     void move64(Register64 src, Register64 dest) {
         move32(src.low, dest.low);
         move32(src.high, dest.high);
     }
 
@@ -1253,24 +1240,16 @@ class MacroAssemblerMIPSCompat : public 
         moveToDoubleHi(zero, reg);
     }
 
     void clampIntToUint8(Register reg);
 
     void subPtr(Imm32 imm, const Register dest);
     void subPtr(const Address& addr, const Register dest);
     void subPtr(Register src, const Address& dest);
-    void addPtr(Imm32 imm, const Register dest);
-    void addPtr(Imm32 imm, const Address& dest);
-    void addPtr(ImmWord imm, const Register dest) {
-        addPtr(Imm32(imm.value), dest);
-    }
-    void addPtr(ImmPtr imm, const Register dest) {
-        addPtr(ImmWord(uintptr_t(imm.value)), dest);
-    }
     void mulBy3(const Register& src, const Register& dest) {
         as_addu(dest, src, src);
         as_addu(dest, dest, src);
     }
 
     void mul64(Imm64 imm, const Register64& dest);
 
     void convertUInt64ToDouble(Register64 src, Register temp, FloatRegister dest);
--- a/js/src/jit/mips64/MacroAssembler-mips64-inl.h
+++ b/js/src/jit/mips64/MacroAssembler-mips64-inl.h
@@ -72,16 +72,35 @@ MacroAssembler::xorPtr(Imm32 imm, Regist
 {
     ma_xor(dest, imm);
 }
 
 // ===============================================================
 // Arithmetic functions
 
 void
+MacroAssembler::addPtr(Register src, Register dest)
+{
+    ma_daddu(dest, src);
+}
+
+void
+MacroAssembler::addPtr(Imm32 imm, Register dest)
+{
+    ma_daddu(dest, imm);
+}
+
+void
+MacroAssembler::addPtr(ImmWord imm, Register dest)
+{
+    movePtr(imm, ScratchRegister);
+    addPtr(ScratchRegister, dest);
+}
+
+void
 MacroAssembler::add64(Register64 src, Register64 dest)
 {
     addPtr(src.reg, dest.reg);
 }
 
 // ===============================================================
 // Shift functions
 
@@ -113,12 +132,30 @@ void
 MacroAssembler::rshift64(Imm32 imm, Register64 dest)
 {
     ma_dsrl(dest.reg, dest.reg, imm);
 }
 
 //}}} check_macroassembler_style
 // ===============================================================
 
+void
+MacroAssemblerMIPS64Compat::computeEffectiveAddress(const BaseIndex& address, Register dest)
+{
+    computeScaledAddress(address, dest);
+    if (address.offset)
+        asMasm().addPtr(Imm32(address.offset), dest);
+}
+
+void
+MacroAssemblerMIPS64Compat::retn(Imm32 n)
+{
+    // pc <- [sp]; sp += n
+    loadPtr(Address(StackPointer, 0), ra);
+    asMasm().addPtr(n, StackPointer);
+    as_jr(ra);
+    as_nop();
+}
+
 } // namespace jit
 } // namespace js
 
 #endif /* jit_mips64_MacroAssembler_mips64_inl_h */
--- a/js/src/jit/mips64/MacroAssembler-mips64.cpp
+++ b/js/src/jit/mips64/MacroAssembler-mips64.cpp
@@ -914,29 +914,16 @@ void
 MacroAssemblerMIPS64Compat::add32(Imm32 imm, const Address& dest)
 {
     load32(dest, SecondScratchReg);
     ma_addu(SecondScratchReg, imm);
     store32(SecondScratchReg, dest);
 }
 
 void
-MacroAssemblerMIPS64Compat::addPtr(Register src, Register dest)
-{
-    ma_daddu(dest, src);
-}
-
-void
-MacroAssemblerMIPS64Compat::addPtr(const Address& src, Register dest)
-{
-    loadPtr(src, ScratchRegister);
-    ma_daddu(dest, ScratchRegister);
-}
-
-void
 MacroAssemblerMIPS64Compat::subPtr(Register src, Register dest)
 {
     as_dsubu(dest, dest, src);
 }
 
 void
 MacroAssemblerMIPS64Compat::move32(Imm32 imm, Register dest)
 {
@@ -1344,30 +1331,16 @@ void
 MacroAssemblerMIPS64Compat::subPtr(Register src, const Address& dest)
 {
     loadPtr(dest, SecondScratchReg);
     subPtr(src, SecondScratchReg);
     storePtr(SecondScratchReg, dest);
 }
 
 void
-MacroAssemblerMIPS64Compat::addPtr(Imm32 imm, const Register dest)
-{
-    ma_daddu(dest, imm);
-}
-
-void
-MacroAssemblerMIPS64Compat::addPtr(Imm32 imm, const Address& dest)
-{
-    loadPtr(dest, ScratchRegister);
-    addPtr(imm, ScratchRegister);
-    storePtr(ScratchRegister, dest);
-}
-
-void
 MacroAssemblerMIPS64Compat::branchDouble(DoubleCondition cond, FloatRegister lhs,
                                          FloatRegister rhs, Label* label)
 {
     ma_bc1d(lhs, rhs, label, cond);
 }
 
 void
 MacroAssemblerMIPS64Compat::branchFloat(DoubleCondition cond, FloatRegister lhs,
@@ -2646,33 +2619,33 @@ MacroAssemblerMIPS64Compat::branchPtrInN
                                                     Label* label)
 {
     MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual);
     MOZ_ASSERT(ptr != temp);
     MOZ_ASSERT(ptr != SecondScratchReg);
 
     const Nursery& nursery = GetJitContext()->runtime->gcNursery();
     movePtr(ImmWord(-ptrdiff_t(nursery.start())), SecondScratchReg);
-    addPtr(ptr, SecondScratchReg);
+    asMasm().addPtr(ptr, SecondScratchReg);
     branchPtr(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual,
               SecondScratchReg, Imm32(nursery.nurserySize()), label);
 }
 
 void
 MacroAssemblerMIPS64Compat::branchValueIsNurseryObject(Condition cond, ValueOperand value,
                                                        Register temp, Label* label)
 {
     MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual);
 
     // 'Value' representing the start of the nursery tagged as a JSObject
     const Nursery& nursery = GetJitContext()->runtime->gcNursery();
     Value start = ObjectValue(*reinterpret_cast<JSObject *>(nursery.start()));
 
     movePtr(ImmWord(-ptrdiff_t(start.asRawBits())), SecondScratchReg);
-    addPtr(value.valueReg(), SecondScratchReg);
+    asMasm().addPtr(value.valueReg(), SecondScratchReg);
     branchPtr(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual,
               SecondScratchReg, Imm32(nursery.nurserySize()), label);
 }
 
 void
 MacroAssemblerMIPS64Compat::profilerEnterFrame(Register framePtr, Register scratch)
 {
     AbsoluteAddress activation(GetJitContext()->runtime->addressOfProfilingActivation());
--- a/js/src/jit/mips64/MacroAssembler-mips64.h
+++ b/js/src/jit/mips64/MacroAssembler-mips64.h
@@ -196,22 +196,17 @@ class MacroAssemblerMIPS64Compat : publi
     void movq(Register rs, Register rd);
 
     void computeScaledAddress(const BaseIndex& address, Register dest);
 
     void computeEffectiveAddress(const Address& address, Register dest) {
         ma_daddu(dest, address.base, Imm32(address.offset));
     }
 
-    void computeEffectiveAddress(const BaseIndex& address, Register dest) {
-        computeScaledAddress(address, dest);
-        if (address.offset) {
-            addPtr(Imm32(address.offset), dest);
-        }
-    }
+    inline void computeEffectiveAddress(const BaseIndex& address, Register dest);
 
     void j(Label* dest) {
         ma_b(dest);
     }
 
     void mov(Register src, Register dest) {
         as_ori(dest, src, 0);
     }
@@ -251,23 +246,17 @@ class MacroAssemblerMIPS64Compat : publi
     void nop() {
         as_nop();
     }
     void ret() {
         ma_pop(ra);
         as_jr(ra);
         as_nop();
     }
-    void retn(Imm32 n) {
-        // pc <- [sp]; sp += n
-        loadPtr(Address(StackPointer, 0), ra);
-        addPtr(n, StackPointer);
-        as_jr(ra);
-        as_nop();
-    }
+    inline void retn(Imm32 n);
     void push(Imm32 imm) {
         ma_li(ScratchRegister, imm);
         ma_push(ScratchRegister);
     }
     void push(ImmWord imm) {
         ma_li(ScratchRegister, imm);
         ma_push(ScratchRegister);
     }
@@ -1121,19 +1110,17 @@ class MacroAssemblerMIPS64Compat : publi
             ma_subu(dest, src);
             ma_b(dest, dest, overflow, cond);
             break;
           default:
             MOZ_CRASH("NYI");
         }
     }
 
-    void addPtr(Register src, Register dest);
     void subPtr(Register src, Register dest);
-    void addPtr(const Address& src, Register dest);
 
     void move32(Imm32 imm, Register dest);
     void move32(Register src, Register dest);
     void move64(Register64 src, Register64 dest) {
         movePtr(src.reg, dest.reg);
     }
 
     void movePtr(Register src, Register dest);
@@ -1264,25 +1251,16 @@ class MacroAssemblerMIPS64Compat : publi
         moveToDouble(zero, reg);
     }
 
     void clampIntToUint8(Register reg);
 
     void subPtr(Imm32 imm, const Register dest);
     void subPtr(const Address& addr, const Register dest);
     void subPtr(Register src, const Address& dest);
-    void addPtr(Imm32 imm, const Register dest);
-    void addPtr(Imm32 imm, const Address& dest);
-    void addPtr(ImmWord imm, const Register dest) {
-        movePtr(imm, ScratchRegister);
-        addPtr(ScratchRegister, dest);
-    }
-    void addPtr(ImmPtr imm, const Register dest) {
-        addPtr(ImmWord(uintptr_t(imm.value)), dest);
-    }
     void mulBy3(const Register& src, const Register& dest) {
         as_daddu(dest, src, src);
         as_daddu(dest, dest, src);
     }
 
     void mul64(Imm64 imm, const Register64& dest) {
         MOZ_ASSERT(dest.reg != ScratchRegister);
         mov(ImmWord(imm.value), ScratchRegister);
--- a/js/src/jit/none/MacroAssembler-none.h
+++ b/js/src/jit/none/MacroAssembler-none.h
@@ -230,17 +230,16 @@ class MacroAssemblerNone : public Assemb
     void testNullSet(Condition, ValueOperand, Register) { MOZ_CRASH(); }
     void testObjectSet(Condition, ValueOperand, Register) { MOZ_CRASH(); }
     void testUndefinedSet(Condition, ValueOperand, Register) { MOZ_CRASH(); }
 
     template <typename T, typename S> void cmpPtrSet(Condition, T, S, Register) { MOZ_CRASH(); }
     template <typename T, typename S> void cmp32Set(Condition, T, S, Register) { MOZ_CRASH(); }
 
     template <typename T, typename S> void add32(T, S) { MOZ_CRASH(); }
-    template <typename T, typename S> void addPtr(T, S) { MOZ_CRASH(); }
     template <typename T, typename S> void add64(T, S) { MOZ_CRASH(); }
     template <typename T, typename S> void subPtr(T, S) { MOZ_CRASH(); }
     void neg32(Register) { MOZ_CRASH(); }
     void mulBy3(Register, Register) { MOZ_CRASH(); }
     void mul64(Imm64, const Register64&) { MOZ_CRASH(); }
 
     void negateDouble(FloatRegister) { MOZ_CRASH(); }
     void addDouble(FloatRegister, FloatRegister) { MOZ_CRASH(); }
--- a/js/src/jit/x64/MacroAssembler-x64-inl.h
+++ b/js/src/jit/x64/MacroAssembler-x64-inl.h
@@ -71,16 +71,59 @@ MacroAssembler::xorPtr(Imm32 imm, Regist
 {
     xorq(imm, dest);
 }
 
 // ===============================================================
 // Arithmetic functions
 
 void
+MacroAssembler::addPtr(Register src, Register dest)
+{
+    addq(src, dest);
+}
+
+void
+MacroAssembler::addPtr(Imm32 imm, Register dest)
+{
+    addq(imm, dest);
+}
+
+void
+MacroAssembler::addPtr(ImmWord imm, Register dest)
+{
+    ScratchRegisterScope scratch(*this);
+    MOZ_ASSERT(dest != scratch);
+    if ((intptr_t)imm.value <= INT32_MAX && (intptr_t)imm.value >= INT32_MIN) {
+        addq(Imm32((int32_t)imm.value), dest);
+    } else {
+        mov(imm, scratch);
+        addq(scratch, dest);
+    }
+}
+
+void
+MacroAssembler::addPtr(Imm32 imm, const Address& dest)
+{
+    addq(imm, Operand(dest));
+}
+
+void
+MacroAssembler::addPtr(Imm32 imm, const AbsoluteAddress& dest)
+{
+    addq(imm, Operand(dest));
+}
+
+void
+MacroAssembler::addPtr(const Address& src, Register dest)
+{
+    addq(Operand(src), dest);
+}
+
+void
 MacroAssembler::add64(Register64 src, Register64 dest)
 {
     addq(src.reg, dest.reg);
 }
 
 // ===============================================================
 // Shift functions
 
@@ -112,12 +155,30 @@ void
 MacroAssembler::rshift64(Imm32 imm, Register64 dest)
 {
     shrq(imm, dest.reg);
 }
 
 //}}} check_macroassembler_style
 // ===============================================================
 
+void
+MacroAssemblerX64::inc64(AbsoluteAddress dest)
+{
+    if (X86Encoding::IsAddressImmediate(dest.addr)) {
+        asMasm().addPtr(Imm32(1), dest);
+    } else {
+        ScratchRegisterScope scratch(asMasm());
+        mov(ImmPtr(dest.addr), scratch);
+        asMasm().addPtr(Imm32(1), Address(scratch, 0));
+    }
+}
+
+void
+MacroAssemblerX64::incrementInt32Value(const Address& addr)
+{
+    asMasm().addPtr(Imm32(1), addr);
+}
+
 } // namespace jit
 } // namespace js
 
 #endif /* jit_x64_MacroAssembler_x64_inl_h */
--- a/js/src/jit/x64/MacroAssembler-x64.cpp
+++ b/js/src/jit/x64/MacroAssembler-x64.cpp
@@ -260,17 +260,17 @@ MacroAssemblerX64::branchPtrInNurseryRan
     ScratchRegisterScope scratch(asMasm());
 
     MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual);
     MOZ_ASSERT(ptr != temp);
     MOZ_ASSERT(ptr != scratch);
 
     const Nursery& nursery = GetJitContext()->runtime->gcNursery();
     movePtr(ImmWord(-ptrdiff_t(nursery.start())), scratch);
-    addPtr(ptr, scratch);
+    asMasm().addPtr(ptr, scratch);
     branchPtr(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual,
               scratch, Imm32(nursery.nurserySize()), label);
 }
 
 void
 MacroAssemblerX64::branchValueIsNurseryObject(Condition cond, ValueOperand value, Register temp,
                                               Label* label)
 {
@@ -282,17 +282,17 @@ MacroAssemblerX64::branchValueIsNurseryO
     if (!nursery.exists())
         return;
 
     // 'Value' representing the start of the nursery tagged as a JSObject
     Value start = ObjectValue(*reinterpret_cast<JSObject*>(nursery.start()));
 
     ScratchRegisterScope scratch(asMasm());
     movePtr(ImmWord(-ptrdiff_t(start.asRawBits())), scratch);
-    addPtr(value.valueReg(), scratch);
+    asMasm().addPtr(value.valueReg(), scratch);
     branchPtr(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual,
               scratch, Imm32(nursery.nurserySize()), label);
 }
 
 void
 MacroAssemblerX64::profilerEnterFrame(Register framePtr, Register scratch)
 {
     AbsoluteAddress activation(GetJitContext()->runtime->addressOfProfilingActivation());
--- a/js/src/jit/x64/MacroAssembler-x64.h
+++ b/js/src/jit/x64/MacroAssembler-x64.h
@@ -538,44 +538,16 @@ class MacroAssemblerX64 : public MacroAs
         cmpPtr(lhs, rhs);
         emitSet(cond, dest);
     }
 
     /////////////////////////////////////////////////////////////////
     // Common interface.
     /////////////////////////////////////////////////////////////////
 
-    void addPtr(Register src, Register dest) {
-        addq(src, dest);
-    }
-    void addPtr(Imm32 imm, Register dest) {
-        addq(imm, dest);
-    }
-    void addPtr(Imm32 imm, const Address& dest) {
-        addq(imm, Operand(dest));
-    }
-    void addPtr(Imm32 imm, const Operand& dest) {
-        addq(imm, dest);
-    }
-    void addPtr(ImmWord imm, Register dest) {
-        ScratchRegisterScope scratch(asMasm());
-        MOZ_ASSERT(dest != scratch);
-        if ((intptr_t)imm.value <= INT32_MAX && (intptr_t)imm.value >= INT32_MIN) {
-            addq(Imm32((int32_t)imm.value), dest);
-        } else {
-            mov(imm, scratch);
-            addq(scratch, dest);
-        }
-    }
-    void addPtr(ImmPtr imm, Register dest) {
-        addPtr(ImmWord(uintptr_t(imm.value)), dest);
-    }
-    void addPtr(const Address& src, Register dest) {
-        addq(Operand(src), dest);
-    }
     void add64(Imm32 imm, Register64 dest) {
         addq(imm, dest.reg);
     }
     void subPtr(Imm32 imm, Register dest) {
         subq(imm, dest);
     }
     void subPtr(Register src, Register dest) {
         subq(src, dest);
@@ -1346,29 +1318,19 @@ class MacroAssemblerX64 : public MacroAs
         vcvtsi2sdq(src.reg, dest);
     }
 
     void mulDoublePtr(ImmPtr imm, Register temp, FloatRegister dest) {
         movq(imm, ScratchReg);
         vmulsd(Operand(ScratchReg, 0), dest, dest);
     }
 
-    void inc64(AbsoluteAddress dest) {
-        if (X86Encoding::IsAddressImmediate(dest.addr)) {
-            addPtr(Imm32(1), Operand(dest));
-        } else {
-            ScratchRegisterScope scratch(asMasm());
-            mov(ImmPtr(dest.addr), scratch);
-            addPtr(Imm32(1), Address(scratch, 0));
-        }
-    }
+    inline void inc64(AbsoluteAddress dest);
 
-    void incrementInt32Value(const Address& addr) {
-        addPtr(Imm32(1), addr);
-    }
+    inline void incrementInt32Value(const Address& addr);
 
     // If source is a double, load it into dest. If source is int32,
     // convert it to double. Else, branch to failure.
     void ensureDouble(const ValueOperand& source, FloatRegister dest, Label* failure) {
         Label isDouble, done;
         Register tag = splitTagForTest(source);
         branchTestDouble(Assembler::Equal, tag, &isDouble);
         branchTestInt32(Assembler::NotEqual, tag, failure);
--- a/js/src/jit/x86-shared/MoveEmitter-x86-shared.cpp
+++ b/js/src/jit/x86-shared/MoveEmitter-x86-shared.cpp
@@ -435,17 +435,18 @@ MoveEmitterX86::emitGeneralMove(const Mo
             masm.lea(toOperand(from), reg.value());
             masm.mov(reg.value(), toOperand(to));
         } else {
             // This is tricky without a scratch reg. We can't do an lea. Bounce the
             // base register off the stack, then add the offset in place. Note that
             // this clobbers FLAGS!
             masm.Push(from.base());
             masm.Pop(toPopOperand(to));
-            masm.addPtr(Imm32(from.disp()), toOperand(to));
+            MOZ_ASSERT(to.isMemoryOrEffectiveAddress());
+            masm.addPtr(Imm32(from.disp()), toAddress(to));
         }
     }
 }
 
 void
 MoveEmitterX86::emitFloat32Move(const MoveOperand& from, const MoveOperand& to)
 {
     MOZ_ASSERT_IF(from.isFloatReg(), from.floatReg().isSingle());
--- a/js/src/jit/x86/MacroAssembler-x86-inl.h
+++ b/js/src/jit/x86/MacroAssembler-x86-inl.h
@@ -11,16 +11,17 @@
 
 #include "jit/x86-shared/MacroAssembler-x86-shared-inl.h"
 
 namespace js {
 namespace jit {
 
 //{{{ check_macroassembler_style
 // ===============================================================
+// Logical functions
 
 void
 MacroAssembler::andPtr(Register src, Register dest)
 {
     andl(src, dest);
 }
 
 void
@@ -73,16 +74,52 @@ MacroAssembler::xorPtr(Imm32 imm, Regist
 {
     xorl(imm, dest);
 }
 
 // ===============================================================
 // Arithmetic functions
 
 void
+MacroAssembler::addPtr(Register src, Register dest)
+{
+    addl(src, dest);
+}
+
+void
+MacroAssembler::addPtr(Imm32 imm, Register dest)
+{
+    addl(imm, dest);
+}
+
+void
+MacroAssembler::addPtr(ImmWord imm, Register dest)
+{
+    addl(Imm32(imm.value), dest);
+}
+
+void
+MacroAssembler::addPtr(Imm32 imm, const Address& dest)
+{
+    addl(imm, Operand(dest));
+}
+
+void
+MacroAssembler::addPtr(Imm32 imm, const AbsoluteAddress& dest)
+{
+    addl(imm, Operand(dest));
+}
+
+void
+MacroAssembler::addPtr(const Address& src, Register dest)
+{
+    addl(Operand(src), dest);
+}
+
+void
 MacroAssembler::add64(Register64 src, Register64 dest)
 {
     addl(src.low, dest.low);
     adcl(src.high, dest.high);
 }
 
 // ===============================================================
 // Shift functions
--- a/js/src/jit/x86/MacroAssembler-x86.cpp
+++ b/js/src/jit/x86/MacroAssembler-x86.cpp
@@ -350,17 +350,17 @@ MacroAssemblerX86::branchPtrInNurseryRan
                                            Label* label)
 {
     MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual);
     MOZ_ASSERT(ptr != temp);
     MOZ_ASSERT(temp != InvalidReg);  // A temp register is required for x86.
 
     const Nursery& nursery = GetJitContext()->runtime->gcNursery();
     movePtr(ImmWord(-ptrdiff_t(nursery.start())), temp);
-    addPtr(ptr, temp);
+    asMasm().addPtr(ptr, temp);
     branchPtr(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual,
               temp, Imm32(nursery.nurserySize()), label);
 }
 
 void
 MacroAssemblerX86::branchValueIsNurseryObject(Condition cond, ValueOperand value, Register temp,
                                               Label* label)
 {
--- a/js/src/jit/x86/MacroAssembler-x86.h
+++ b/js/src/jit/x86/MacroAssembler-x86.h
@@ -561,37 +561,16 @@ class MacroAssemblerX86 : public MacroAs
         cmpPtr(lhs, rhs);
         emitSet(cond, dest);
     }
 
     /////////////////////////////////////////////////////////////////
     // Common interface.
     /////////////////////////////////////////////////////////////////
 
-    void addPtr(Register src, Register dest) {
-        add32(src, dest);
-    }
-    void addPtr(Imm32 imm, Register dest) {
-        add32(imm, dest);
-    }
-    void addPtr(ImmWord imm, Register dest) {
-        add32(Imm32(imm.value), dest);
-    }
-    void addPtr(ImmPtr imm, Register dest) {
-        addPtr(ImmWord(uintptr_t(imm.value)), dest);
-    }
-    void addPtr(Imm32 imm, const Address& dest) {
-        add32(imm, Operand(dest));
-    }
-    void addPtr(Imm32 imm, const Operand& dest) {
-        add32(imm, dest);
-    }
-    void addPtr(const Address& src, Register dest) {
-        addl(Operand(src), dest);
-    }
     void add64(Imm32 imm, Register64 dest) {
         addl(imm, dest.low);
         adcl(Imm32(0), dest.high);
     }
     void subPtr(Imm32 imm, Register dest) {
         subl(imm, dest);
     }
     void subPtr(Register src, Register dest) {