Bug 1245112 - Part 26: Move MacroAssembler::branchTestString into generic macro assembler. r=sstangl
authorTooru Fujisawa <arai_a@mac.com>
Thu, 03 Mar 2016 08:03:43 +0900
changeset 322884 0915a28459b5e4550ffe3b9e62775c47435f19c7
parent 322883 d7cc18bce598c3f843c0ed5e7ad582042629971d
child 322885 067c628f3135648e001eb10bf34fe1de505d1511
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssstangl
bugs1245112
milestone47.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 1245112 - Part 26: Move MacroAssembler::branchTestString into generic macro assembler. r=sstangl
js/src/jit/MacroAssembler.h
js/src/jit/arm/MacroAssembler-arm-inl.h
js/src/jit/arm/MacroAssembler-arm.h
js/src/jit/arm64/MacroAssembler-arm64-inl.h
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.h
js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h
js/src/jit/x86/MacroAssembler-x86.h
--- a/js/src/jit/MacroAssembler.h
+++ b/js/src/jit/MacroAssembler.h
@@ -924,16 +924,17 @@ class MacroAssembler : public MacroAssem
     // Perform a type-test on a tag of a Value (32bits boxing), or the tagged
     // value (64bits boxing).
     inline void branchTestUndefined(Condition cond, Register tag, Label* label) PER_SHARED_ARCH;
     inline void branchTestInt32(Condition cond, Register tag, Label* label) PER_SHARED_ARCH;
     inline void branchTestDouble(Condition cond, Register tag, Label* label)
         DEFINED_ON(arm, arm64, mips32, mips64, x86_shared);
     inline void branchTestNumber(Condition cond, Register tag, Label* label) PER_SHARED_ARCH;
     inline void branchTestBoolean(Condition cond, Register tag, Label* label) PER_SHARED_ARCH;
+    inline void branchTestString(Condition cond, Register tag, Label* label) PER_SHARED_ARCH;
 
     // Perform a type-test on a Value, addressed by Address or BaseIndex, or
     // loaded into ValueOperand.
     inline void branchTestUndefined(Condition cond, const Address& address, Label* label) PER_SHARED_ARCH;
     inline void branchTestUndefined(Condition cond, const BaseIndex& address, Label* label) PER_SHARED_ARCH;
     inline void branchTestUndefined(Condition cond, const ValueOperand& value, Label* label)
         DEFINED_ON(arm, arm64, mips32, mips64, x86_shared);
 
@@ -950,16 +951,20 @@ class MacroAssembler : public MacroAssem
     inline void branchTestNumber(Condition cond, const ValueOperand& value, Label* label)
         DEFINED_ON(arm, arm64, mips32, mips64, x86_shared);
 
     inline void branchTestBoolean(Condition cond, const Address& address, Label* label) PER_SHARED_ARCH;
     inline void branchTestBoolean(Condition cond, const BaseIndex& address, Label* label) PER_SHARED_ARCH;
     inline void branchTestBoolean(Condition cond, const ValueOperand& value, Label* label)
         DEFINED_ON(arm, arm64, mips32, mips64, x86_shared);
 
+    inline void branchTestString(Condition cond, const BaseIndex& address, Label* label) PER_SHARED_ARCH;
+    inline void branchTestString(Condition cond, const ValueOperand& value, Label* label)
+        DEFINED_ON(arm, arm64, mips32, mips64, x86_shared);
+
     // Checks if given Value is evaluated to true or false in a condition.
     // The type of the value should match the type of the method.
     inline void branchTestInt32Truthy(bool truthy, const ValueOperand& value, Label* label)
         DEFINED_ON(arm, arm64, mips32, mips64, x86_shared);
     inline void branchTestDoubleTruthy(bool truthy, FloatRegister reg, Label* label) PER_SHARED_ARCH;
     inline void branchTestBooleanTruthy(bool truthy, const ValueOperand& value, Label* label) PER_ARCH;
 
   private:
