diff --git a/js/src/jit/MacroAssembler.h b/js/src/jit/MacroAssembler.h index 8f81f725de25..082d7c412b74 100644 --- a/js/src/jit/MacroAssembler.h +++ b/js/src/jit/MacroAssembler.h @@ -930,6 +930,7 @@ class MacroAssembler : public MacroAssemblerSpecific 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; + inline void branchTestSymbol(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. @@ -960,6 +961,10 @@ class MacroAssembler : public MacroAssemblerSpecific inline void branchTestString(Condition cond, const ValueOperand& value, Label* label) DEFINED_ON(arm, arm64, mips32, mips64, x86_shared); + inline void branchTestSymbol(Condition cond, const BaseIndex& address, Label* label) PER_SHARED_ARCH; + inline void branchTestSymbol(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) @@ -990,6 +995,9 @@ class MacroAssembler : public MacroAssemblerSpecific template inline void branchTestStringImpl(Condition cond, const T& t, Label* label) DEFINED_ON(arm, arm64, x86_shared); + template + inline void branchTestSymbolImpl(Condition cond, const T& t, Label* label) + DEFINED_ON(arm, arm64, x86_shared); //}}} check_macroassembler_style public: diff --git a/js/src/jit/arm/MacroAssembler-arm-inl.h b/js/src/jit/arm/MacroAssembler-arm-inl.h index 71e9c0be5a30..61f7ec62bdcb 100644 --- a/js/src/jit/arm/MacroAssembler-arm-inl.h +++ b/js/src/jit/arm/MacroAssembler-arm-inl.h @@ -1001,6 +1001,32 @@ MacroAssembler::branchTestStringTruthy(bool truthy, const ValueOperand& value, L ma_b(label, c); } +void +MacroAssembler::branchTestSymbol(Condition cond, Register tag, Label* label) +{ + branchTestSymbolImpl(cond, tag, label); +} + +void +MacroAssembler::branchTestSymbol(Condition cond, const BaseIndex& address, Label* label) +{ + branchTestSymbolImpl(cond, address, label); +} + +void +MacroAssembler::branchTestSymbol(Condition cond, const ValueOperand& value, Label* label) +{ + branchTestSymbolImpl(cond, value, label); +} + +template +void +MacroAssembler::branchTestSymbolImpl(Condition cond, const T& t, Label* label) +{ + Condition c = testSymbol(cond, t); + ma_b(label, c); +} + //}}} check_macroassembler_style // =============================================================== diff --git a/js/src/jit/arm/MacroAssembler-arm.h b/js/src/jit/arm/MacroAssembler-arm.h index c674768e2741..4501dfcfb3b3 100644 --- a/js/src/jit/arm/MacroAssembler-arm.h +++ b/js/src/jit/arm/MacroAssembler-arm.h @@ -772,11 +772,6 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM Condition c = testObject(cond, t); ma_b(label, c); } - template - void branchTestSymbol(Condition cond, const T & t, Label* label) { - Condition c = testSymbol(cond, t); - ma_b(label, c); - } template void branchTestMagic(Condition cond, const T& t, L label) { cond = testMagic(cond, t); diff --git a/js/src/jit/arm64/MacroAssembler-arm64-inl.h b/js/src/jit/arm64/MacroAssembler-arm64-inl.h index 1f259a864626..8c86d7519672 100644 --- a/js/src/jit/arm64/MacroAssembler-arm64-inl.h +++ b/js/src/jit/arm64/MacroAssembler-arm64-inl.h @@ -1100,6 +1100,32 @@ MacroAssembler::branchTestStringTruthy(bool truthy, const ValueOperand& value, L B(label, c); } +void +MacroAssembler::branchTestSymbol(Condition cond, Register tag, Label* label) +{ + branchTestSymbolImpl(cond, tag, label); +} + +void +MacroAssembler::branchTestSymbol(Condition cond, const BaseIndex& address, Label* label) +{ + branchTestSymbolImpl(cond, address, label); +} + +void +MacroAssembler::branchTestSymbol(Condition cond, const ValueOperand& value, Label* label) +{ + branchTestSymbolImpl(cond, value, label); +} + +template +void +MacroAssembler::branchTestSymbolImpl(Condition cond, const T& t, Label* label) +{ + Condition c = testSymbol(cond, t); + B(label, c); +} + //}}} check_macroassembler_style // =============================================================== diff --git a/js/src/jit/arm64/MacroAssembler-arm64.h b/js/src/jit/arm64/MacroAssembler-arm64.h index 3fdf49631dc9..189dd7bda9c7 100644 --- a/js/src/jit/arm64/MacroAssembler-arm64.h +++ b/js/src/jit/arm64/MacroAssembler-arm64.h @@ -1332,10 +1332,6 @@ class MacroAssemblerCompat : public vixl::MacroAssembler Condition c = testNull(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); @@ -1345,10 +1341,6 @@ class MacroAssemblerCompat : public vixl::MacroAssembler Condition c = testNull(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); @@ -1360,10 +1352,6 @@ class MacroAssemblerCompat : public vixl::MacroAssembler Condition c = testNull(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); @@ -1375,10 +1363,6 @@ class MacroAssemblerCompat : public vixl::MacroAssembler Condition c = testNull(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); diff --git a/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h b/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h index b28d1ce0c687..d196c3f4efa7 100644 --- a/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h +++ b/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h @@ -625,6 +625,21 @@ MacroAssembler::branchTestString(Condition cond, const BaseIndex& address, Label branchTestString(cond, scratch2, label); } +void +MacroAssembler::branchTestSymbol(Condition cond, Register tag, Label* label) +{ + MOZ_ASSERT(cond == Equal || cond == NotEqual); + ma_b(tag, ImmTag(JSVAL_TAG_SYMBOL), label, cond); +} + +void +MacroAssembler::branchTestSymbol(Condition cond, const BaseIndex& address, Label* label) +{ + SecondScratchRegisterScope scratch2(*this); + extractTag(address, scratch2); + branchTestSymbol(cond, scratch2, label); +} + //}}} check_macroassembler_style // =============================================================== diff --git a/js/src/jit/mips32/MacroAssembler-mips32-inl.h b/js/src/jit/mips32/MacroAssembler-mips32-inl.h index 2f161d8538d0..307d017b8aa9 100644 --- a/js/src/jit/mips32/MacroAssembler-mips32-inl.h +++ b/js/src/jit/mips32/MacroAssembler-mips32-inl.h @@ -356,6 +356,12 @@ MacroAssembler::branchTestStringTruthy(bool b, const ValueOperand& value, Label* ma_b(scratch2, Imm32(0), label, b ? NotEqual : Equal); } +void +MacroAssembler::branchTestSymbol(Condition cond, const ValueOperand& value, Label* label) +{ + branchTestSymbol(cond, value.typeReg(), label); +} + //}}} check_macroassembler_style // =============================================================== diff --git a/js/src/jit/mips32/MacroAssembler-mips32.cpp b/js/src/jit/mips32/MacroAssembler-mips32.cpp index 8157e7a1edd4..10399a70bb82 100644 --- a/js/src/jit/mips32/MacroAssembler-mips32.cpp +++ b/js/src/jit/mips32/MacroAssembler-mips32.cpp @@ -1198,27 +1198,6 @@ MacroAssemblerMIPSCompat::testObjectSet(Condition cond, const ValueOperand& valu ma_cmp_set(dest, value.typeReg(), ImmType(JSVAL_TYPE_OBJECT), 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) -{ - MOZ_ASSERT(cond == Equal || cond == NotEqual); - ma_b(tag, ImmTag(JSVAL_TAG_SYMBOL), label, cond); -} - -void -MacroAssemblerMIPSCompat::branchTestSymbol(Condition cond, const BaseIndex& src, Label* label) -{ - MOZ_ASSERT(cond == Equal || cond == NotEqual); - extractTag(src, SecondScratchReg); - ma_b(SecondScratchReg, ImmTag(JSVAL_TAG_SYMBOL), label, cond); -} - void MacroAssemblerMIPSCompat::testUndefinedSet(Condition cond, const ValueOperand& value, Register dest) { diff --git a/js/src/jit/mips32/MacroAssembler-mips32.h b/js/src/jit/mips32/MacroAssembler-mips32.h index 152034825a1d..35388fa2dd7e 100644 --- a/js/src/jit/mips32/MacroAssembler-mips32.h +++ b/js/src/jit/mips32/MacroAssembler-mips32.h @@ -387,10 +387,6 @@ class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS void branchTestObject(Condition cond, const Address& src, Label* label); void testObjectSet(Condition cond, const ValueOperand& value, Register dest); - 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); diff --git a/js/src/jit/mips64/MacroAssembler-mips64-inl.h b/js/src/jit/mips64/MacroAssembler-mips64-inl.h index dd9420887e11..4cb75877f9b5 100644 --- a/js/src/jit/mips64/MacroAssembler-mips64-inl.h +++ b/js/src/jit/mips64/MacroAssembler-mips64-inl.h @@ -305,6 +305,14 @@ MacroAssembler::branchTestStringTruthy(bool b, const ValueOperand& value, Label* ma_b(scratch2, Imm32(0), label, b ? NotEqual : Equal); } +void +MacroAssembler::branchTestSymbol(Condition cond, const ValueOperand& value, Label* label) +{ + SecondScratchRegisterScope scratch2(*this); + splitTag(value, scratch2); + branchTestSymbol(cond, scratch2, label); +} + //}}} check_macroassembler_style // =============================================================== diff --git a/js/src/jit/mips64/MacroAssembler-mips64.cpp b/js/src/jit/mips64/MacroAssembler-mips64.cpp index 2d58a2e54fb6..958d535778bd 100644 --- a/js/src/jit/mips64/MacroAssembler-mips64.cpp +++ b/js/src/jit/mips64/MacroAssembler-mips64.cpp @@ -1330,28 +1330,6 @@ MacroAssemblerMIPS64Compat::testObjectSet(Condition cond, const ValueOperand& va ma_cmp_set(dest, SecondScratchReg, ImmTag(JSVAL_TAG_OBJECT), 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) -{ - MOZ_ASSERT(cond == Equal || cond == NotEqual); - ma_b(tag, ImmTag(JSVAL_TAG_SYMBOL), label, cond); -} - -void -MacroAssemblerMIPS64Compat::branchTestSymbol(Condition cond, const BaseIndex& src, Label* label) -{ - MOZ_ASSERT(cond == Equal || cond == NotEqual); - extractTag(src, SecondScratchReg); - ma_b(SecondScratchReg, ImmTag(JSVAL_TAG_SYMBOL), label, cond); -} - void MacroAssemblerMIPS64Compat::testUndefinedSet(Condition cond, const ValueOperand& value, Register dest) { diff --git a/js/src/jit/mips64/MacroAssembler-mips64.h b/js/src/jit/mips64/MacroAssembler-mips64.h index e520bb2bffc6..256c0f4058ce 100644 --- a/js/src/jit/mips64/MacroAssembler-mips64.h +++ b/js/src/jit/mips64/MacroAssembler-mips64.h @@ -428,10 +428,6 @@ class MacroAssemblerMIPS64Compat : public MacroAssemblerMIPS64 void branchTestObject(Condition cond, const Address& src, Label* label); void testObjectSet(Condition cond, const ValueOperand& value, Register dest); - 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); diff --git a/js/src/jit/none/MacroAssembler-none.h b/js/src/jit/none/MacroAssembler-none.h index 31b80137ad6d..f11d85a96437 100644 --- a/js/src/jit/none/MacroAssembler-none.h +++ b/js/src/jit/none/MacroAssembler-none.h @@ -346,7 +346,6 @@ class MacroAssemblerNone : public Assembler Register splitTagForTest(ValueOperand) { MOZ_CRASH(); } template void branchTestNull(Condition, T, Label*) { MOZ_CRASH(); } - template void branchTestSymbol(Condition, T, Label*) { MOZ_CRASH(); } template void branchTestObject(Condition, T, Label*) { MOZ_CRASH(); } template void branchTestGCThing(Condition, T, Label*) { MOZ_CRASH(); } template void branchTestPrimitive(Condition, T, Label*) { MOZ_CRASH(); } diff --git a/js/src/jit/x64/MacroAssembler-x64.h b/js/src/jit/x64/MacroAssembler-x64.h index c692b21ede89..2b5a83dbb18d 100644 --- a/js/src/jit/x64/MacroAssembler-x64.h +++ b/js/src/jit/x64/MacroAssembler-x64.h @@ -688,10 +688,6 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared cond = testNull(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); @@ -722,10 +718,6 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared cond = testNull(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); @@ -737,10 +729,6 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared cond = testNull(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); diff --git a/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h b/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h index a9630f94df63..fa254a688b89 100644 --- a/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h +++ b/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h @@ -623,6 +623,32 @@ MacroAssembler::branchTestStringTruthy(bool truthy, const ValueOperand& value, L j(cond, label); } +void +MacroAssembler::branchTestSymbol(Condition cond, Register tag, Label* label) +{ + branchTestSymbolImpl(cond, tag, label); +} + +void +MacroAssembler::branchTestSymbol(Condition cond, const BaseIndex& address, Label* label) +{ + branchTestSymbolImpl(cond, address, label); +} + +void +MacroAssembler::branchTestSymbol(Condition cond, const ValueOperand& value, Label* label) +{ + branchTestSymbolImpl(cond, value, label); +} + +template +void +MacroAssembler::branchTestSymbolImpl(Condition cond, const T& t, Label* label) +{ + cond = testSymbol(cond, t); + j(cond, label); +} + //}}} check_macroassembler_style // =============================================================== diff --git a/js/src/jit/x86/MacroAssembler-x86.h b/js/src/jit/x86/MacroAssembler-x86.h index a6bb6a2b5424..5bb11da1efe1 100644 --- a/js/src/jit/x86/MacroAssembler-x86.h +++ b/js/src/jit/x86/MacroAssembler-x86.h @@ -665,11 +665,6 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared j(cond, label); } template - void branchTestSymbol(Condition cond, const T& t, Label* label) { - cond = testSymbol(cond, t); - j(cond, label); - } - template void branchTestObject(Condition cond, const T& t, Label* label) { cond = testObject(cond, t); j(cond, label);