Bug 1245112 - Part 26: Move MacroAssembler::branchTestString into generic macro assembler. r=sstangl

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

View File

@ -929,6 +929,7 @@ class MacroAssembler : public MacroAssemblerSpecific
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.
@ -955,6 +956,10 @@ class MacroAssembler : public MacroAssemblerSpecific
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)
@ -980,6 +985,9 @@ class MacroAssembler : public MacroAssemblerSpecific
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:

View File

@ -968,6 +968,32 @@ MacroAssembler::branchTestBooleanTruthy(bool truthy, const ValueOperand& 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
// ===============================================================

View File

@ -773,11 +773,6 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
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);

View File

@ -1067,6 +1067,32 @@ MacroAssembler::branchTestBooleanTruthy(bool truthy, const ValueOperand& 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
// ===============================================================

View File

@ -1332,10 +1332,6 @@ class MacroAssemblerCompat : public vixl::MacroAssembler
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);
@ -1349,10 +1345,6 @@ class MacroAssemblerCompat : public vixl::MacroAssembler
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);
@ -1368,10 +1360,6 @@ class MacroAssemblerCompat : public vixl::MacroAssembler
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);
@ -1387,10 +1375,6 @@ class MacroAssemblerCompat : public vixl::MacroAssembler
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);

View File

@ -610,6 +610,21 @@ MacroAssembler::branchTestBoolean(Condition cond, const BaseIndex& address, Labe
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
// ===============================================================

View File

@ -341,6 +341,12 @@ MacroAssembler::branchTestBooleanTruthy(bool b, const ValueOperand& value, 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
// ===============================================================

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

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

View File

@ -288,6 +288,14 @@ MacroAssembler::branchTestBooleanTruthy(bool b, const ValueOperand& value, Label
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
// ===============================================================

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

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

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 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(); }

View File

@ -688,10 +688,6 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
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);
@ -726,10 +722,6 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
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);
@ -745,10 +737,6 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
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);

View File

@ -590,6 +590,32 @@ MacroAssembler::branchTestBooleanImpl(Condition cond, const T& t, Label* label)
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
// ===============================================================

View File

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