Bug 1245112 - Part 23: Move MacroAssembler::branchTestBoolean into generic macro assembler. r=sstangl
authorTooru Fujisawa <arai_a@mac.com>
Thu, 03 Mar 2016 08:03:42 +0900
changeset 286545 e28770d913990481aa6e5054924d6f6a2023b470
parent 286544 6db0c9d5144e0fc9cd98cd33a440ac970ab008f0
child 286546 53abfbd00384ab2656296de21621ff093aab90db
push id30050
push usercbook@mozilla.com
push dateThu, 03 Mar 2016 10:54:59 +0000
treeherdermozilla-central@2b5237c178ea [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 23: Move MacroAssembler::branchTestBoolean 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
@@ -922,32 +922,38 @@ class MacroAssembler : public MacroAssem
     inline void branchTestNeedsIncrementalBarrier(Condition cond, Label* label);
 
     // Perform a type-test on a tag of a Value (32bits boxing), or the tagged
     // value (64bits boxing).
     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;
 
     // Perform a type-test on a Value, addressed by Address or BaseIndex, or
     // loaded into ValueOperand.
     inline void branchTestInt32(Condition cond, const Address& address, Label* label) PER_SHARED_ARCH;
     inline void branchTestInt32(Condition cond, const BaseIndex& address, Label* label) PER_SHARED_ARCH;
     inline void branchTestInt32(Condition cond, const ValueOperand& value, Label* label)
         DEFINED_ON(arm, arm64, mips32, mips64, x86_shared);
 
     inline void branchTestDouble(Condition cond, const Address& address, Label* label) PER_SHARED_ARCH;
     inline void branchTestDouble(Condition cond, const BaseIndex& address, Label* label) PER_SHARED_ARCH;
     inline void branchTestDouble(Condition cond, const ValueOperand& value, Label* label)
         DEFINED_ON(arm, arm64, mips32, mips64, x86_shared);
 
     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);
+
     // 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;
 
   private:
 
@@ -956,16 +962,19 @@ class MacroAssembler : public MacroAssem
     inline void branchTestInt32Impl(Condition cond, const T& t, Label* label)
         DEFINED_ON(arm, arm64, x86_shared);
     template <typename T>
     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);
 
     //}}} 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
