Bug 1245112 - Part 28: Move MacroAssembler::branchTestSymbol into generic macro assembler. r=jorendorff

This commit is contained in:
Tooru Fujisawa 2016-03-03 08:03:43 +09:00
parent 0fa4cdb134
commit 3a63fbd192
16 changed files with 115 additions and 90 deletions

View File

@ -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 <typename T>
inline void branchTestStringImpl(Condition cond, const T& t, Label* label)
DEFINED_ON(arm, arm64, x86_shared);
template <typename T>
inline void branchTestSymbolImpl(Condition cond, const T& t, Label* label)
DEFINED_ON(arm, arm64, x86_shared);
//}}} check_macroassembler_style
public:

View File

@ -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 <typename T>
void
MacroAssembler::branchTestSymbolImpl(Condition cond, const T& t, Label* label)
{
Condition c = testSymbol(cond, t);
ma_b(label, c);
}
//}}} check_macroassembler_style
// ===============================================================

View File

@ -772,11 +772,6 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
Condition c = testObject(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);

View File

@ -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 <typename T>
void
MacroAssembler::branchTestSymbolImpl(Condition cond, const T& t, Label* label)
{
Condition c = testSymbol(cond, t);
B(label, c);
}
//}}} check_macroassembler_style
// ===============================================================

View File

@ -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);

View File

@ -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
// ===============================================================

View File

@ -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
// ===============================================================

View File

@ -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)
{

View File

@ -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);

View File

@ -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
// ===============================================================

View File

@ -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)
{

View File

@ -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);

View File

@ -346,7 +346,6 @@ class MacroAssemblerNone : public Assembler
Register splitTagForTest(ValueOperand) { MOZ_CRASH(); }
template <typename T> void branchTestNull(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(); }

View File

@ -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);

View File

@ -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 <typename T>
void
MacroAssembler::branchTestSymbolImpl(Condition cond, const T& t, Label* label)
{
cond = testSymbol(cond, t);
j(cond, label);
}
//}}} check_macroassembler_style
// ===============================================================

View File

@ -665,11 +665,6 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
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);