@@ -975,16 +980,19 @@ class MacroAssembler : public MacroAssem
     inline void branchTestDoubleImpl(Condition cond, const T& t, Label* label)
         DEFINED_ON(arm, arm64, x86_shared);
     template <typename T>
     inline void branchTestNumberImpl(Condition cond, const T& t, Label* label)
         DEFINED_ON(arm, arm64, x86_shared);
     template <typename T>
     inline void branchTestBooleanImpl(Condition cond, const T& t, Label* label)
         DEFINED_ON(arm, arm64, x86_shared);
+    template <typename T>
+    inline void branchTestStringImpl(Condition cond, const T& t, Label* label)
+        DEFINED_ON(arm, arm64, x86_shared);
 
     //}}} check_macroassembler_style
   public:
 
     // Emits a test of a value against all types in a TypeSet. A scratch
     // register is required.
     template <typename Source>
     void guardTypeSet(const Source& address, const TypeSet* types, BarrierKind kind, Register scratch, Label* miss);
--- a/js/src/jit/arm/MacroAssembler-arm-inl.h
+++ b/js/src/jit/arm/MacroAssembler-arm-inl.h
@@ -963,16 +963,42 @@ MacroAssembler::branchTestBooleanImpl(Co
 
 void
 MacroAssembler::branchTestBooleanTruthy(bool truthy, const ValueOperand& value, Label* label)
 {
     Condition c = testBooleanTruthy(truthy, value);
     ma_b(label, c);
 }
 
+void
+MacroAssembler::branchTestString(Condition cond, Register tag, Label* label)
+{
+    branchTestStringImpl(cond, tag, label);
+}
+
+void
+MacroAssembler::branchTestString(Condition cond, const BaseIndex& address, Label* label)
+{
+    branchTestStringImpl(cond, address, label);
+}
+
+void
+MacroAssembler::branchTestString(Condition cond, const ValueOperand& value, Label* label)
+{
+    branchTestStringImpl(cond, value, label);
+}
+
+template <typename T>
+void
+MacroAssembler::branchTestStringImpl(Condition cond, const T& t, Label* label)
+{
+    Condition c = testString(cond, t);
+    ma_b(label, c);
+}
+
 //}}} check_macroassembler_style
 // ===============================================================
 
 void
 MacroAssemblerARMCompat::incrementInt32Value(const Address& addr)
 {
     asMasm().add32(Imm32(1), ToPayload(addr));
 }
--- a/js/src/jit/arm/MacroAssembler-arm.h
+++ b/js/src/jit/arm/MacroAssembler-arm.h
@@ -768,21 +768,16 @@ class MacroAssemblerARMCompat : public M
         ma_b(label, c);
     }
     template<typename T>
     void branchTestObject(Condition cond, const T & t, Label* label) {
         Condition c = testObject(cond, t);
         ma_b(label, c);
     }
     template<typename T>