@@ -892,16 +892,48 @@ MacroAssembler::branchTestNumber(Conditi
 template <typename T>
 void
 MacroAssembler::branchTestNumberImpl(Condition cond, const T& t, Label* label)
 {
     cond = testNumber(cond, t);
     ma_b(label, cond);
 }
 
+void
+MacroAssembler::branchTestBoolean(Condition cond, Register tag, Label* label)
+{
+    branchTestBooleanImpl(cond, tag, label);
+}
+
+void
+MacroAssembler::branchTestBoolean(Condition cond, const Address& address, Label* label)
+{
+    branchTestBooleanImpl(cond, address, label);
+}
+
+void
+MacroAssembler::branchTestBoolean(Condition cond, const BaseIndex& address, Label* label)
+{
+    branchTestBooleanImpl(cond, address, label);
+}
+
+void
+MacroAssembler::branchTestBoolean(Condition cond, const ValueOperand& value, Label* label)
+{
+    branchTestBooleanImpl(cond, value, label);
+}
+
+template <typename T>
+void
+MacroAssembler::branchTestBooleanImpl(Condition cond, const T& t, Label* label)
+{
+    Condition c = testBoolean(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
@@ -758,21 +758,16 @@ class MacroAssemblerARMCompat : public M
     Condition testDoubleTruthy(bool truthy, FloatRegister reg);
     Condition testStringTruthy(bool truthy, const ValueOperand& value);
 
     void boolValueToFloat32(const ValueOperand& operand, FloatRegister dest);
     void int32ValueToFloat32(const ValueOperand& operand, FloatRegister dest);
     void loadConstantFloat32(float f, FloatRegister dest);
 
     template<typename T>
-    void branchTestBoolean(Condition cond, const T & t, Label* label) {
-        Condition c = testBoolean(cond, t);
-        ma_b(label, c);
-    }
-    template<typename T>
     void branchTestNull(Condition cond, const T & t, Label* label) {
         Condition c = testNull(cond, t);
         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);
--- a/js/src/jit/arm64/MacroAssembler-arm64-inl.h
+++ b/js/src/jit/arm64/MacroAssembler-arm64-inl.h
@@ -991,16 +991,48 @@ MacroAssembler::branchTestNumber(Conditi
 template <typename T>
 void
 MacroAssembler::branchTestNumberImpl(Condition cond, const T& t, Label* label)
 {
     Condition c = testNumber(cond, t);
     B(label, c);
 }
 
+void
+MacroAssembler::branchTestBoolean(Condition cond, Register tag, Label* label)
+{
+    branchTestBooleanImpl(cond, tag, label);
+}
+
+void
+MacroAssembler::branchTestBoolean(Condition cond, const Address& address, Label* label)
+{
+    branchTestBooleanImpl(cond, address, label);
+}
+
+void
+MacroAssembler::branchTestBoolean(Condition cond, const BaseIndex& address, Label* label)
+{
+    branchTestBooleanImpl(cond, address, label);
+}
+
+void
+MacroAssembler::branchTestBoolean(Condition cond, const ValueOperand& value, Label* label)
+{
+    branchTestBooleanImpl(cond, value, label);
+}
+
+template <typename T>
+void
+MacroAssembler::branchTestBooleanImpl(Condition cond, const T& tag, Label* label)
+{
+    Condition c = testBoolean(cond, tag);
+    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,20 +1327,16 @@ class MacroAssemblerCompat : public vixl
     CodeOffsetJump backedgeJump(RepatchLabel* label, Label* documentation = nullptr) {
         return jumpWithPatch(label, Always, documentation);
     }
 
     void branchTestUndefined(Condition cond, Register tag, Label* label) {
         Condition c = testUndefined(cond, tag);
         B(label, c);
     }
-    void branchTestBoolean(Condition cond, Register tag, Label* label) {
-        Condition c = testBoolean(cond, tag);
-        B(label, c);
-    }
     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);
     }
@@ -1352,20 +1348,16 @@ class MacroAssemblerCompat : public vixl
         Condition c = testObject(cond, tag);
         B(label, c);
     }
 
     void branchTestUndefined(Condition cond, const Address& address, Label* label) {
         Condition c = testUndefined(cond, address);
         B(label, c);
     }
-    void branchTestBoolean(Condition cond, const Address& address, Label* label) {
-        Condition c = testDouble(cond, address);
-        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);
     }
@@ -1379,20 +1371,16 @@ class MacroAssemblerCompat : public vixl
     }
 
     // Perform a type-test on a full Value loaded into a register.
     // Clobbers the ScratchReg.
     void branchTestUndefined(Condition cond, const ValueOperand& src, Label* label) {
         Condition c = testUndefined(cond, src);
         B(label, c);
     }
-    void branchTestBoolean(Condition cond, const ValueOperand& src, Label* label) {
-        Condition c = testBoolean(cond, src);
-        B(label, c);
-    }
     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);
     }
@@ -1406,20 +1394,16 @@ class MacroAssemblerCompat : public vixl
     }
 
     // Perform a type-test on a Value addressed by BaseIndex.
     // Clobbers the ScratchReg.
     void branchTestUndefined(Condition cond, const BaseIndex& address, Label* label) {
         Condition c = testUndefined(cond, address);
         B(label, c);
     }
-    void branchTestBoolean(Condition cond, const BaseIndex& address, Label* label) {
-        Condition c = testBoolean(cond, address);
-        B(label, c);
-    }
     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);
     }
--- a/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h
+++ b/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h
@@ -559,15 +559,38 @@ MacroAssembler::branchTestDoubleTruthy(b
 void
 MacroAssembler::branchTestNumber(Condition cond, Register tag, Label* label)
 {
     MOZ_ASSERT(cond == Equal || cond == NotEqual);
     Condition actual = cond == Equal ? BelowOrEqual : Above;
     ma_b(tag, ImmTag(JSVAL_UPPER_INCL_TAG_OF_NUMBER_SET), label, actual);
 }
 
+void
+MacroAssembler::branchTestBoolean(Condition cond, Register tag, Label* label)
+{
+    MOZ_ASSERT(cond == Equal || cond == NotEqual);
+    ma_b(tag, ImmTag(JSVAL_TAG_BOOLEAN), label, cond);
+}
+
+void
+MacroAssembler::branchTestBoolean(Condition cond, const Address& address, Label* label)
+{
+    SecondScratchRegisterScope scratch2(*this);
+    extractTag(address, scratch2);
+    branchTestBoolean(cond, scratch2, label);
+}
+
+void
+MacroAssembler::branchTestBoolean(Condition cond, const BaseIndex& address, Label* label)
+{
+    SecondScratchRegisterScope scratch2(*this);
+    extractTag(address, scratch2);
+    branchTestBoolean(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
@@ -317,16 +317,23 @@ MacroAssembler::branchTestDouble(Conditi
 }
 
 void
 MacroAssembler::branchTestNumber(Condition cond, const ValueOperand& value, Label* label)
 {
     branchTestNumber(cond, value.typeReg(), label);
 }
 
+void
+MacroAssembler::branchTestBoolean(Condition cond, const ValueOperand& value, Label* label)
+{
+    MOZ_ASSERT(cond == Equal || cond == NotEqual);
+    ma_b(value.typeReg(), ImmType(JSVAL_TYPE_BOOLEAN), label, cond);
+}
+
 //}}} 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
@@ -1122,47 +1122,16 @@ void
 MacroAssemblerMIPSCompat::branchTestPrimitive(Condition cond, Register tag, Label* label)
 {
     MOZ_ASSERT(cond == Equal || cond == NotEqual);
     ma_b(tag, ImmTag(JSVAL_UPPER_EXCL_TAG_OF_PRIMITIVE_SET), label,
          (cond == Equal) ? Below : AboveOrEqual);
 }
 
 void
-MacroAssemblerMIPSCompat:: branchTestBoolean(Condition cond, const ValueOperand& value,
-                                             Label* label)
-{
-    MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual);
-    ma_b(value.typeReg(), ImmType(JSVAL_TYPE_BOOLEAN), label, cond);
-}
-
-void
-MacroAssemblerMIPSCompat:: branchTestBoolean(Condition cond, Register tag, Label* label)
-{
-    MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual);
-    ma_b(tag, ImmType(JSVAL_TYPE_BOOLEAN), label, cond);
-}
-
-void
-MacroAssemblerMIPSCompat::branchTestBoolean(Condition cond, const Address& address, Label* label)
-{
-    MOZ_ASSERT(cond == Equal || cond == NotEqual);
-    extractTag(address, SecondScratchReg);
-    ma_b(SecondScratchReg, ImmTag(JSVAL_TAG_BOOLEAN), label, cond);
-}
-
-void
-MacroAssemblerMIPSCompat::branchTestBoolean(Condition cond, const BaseIndex& src, Label* label)
-{
-    MOZ_ASSERT(cond == Equal || cond == NotEqual);
-    extractTag(src, SecondScratchReg);
-    ma_b(SecondScratchReg, ImmType(JSVAL_TYPE_BOOLEAN), label, cond);
-}
-
-void
 MacroAssemblerMIPSCompat::branchTestNull(Condition cond, const ValueOperand& value, Label* label)
 {
     MOZ_ASSERT(cond == Equal || cond == NotEqual);
     ma_b(value.typeReg(), ImmType(JSVAL_TYPE_NULL), label, cond);
 }
 
 void
 MacroAssemblerMIPSCompat::branchTestNull(Condition cond, Register tag, Label* label)
--- a/js/src/jit/mips32/MacroAssembler-mips32.h
+++ b/js/src/jit/mips32/MacroAssembler-mips32.h
@@ -370,22 +370,16 @@ class MacroAssemblerMIPSCompat : public 
     void loadInt32OrDouble(Register base, Register index,
                            FloatRegister dest, int32_t shift = defaultShift);
     void loadConstantDouble(double dp, FloatRegister dest);
 
     void boolValueToFloat32(const ValueOperand& operand, FloatRegister dest);
     void int32ValueToFloat32(const ValueOperand& operand, FloatRegister dest);
     void loadConstantFloat32(float f, FloatRegister dest);
 
-    void branchTestBoolean(Condition cond, const ValueOperand& value, Label* label);
-    void branchTestBoolean(Condition cond, Register tag, Label* label);
-    void branchTestBoolean(Condition cond, const Address& address, Label* label);
-    void branchTestBoolean(Condition cond, const BaseIndex& src, Label* label);
-
-
     void branchTestNull(Condition cond, const ValueOperand& value, Label* label);
     void branchTestNull(Condition cond, Register tag, Label* label);
     void branchTestNull(Condition cond, const BaseIndex& src, Label* label);
     void branchTestNull(Condition cond, const Address& address, Label* label);
     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);