-    void branchTestString(Condition cond, const T & t, Label* label) {
-        Condition c = testString(cond, t);
-        ma_b(label, c);
-    }
-    template<typename T>
     void branchTestSymbol(Condition cond, const T & t, Label* label) {
         Condition c = testSymbol(cond, t);
         ma_b(label, c);
     }
     template <typename T, class L>
     void branchTestMagic(Condition cond, const T& t, L label) {
         cond = testMagic(cond, t);
         ma_b(label, cond);
--- a/js/src/jit/arm64/MacroAssembler-arm64-inl.h
+++ b/js/src/jit/arm64/MacroAssembler-arm64-inl.h
@@ -1062,16 +1062,42 @@ MacroAssembler::branchTestBooleanImpl(Co
 
 void
 MacroAssembler::branchTestBooleanTruthy(bool truthy, const ValueOperand& value, Label* label)
 {
     Condition c = testBooleanTruthy(truthy, value);
     B(label, c);
 }
 
+void
+MacroAssembler::branchTestString(Condition cond, Register tag, Label* label)
+{
+    branchTestStringImpl(cond, tag, label);
+}
+
+void
+MacroAssembler::branchTestString(Condition cond, const BaseIndex& address, Label* label)
+{
+    branchTestStringImpl(cond, address, label);
+}
+
+void
+MacroAssembler::branchTestString(Condition cond, const ValueOperand& value, Label* label)
+{
+    branchTestStringImpl(cond, value, label);
+}
+
+template <typename T>
+void
+MacroAssembler::branchTestStringImpl(Condition cond, const T& t, Label* label)
+{
+    Condition c = testString(cond, t);
+    B(label, c);
+}
+
 //}}} check_macroassembler_style
 // ===============================================================
 
 template <typename T>
 void
 MacroAssemblerCompat::addToStackPtr(T t)
 {
     asMasm().addPtr(t, getStackPointer());
--- a/js/src/jit/arm64/MacroAssembler-arm64.h
+++ b/js/src/jit/arm64/MacroAssembler-arm64.h
@@ -1327,75 +1327,59 @@ class MacroAssemblerCompat : public vixl
     CodeOffsetJump backedgeJump(RepatchLabel* label, Label* documentation = nullptr) {
         return jumpWithPatch(label, Always, documentation);
     }
 
     void branchTestNull(Condition cond, Register tag, Label* label) {
         Condition c = testNull(cond, tag);
         B(label, c);
     }
-    void branchTestString(Condition cond, Register tag, Label* label) {
-        Condition c = testString(cond, tag);
-        B(label, c);
-    }
     void branchTestSymbol(Condition cond, Register tag, Label* label) {
         Condition c = testSymbol(cond, tag);
         B(label, c);
     }
     void branchTestObject(Condition cond, Register tag, Label* label) {
         Condition c = testObject(cond, tag);
         B(label, c);
     }
 
     void branchTestNull(Condition cond, const Address& address, Label* label) {
         Condition c = testNull(cond, address);
         B(label, c);
     }
-    void branchTestString(Condition cond, const Address& address, Label* label) {
-        Condition c = testString(cond, address);
-        B(label, c);
-    }
     void branchTestSymbol(Condition cond, const Address& address, Label* label) {
         Condition c = testSymbol(cond, address);
         B(label, c);
     }
     void branchTestObject(Condition cond, const Address& address, Label* label) {
         Condition c = testObject(cond, address);
         B(label, c);
     }
 
     // Perform a type-test on a full Value loaded into a register.
     // Clobbers the ScratchReg.
     void branchTestNull(Condition cond, const ValueOperand& src, Label* label) {
         Condition c = testNull(cond, src);
         B(label, c);
     }
-    void branchTestString(Condition cond, const ValueOperand& src, Label* label) {
-        Condition c = testString(cond, src);
-        B(label, c);
-    }
     void branchTestSymbol(Condition cond, const ValueOperand& src, Label* label) {
         Condition c = testSymbol(cond, src);
         B(label, c);
     }
     void branchTestObject(Condition cond, const ValueOperand& src, Label* label) {
         Condition c = testObject(cond, src);
         B(label, c);
     }
 
     // Perform a type-test on a Value addressed by BaseIndex.
     // Clobbers the ScratchReg.
     void branchTestNull(Condition cond, const BaseIndex& address, Label* label) {
         Condition c = testNull(cond, address);
         B(label, c);
     }
-    void branchTestString(Condition cond, const BaseIndex& address, Label* label) {
-        Condition c = testString(cond, address);
-        B(label, c);
-    }
     void branchTestSymbol(Condition cond, const BaseIndex& address, Label* label) {
         Condition c = testSymbol(cond, address);
         B(label, c);
     }
     void branchTestObject(Condition cond, const BaseIndex& address, Label* label) {
         Condition c = testObject(cond, address);
         B(label, c);
     }
--- a/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h
+++ b/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h
@@ -605,15 +605,30 @@ MacroAssembler::branchTestBoolean(Condit
 void
 MacroAssembler::branchTestBoolean(Condition cond, const BaseIndex& address, Label* label)
 {
     SecondScratchRegisterScope scratch2(*this);
     extractTag(address, scratch2);
     branchTestBoolean(cond, scratch2, label);
 }
 
+void
+MacroAssembler::branchTestString(Condition cond, Register tag, Label* label)
+{
+    MOZ_ASSERT(cond == Equal || cond == NotEqual);
+    ma_b(tag, ImmTag(JSVAL_TAG_STRING), label, cond);
+}
+
+void
+MacroAssembler::branchTestString(Condition cond, const BaseIndex& address, Label* label)
+{
+    SecondScratchRegisterScope scratch2(*this);
+    extractTag(address, scratch2);
+    branchTestString(cond, scratch2, label);
+}
+
 //}}} check_macroassembler_style
 // ===============================================================
 
 } // namespace jit
 } // namespace js
 
 #endif /* jit_mips_shared_MacroAssembler_mips_shared_inl_h */
--- a/js/src/jit/mips32/MacroAssembler-mips32-inl.h
+++ b/js/src/jit/mips32/MacroAssembler-mips32-inl.h
@@ -336,16 +336,22 @@ MacroAssembler::branchTestBoolean(Condit
 }
 
 void
 MacroAssembler::branchTestBooleanTruthy(bool b, const ValueOperand& value, Label* label)
 {
     ma_b(value.payloadReg(), value.payloadReg(), label, b ? NonZero : Zero);
 }
 
+void
+MacroAssembler::branchTestString(Condition cond, const ValueOperand& value, Label* label)
+{
+    branchTestString(cond, value.typeReg(), label);
+}
+
 //}}} check_macroassembler_style
 // ===============================================================
 
 void
 MacroAssemblerMIPSCompat::incrementInt32Value(const Address& addr)
 {
     asMasm().add32(Imm32(1), ToPayload(addr));
 }
--- a/js/src/jit/mips32/MacroAssembler-mips32.cpp
+++ b/js/src/jit/mips32/MacroAssembler-mips32.cpp
@@ -1194,37 +1194,16 @@ MacroAssemblerMIPSCompat::branchTestObje
 void
 MacroAssemblerMIPSCompat::testObjectSet(Condition cond, const ValueOperand& value, Register dest)
 {
     MOZ_ASSERT(cond == Equal || cond == NotEqual);
     ma_cmp_set(dest, value.typeReg(), ImmType(JSVAL_TYPE_OBJECT), cond);
 }
 
 void
-MacroAssemblerMIPSCompat::branchTestString(Condition cond, const ValueOperand& value, Label* label)
-{
-    branchTestString(cond, value.typeReg(), label);
-}
-
-void
-MacroAssemblerMIPSCompat::branchTestString(Condition cond, Register tag, Label* label)
-{
-    MOZ_ASSERT(cond == Equal || cond == NotEqual);
-    ma_b(tag, ImmTag(JSVAL_TAG_STRING), label, cond);
-}
-
-void
-MacroAssemblerMIPSCompat::branchTestString(Condition cond, const BaseIndex& src, Label* label)
-{
-    MOZ_ASSERT(cond == Equal || cond == NotEqual);
-    extractTag(src, SecondScratchReg);
-    ma_b(SecondScratchReg, ImmTag(JSVAL_TAG_STRING), label, cond);
-}
-
-void
 MacroAssemblerMIPSCompat::branchTestSymbol(Condition cond, const ValueOperand& value, Label* label)
 {
     branchTestSymbol(cond, value.typeReg(), label);
 }
 
 void
 MacroAssemblerMIPSCompat::branchTestSymbol(Condition cond, const Register& tag, Label* label)
 {
--- a/js/src/jit/mips32/MacroAssembler-mips32.h
+++ b/js/src/jit/mips32/MacroAssembler-mips32.h
@@ -382,20 +382,16 @@ class MacroAssemblerMIPSCompat : public 
     void testNullSet(Condition cond, const ValueOperand& value, Register dest);
 
     void branchTestObject(Condition cond, const ValueOperand& value, Label* label);
     void branchTestObject(Condition cond, Register tag, Label* label);
     void branchTestObject(Condition cond, const BaseIndex& src, Label* label);
     void branchTestObject(Condition cond, const Address& src, Label* label);
     void testObjectSet(Condition cond, const ValueOperand& value, Register dest);
 
-    void branchTestString(Condition cond, const ValueOperand& value, Label* label);
-    void branchTestString(Condition cond, Register tag, Label* label);
-    void branchTestString(Condition cond, const BaseIndex& src, Label* label);
-
     void branchTestSymbol(Condition cond, const ValueOperand& value, Label* label);
     void branchTestSymbol(Condition cond, const Register& tag, Label* label);
     void branchTestSymbol(Condition cond, const BaseIndex& src, Label* label);
 
     void testUndefinedSet(Condition cond, const ValueOperand& value, Register dest);
 
     void branchTestMagic(Condition cond, const ValueOperand& value, Label* label);
     void branchTestMagic(Condition cond, const ValueOperand& value, wasm::JumpTarget target);
--- a/js/src/jit/mips64/MacroAssembler-mips64-inl.h
+++ b/js/src/jit/mips64/MacroAssembler-mips64-inl.h
@@ -283,16 +283,24 @@ MacroAssembler::branchTestBoolean(Condit
 void
 MacroAssembler::branchTestBooleanTruthy(bool b, const ValueOperand& value, Label* label)
 {
     SecondScratchRegisterScope scratch2(*this);
     unboxBoolean(value, scratch2);
     ma_b(scratch2, scratch2, label, b ? NonZero : Zero);
 }
 
+void
+MacroAssembler::branchTestString(Condition cond, const ValueOperand& value, Label* label)
+{
+    SecondScratchRegisterScope scratch2(*this);
+    splitTag(value, scratch2);
+    branchTestString(cond, scratch2, label);
+}
+
 //}}} check_macroassembler_style
 // ===============================================================
 
 void
 MacroAssemblerMIPS64Compat::incrementInt32Value(const Address& addr)
 {
     asMasm().add32(Imm32(1), addr);
 }
--- a/js/src/jit/mips64/MacroAssembler-mips64.cpp
+++ b/js/src/jit/mips64/MacroAssembler-mips64.cpp
@@ -1326,38 +1326,16 @@ void
 MacroAssemblerMIPS64Compat::testObjectSet(Condition cond, const ValueOperand& value, Register dest)
 {
     MOZ_ASSERT(cond == Equal || cond == NotEqual);
     splitTag(value, SecondScratchReg);
     ma_cmp_set(dest, SecondScratchReg, ImmTag(JSVAL_TAG_OBJECT), cond);
 }
 
 void
-MacroAssemblerMIPS64Compat::branchTestString(Condition cond, const ValueOperand& value, Label* label)
-{
-    splitTag(value, SecondScratchReg);
-    branchTestString(cond, SecondScratchReg, label);
-}
-
-void
-MacroAssemblerMIPS64Compat::branchTestString(Condition cond, Register tag, Label* label)
-{
-    MOZ_ASSERT(cond == Equal || cond == NotEqual);
-    ma_b(tag, ImmTag(JSVAL_TAG_STRING), label, cond);
-}
-
-void
-MacroAssemblerMIPS64Compat::branchTestString(Condition cond, const BaseIndex& src, Label* label)
-{
-    MOZ_ASSERT(cond == Equal || cond == NotEqual);
-    extractTag(src, SecondScratchReg);
-    ma_b(SecondScratchReg, ImmTag(JSVAL_TAG_STRING), label, cond);
-}
-
-void
 MacroAssemblerMIPS64Compat::branchTestSymbol(Condition cond, const ValueOperand& value, Label* label)
 {
     splitTag(value, SecondScratchReg);
     branchTestSymbol(cond, SecondScratchReg, label);
 }
 
 void
 MacroAssemblerMIPS64Compat::branchTestSymbol(Condition cond, const Register& tag, Label* label)
--- a/js/src/jit/mips64/MacroAssembler-mips64.h
+++ b/js/src/jit/mips64/MacroAssembler-mips64.h
@@ -423,20 +423,16 @@ class MacroAssemblerMIPS64Compat : publi
     void testNullSet(Condition cond, const ValueOperand& value, Register dest);
 
     void branchTestObject(Condition cond, const ValueOperand& value, Label* label);
     void branchTestObject(Condition cond, Register tag, Label* label);
     void branchTestObject(Condition cond, const BaseIndex& src, Label* label);
     void branchTestObject(Condition cond, const Address& src, Label* label);
     void testObjectSet(Condition cond, const ValueOperand& value, Register dest);
 
-    void branchTestString(Condition cond, const ValueOperand& value, Label* label);
-    void branchTestString(Condition cond, Register tag, Label* label);
-    void branchTestString(Condition cond, const BaseIndex& src, Label* label);
-
     void branchTestSymbol(Condition cond, const ValueOperand& value, Label* label);
     void branchTestSymbol(Condition cond, const Register& tag, Label* label);
     void branchTestSymbol(Condition cond, const BaseIndex& src, Label* label);
 
     void testUndefinedSet(Condition cond, const ValueOperand& value, Register dest);
 
     void branchTestMagic(Condition cond, const ValueOperand& value, Label* label);
     void branchTestMagic(Condition cond, const ValueOperand& value, wasm::JumpTarget target);
--- a/js/src/jit/none/MacroAssembler-none.h
+++ b/js/src/jit/none/MacroAssembler-none.h
@@ -341,17 +341,16 @@ class MacroAssemblerNone : public Assemb
     template <typename T, typename S> void atomicXor16(const T& value, const S& mem) { MOZ_CRASH(); }
     template <typename T, typename S> void atomicXor32(const T& value, const S& mem) { MOZ_CRASH(); }
 
     void clampIntToUint8(Register) { MOZ_CRASH(); }
 
     Register splitTagForTest(ValueOperand) { MOZ_CRASH(); }
 
     template <typename T> void branchTestNull(Condition, T, Label*) { MOZ_CRASH(); }
-    template <typename T> void branchTestString(Condition, T, Label*) { MOZ_CRASH(); }
     template <typename T> void branchTestSymbol(Condition, T, Label*) { MOZ_CRASH(); }
     template <typename T> void branchTestObject(Condition, T, Label*) { MOZ_CRASH(); }
     template <typename T> void branchTestGCThing(Condition, T, Label*) { MOZ_CRASH(); }
     template <typename T> void branchTestPrimitive(Condition, T, Label*) { MOZ_CRASH(); }
     template <typename T, typename L> void branchTestMagic(Condition, T, L) { MOZ_CRASH(); }
     template <typename T> void branchTestMagicValue(Condition, T, JSWhyMagic, Label*) { MOZ_CRASH(); }
     void boxDouble(FloatRegister, ValueOperand) { MOZ_CRASH(); }
     void boxNonDouble(JSValueType, Register, ValueOperand) { MOZ_CRASH(); }
--- a/js/src/jit/x64/MacroAssembler-x64.h
+++ b/js/src/jit/x64/MacroAssembler-x64.h
@@ -683,20 +683,16 @@ class MacroAssemblerX64 : public MacroAs
         Register reg = splitTagForTest(operand);
         cmp32(reg, tag);
     }
 
     void branchTestNull(Condition cond, Register tag, Label* label) {
         cond = testNull(cond, tag);
         j(cond, label);
     }
-    void branchTestString(Condition cond, Register tag, Label* label) {
-        cond = testString(cond, tag);
-        j(cond, label);
-    }
     void branchTestSymbol(Condition cond, Register tag, Label* label) {
         cond = testSymbol(cond, tag);
         j(cond, label);
     }
     void branchTestObject(Condition cond, Register tag, Label* label) {
         cond = testObject(cond, tag);
         j(cond, label);
     }
@@ -721,39 +717,31 @@ class MacroAssemblerX64 : public MacroAs
     }
 
     // Perform a type-test on a full Value loaded into a register.
     // Clobbers the ScratchReg.
     void branchTestNull(Condition cond, const ValueOperand& src, Label* label) {
         cond = testNull(cond, src);
         j(cond, label);
     }
-    void branchTestString(Condition cond, const ValueOperand& src, Label* label) {
-        cond = testString(cond, src);
-        j(cond, label);
-    }
     void branchTestSymbol(Condition cond, const ValueOperand& src, Label* label) {
         cond = testSymbol(cond, src);
         j(cond, label);
     }
     void branchTestObject(Condition cond, const ValueOperand& src, Label* label) {
         cond = testObject(cond, src);
         j(cond, label);
     }
 
     // Perform a type-test on a Value addressed by BaseIndex.
     // Clobbers the ScratchReg.
     void branchTestNull(Condition cond, const BaseIndex& address, Label* label) {
         cond = testNull(cond, address);
         j(cond, label);
     }
-    void branchTestString(Condition cond, const BaseIndex& address, Label* label) {
-        cond = testString(cond, address);
-        j(cond, label);
-    }
     void branchTestSymbol(Condition cond, const BaseIndex& address, Label* label) {
         cond = testSymbol(cond, address);
         j(cond, label);
     }
     void branchTestObject(Condition cond, const BaseIndex& address, Label* label) {
         cond = testObject(cond, address);
         j(cond, label);
     }
--- a/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h
+++ b/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h
@@ -585,16 +585,42 @@ MacroAssembler::branchTestBoolean(Condit
 template <typename T>
 void
 MacroAssembler::branchTestBooleanImpl(Condition cond, const T& t, Label* label)
 {
     cond = testBoolean(cond, t);
     j(cond, label);
 }
 
+void
+MacroAssembler::branchTestString(Condition cond, Register tag, Label* label)
+{
+    branchTestStringImpl(cond, tag, label);
+}
+
+void
+MacroAssembler::branchTestString(Condition cond, const BaseIndex& address, Label* label)
+{
+    branchTestStringImpl(cond, address, label);
+}
+
+void
+MacroAssembler::branchTestString(Condition cond, const ValueOperand& value, Label* label)
+{
+    branchTestStringImpl(cond, value, label);
+}
+
+template <typename T>
+void
+MacroAssembler::branchTestStringImpl(Condition cond, const T& t, Label* label)
+{
+    cond = testString(cond, t);
+    j(cond, label);
+}
+
 //}}} check_macroassembler_style
 // ===============================================================
 
 void
 MacroAssemblerX86Shared::clampIntToUint8(Register reg)
 {
     Label inRange;
     asMasm().branchTest32(Assembler::Zero, reg, Imm32(0xffffff00), &inRange);
--- a/js/src/jit/x86/MacroAssembler-x86.h
+++ b/js/src/jit/x86/MacroAssembler-x86.h
@@ -660,21 +660,16 @@ class MacroAssemblerX86 : public MacroAs
     // Type testing instructions can take a tag in a register or a
     // ValueOperand.
     template <typename T>
     void branchTestNull(Condition cond, const T& t, Label* label) {
         cond = testNull(cond, t);
         j(cond, label);
     }
     template <typename T>
-    void branchTestString(Condition cond, const T& t, Label* label) {
-        cond = testString(cond, t);
-        j(cond, label);
-    }
-    template <typename T>
     void branchTestSymbol(Condition cond, const T& t, Label* label) {
         cond = testSymbol(cond, t);
         j(cond, label);
     }
     template <typename T>
     void branchTestObject(Condition cond, const T& t, Label* label) {
         cond = testObject(cond, t);
         j(cond, label);