--- a/js/src/jit/mips64/MacroAssembler-mips64-inl.h
+++ b/js/src/jit/mips64/MacroAssembler-mips64-inl.h
@@ -259,16 +259,24 @@ MacroAssembler::branchTestDouble(Conditi
 void
 MacroAssembler::branchTestNumber(Condition cond, const ValueOperand& value, Label* label)
 {
     SecondScratchRegisterScope scratch2(*this);
     splitTag(value, scratch2);
     branchTestNumber(cond, scratch2, label);
 }
 
+void
+MacroAssembler::branchTestBoolean(Condition cond, const ValueOperand& value, Label* label)
+{
+    SecondScratchRegisterScope scratch2(*this);
+    splitTag(value, scratch2);
+    branchTestBoolean(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
@@ -1250,48 +1250,16 @@ void
 MacroAssemblerMIPS64Compat::branchTestPrimitive(Condition cond, Register tag, Label* label)
 {
     MOZ_ASSERT(cond == Equal || cond == NotEqual);
     ma_b(tag, ImmTag(JSVAL_UPPER_EXCL_TAG_OF_PRIMITIVE_SET), label,
          (cond == Equal) ? Below : AboveOrEqual);
 }
 
 void
-MacroAssemblerMIPS64Compat:: branchTestBoolean(Condition cond, const ValueOperand& value,
-                                               Label* label)
-{
-    MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual);
-    splitTag(value, SecondScratchReg);
-    ma_b(SecondScratchReg, ImmTag(JSVAL_TAG_BOOLEAN), label, cond);
-}
-
-void
-MacroAssemblerMIPS64Compat:: branchTestBoolean(Condition cond, Register tag, Label* label)
-{
-    MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual);
-    ma_b(tag, ImmTag(JSVAL_TAG_BOOLEAN), label, cond);
-}
-
-void
-MacroAssemblerMIPS64Compat::branchTestBoolean(Condition cond, const Address& address, Label* label)
-{
-    MOZ_ASSERT(cond == Equal || cond == NotEqual);
-    extractTag(address, SecondScratchReg);
-    ma_b(SecondScratchReg, ImmTag(JSVAL_TAG_BOOLEAN), label, cond);
-}
-
-void
-MacroAssemblerMIPS64Compat::branchTestBoolean(Condition cond, const BaseIndex& src, Label* label)
-{
-    MOZ_ASSERT(cond == Equal || cond == NotEqual);
-    extractTag(src, SecondScratchReg);
-    ma_b(SecondScratchReg, ImmTag(JSVAL_TAG_BOOLEAN), label, cond);
-}
-
-void
 MacroAssemblerMIPS64Compat::branchTestNull(Condition cond, const ValueOperand& value, Label* label)
 {
     MOZ_ASSERT(cond == Equal || cond == NotEqual);
     splitTag(value, SecondScratchReg);
     ma_b(SecondScratchReg, ImmTag(JSVAL_TAG_NULL), label, cond);
 }
 
 void
--- a/js/src/jit/mips64/MacroAssembler-mips64.h
+++ b/js/src/jit/mips64/MacroAssembler-mips64.h
@@ -411,22 +411,16 @@ class MacroAssemblerMIPS64Compat : publi
     void loadInt32OrDouble(const Address& src, FloatRegister dest);
     void loadInt32OrDouble(const BaseIndex& addr, FloatRegister dest);
     void loadConstantDouble(double dp, FloatRegister dest);
 
     void boolValueToFloat32(const ValueOperand& operand, FloatRegister dest);
     void int32ValueToFloat32(const ValueOperand& operand, FloatRegister dest);
     void loadConstantFloat32(float f, FloatRegister dest);
 
-    void branchTestBoolean(Condition cond, const ValueOperand& value, Label* label);
-    void branchTestBoolean(Condition cond, Register tag, Label* label);
-    void branchTestBoolean(Condition cond, const Address& address, Label* label);
-    void branchTestBoolean(Condition cond, const BaseIndex& src, Label* label);
-
-
     void branchTestNull(Condition cond, const ValueOperand& value, Label* label);
     void branchTestNull(Condition cond, Register tag, Label* label);
     void branchTestNull(Condition cond, const BaseIndex& src, Label* label);
     void branchTestNull(Condition cond, const Address& address, Label* label);
     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);
--- 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 branchTestUndefined(Condition, T, Label*) { MOZ_CRASH(); }
-    template <typename T> void branchTestBoolean(Condition, T, Label*) { 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(); }
--- a/js/src/jit/x64/MacroAssembler-x64.h
+++ b/js/src/jit/x64/MacroAssembler-x64.h
@@ -328,19 +328,18 @@ class MacroAssemblerX64 : public MacroAs
         splitTag(src, scratch);
         return testUndefined(cond, scratch);
     }
     Condition testInt32(Condition cond, const Address& src) {
         cmp32(ToUpper32(src), Imm32(Upper32Of(GetShiftedTag(JSVAL_TYPE_INT32))));
         return cond;
     }
     Condition testBoolean(Condition cond, const Address& src) {
-        ScratchRegisterScope scratch(asMasm());
-        splitTag(src, scratch);
-        return testBoolean(cond, scratch);
+        cmp32(ToUpper32(src), Imm32(Upper32Of(GetShiftedTag(JSVAL_TYPE_BOOLEAN))));
+        return cond;
     }
     Condition testDouble(Condition cond, const Address& src) {
         ScratchRegisterScope scratch(asMasm());
         splitTag(src, scratch);
         return testDouble(cond, scratch);
     }
     Condition testNumber(Condition cond, const Address& src) {
         ScratchRegisterScope scratch(asMasm());
@@ -685,20 +684,16 @@ class MacroAssemblerX64 : public MacroAs
         Register reg = splitTagForTest(operand);
         cmp32(reg, tag);
     }
 
     void branchTestUndefined(Condition cond, Register tag, Label* label) {
         cond = testUndefined(cond, tag);
         j(cond, label);
     }
-    void branchTestBoolean(Condition cond, Register tag, Label* label) {
-        cond = testBoolean(cond, tag);
-        j(cond, label);
-    }
     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);
     }
@@ -718,25 +713,16 @@ class MacroAssemblerX64 : public MacroAs
         MOZ_ASSERT(cond == Equal || cond == NotEqual);
         cmp32(ToUpper32(operand), Imm32(Upper32Of(GetShiftedTag(JSVAL_TYPE_UNDEFINED))));
         j(cond, label);
     }
     void branchTestUndefined(Condition cond, const Address& address, Label* label) {
         MOZ_ASSERT(cond == Equal || cond == NotEqual);
         branchTestUndefined(cond, Operand(address), label);
     }
-    void branchTestBoolean(Condition cond, const Operand& operand, Label* label) {
-        MOZ_ASSERT(cond == Equal || cond == NotEqual);
-        cmp32(ToUpper32(operand), Imm32(Upper32Of(GetShiftedTag(JSVAL_TYPE_BOOLEAN))));
-        j(cond, label);
-    }
-    void branchTestBoolean(Condition cond, const Address& address, Label* label) {
-        MOZ_ASSERT(cond == Equal || cond == NotEqual);
-        branchTestBoolean(cond, Operand(address), label);
-    }
     void branchTestNull(Condition cond, const Operand& operand, Label* label) {
         MOZ_ASSERT(cond == Equal || cond == NotEqual);
         cmp32(ToUpper32(operand), Imm32(Upper32Of(GetShiftedTag(JSVAL_TYPE_NULL))));
         j(cond, label);
     }
     void branchTestNull(Condition cond, const Address& address, Label* label) {
         MOZ_ASSERT(cond == Equal || cond == NotEqual);
         branchTestNull(cond, Operand(address), label);
@@ -749,21 +735,16 @@ class MacroAssemblerX64 : public MacroAs
     }
 
     // Perform a type-test on a full Value loaded into a register.
     // Clobbers the ScratchReg.
     void branchTestUndefined(Condition cond, const ValueOperand& src, Label* label) {
         cond = testUndefined(cond, src);
         j(cond, label);
     }
-    void branchTestBoolean(Condition cond, const ValueOperand& src, Label* label) {
-        ScratchRegisterScope scratch(asMasm());
-        splitTag(src, scratch);
-        branchTestBoolean(cond, scratch, label);
-    }
     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);
     }
@@ -777,21 +758,16 @@ class MacroAssemblerX64 : public MacroAs
     }
 
     // Perform a type-test on a Value addressed by BaseIndex.
     // Clobbers the ScratchReg.
     void branchTestUndefined(Condition cond, const BaseIndex& address, Label* label) {
         cond = testUndefined(cond, address);
         j(cond, label);
     }
-    void branchTestBoolean(Condition cond, const BaseIndex& address, Label* label) {
-        ScratchRegisterScope scratch(asMasm());
-        splitTag(address, scratch);
-        branchTestBoolean(cond, scratch, label);
-    }
     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);
     }
--- a/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h
+++ b/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h
@@ -521,16 +521,48 @@ MacroAssembler::branchTestNumber(Conditi
 template <typename T>
 void
 MacroAssembler::branchTestNumberImpl(Condition cond, const T& t, Label* label)
 {
     cond = testNumber(cond, t);
     j(cond, label);
 }
 
+void
+MacroAssembler::branchTestBoolean(Condition cond, Register tag, Label* label)
+{
+    branchTestBooleanImpl(cond, tag, label);
+}
+
+void
+MacroAssembler::branchTestBoolean(Condition cond, const Address& address, Label* label)
+{
+    branchTestBooleanImpl(cond, address, label);
+}
+
+void
+MacroAssembler::branchTestBoolean(Condition cond, const BaseIndex& address, Label* label)
+{
+    branchTestBooleanImpl(cond, address, label);
+}
+
+void
+MacroAssembler::branchTestBoolean(Condition cond, const ValueOperand& value, Label* label)
+{
+    branchTestBooleanImpl(cond, value, label);
+}
+
+template <typename T>
+void
+MacroAssembler::branchTestBooleanImpl(Condition cond, const T& t, Label* label)
+{
+    cond = testBoolean(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 branchTestUndefined(Condition cond, const T& t, Label* label) {
         cond = testUndefined(cond, t);
         j(cond, label);
     }
     template <typename T>
-    void branchTestBoolean(Condition cond, const T& t, Label* label) {
-        cond = testBoolean(cond, t);
-        j(cond, label);
-    }
-    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);