Bug 1245112 - Part 31: Move MacroAssembler::branchTestGCThing into generic macro assembler. r=jandem

This commit is contained in:
Tooru Fujisawa 2016-03-03 08:03:44 +09:00
parent 15f8d8cefc
commit dc44c3b83c
14 changed files with 85 additions and 61 deletions

View File

@ -980,6 +980,9 @@ class MacroAssembler : public MacroAssemblerSpecific
inline void branchTestObject(Condition cond, const ValueOperand& value, Label* label)
DEFINED_ON(arm, arm64, mips32, mips64, x86_shared);
inline void branchTestGCThing(Condition cond, const Address& address, Label* label) PER_SHARED_ARCH;
inline void branchTestGCThing(Condition cond, const BaseIndex& address, Label* label) PER_SHARED_ARCH;
// 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)
@ -1019,6 +1022,9 @@ class MacroAssembler : public MacroAssemblerSpecific
template <typename T>
inline void branchTestObjectImpl(Condition cond, const T& t, Label* label)
DEFINED_ON(arm, arm64, x86_shared);
template <typename T>
inline void branchTestGCThingImpl(Condition cond, const T& t, Label* label)
DEFINED_ON(arm, arm64, x86_shared);
//}}} check_macroassembler_style
public:

View File

@ -1091,6 +1091,26 @@ MacroAssembler::branchTestObjectImpl(Condition cond, const T& t, Label* label)
ma_b(label, c);
}
void
MacroAssembler::branchTestGCThing(Condition cond, const Address& address, Label* label)
{
branchTestGCThingImpl(cond, address, label);
}
void
MacroAssembler::branchTestGCThing(Condition cond, const BaseIndex& address, Label* label)
{
branchTestGCThingImpl(cond, address, label);
}
template <typename T>
void
MacroAssembler::branchTestGCThingImpl(Condition cond, const T& t, Label* label)
{
Condition c = testGCThing(cond, t);
ma_b(label, c);
}
//}}} check_macroassembler_style
// ===============================================================

View File

@ -684,11 +684,6 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
Condition testMagic(Condition cond, const BaseIndex& src);
Condition testGCThing(Condition cond, const BaseIndex& src);
template <typename T>
void branchTestGCThing(Condition cond, const T& t, Label* label) {
Condition c = testGCThing(cond, t);
ma_b(label, c);
}
template <typename T>
void branchTestPrimitive(Condition cond, const T& t, Label* label) {
Condition c = testPrimitive(cond, t);

View File

@ -1190,6 +1190,26 @@ MacroAssembler::branchTestObjectImpl(Condition cond, const T& t, Label* label)
B(label, c);
}
void
MacroAssembler::branchTestGCThing(Condition cond, const Address& address, Label* label)
{
branchTestGCThingImpl(cond, address, label);
}
void
MacroAssembler::branchTestGCThing(Condition cond, const BaseIndex& address, Label* label)
{
branchTestGCThingImpl(cond, address, label);
}
template <typename T>
void
MacroAssembler::branchTestGCThingImpl(Condition cond, const T& src, Label* label)
{
Condition c = testGCThing(cond, src);
B(label, c);
}
//}}} check_macroassembler_style
// ===============================================================

View File

@ -1328,11 +1328,6 @@ class MacroAssemblerCompat : public vixl::MacroAssembler
return jumpWithPatch(label, Always, documentation);
}
template <typename T>
void branchTestGCThing(Condition cond, const T& src, Label* label) {
Condition c = testGCThing(cond, src);
B(label, c);
}
template <typename T>
void branchTestPrimitive(Condition cond, const T& t, Label* label) {
Condition c = testPrimitive(cond, t);

View File

@ -686,6 +686,25 @@ MacroAssembler::branchTestObject(Condition cond, const BaseIndex& address, Label
branchTestObject(cond, scratch2, label);
}
void
MacroAssembler::branchTestGCThing(Condition cond, const Address& address, Label* label)
{
MOZ_ASSERT(cond == Equal || cond == NotEqual);
SecondScratchRegisterScope scratch2(*this);
extractTag(address, scratch2);
ma_b(scratch2, ImmTag(JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET), label,
(cond == Equal) ? AboveOrEqual : Below);
}
void
MacroAssembler::branchTestGCThing(Condition cond, const BaseIndex& address, Label* label)
{
MOZ_ASSERT(cond == Equal || cond == NotEqual);
SecondScratchRegisterScope scratch2(*this);
extractTag(address, scratch2);
ma_b(scratch2, ImmTag(JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET), label,
(cond == Equal) ? AboveOrEqual : Below);
}
//}}} check_macroassembler_style
// ===============================================================

View File

@ -1095,23 +1095,6 @@ MacroAssemblerMIPSCompat::ToType(Operand base)
return Operand(Register::FromCode(base.base()), base.disp() + TAG_OFFSET);
}
void
MacroAssemblerMIPSCompat::branchTestGCThing(Condition cond, const Address& address, Label* label)
{
MOZ_ASSERT(cond == Equal || cond == NotEqual);
extractTag(address, SecondScratchReg);
ma_b(SecondScratchReg, ImmTag(JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET), label,
(cond == Equal) ? AboveOrEqual : Below);
}
void
MacroAssemblerMIPSCompat::branchTestGCThing(Condition cond, const BaseIndex& src, Label* label)
{
MOZ_ASSERT(cond == Equal || cond == NotEqual);
extractTag(src, SecondScratchReg);
ma_b(SecondScratchReg, ImmTag(JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET), label,
(cond == Equal) ? AboveOrEqual : Below);
}
void
MacroAssemblerMIPSCompat::branchTestPrimitive(Condition cond, const ValueOperand& value,
Label* label)

View File

@ -309,9 +309,6 @@ class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS
return value.typeReg();
}
void branchTestGCThing(Condition cond, const Address& address, Label* label);
void branchTestGCThing(Condition cond, const BaseIndex& src, Label* label);
void branchTestPrimitive(Condition cond, const ValueOperand& value, Label* label);
void branchTestPrimitive(Condition cond, Register tag, Label* label);

View File

@ -1222,23 +1222,6 @@ MacroAssembler::clampDoubleToUint8(FloatRegister input, Register output)
bind(&done);
}
void
MacroAssemblerMIPS64Compat::branchTestGCThing(Condition cond, const Address& address, Label* label)
{
MOZ_ASSERT(cond == Equal || cond == NotEqual);
extractTag(address, SecondScratchReg);
ma_b(SecondScratchReg, ImmTag(JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET), label,
(cond == Equal) ? AboveOrEqual : Below);
}
void
MacroAssemblerMIPS64Compat::branchTestGCThing(Condition cond, const BaseIndex& src, Label* label)
{
MOZ_ASSERT(cond == Equal || cond == NotEqual);
extractTag(src, SecondScratchReg);
ma_b(SecondScratchReg, ImmTag(JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET), label,
(cond == Equal) ? AboveOrEqual : Below);
}
void
MacroAssemblerMIPS64Compat::branchTestPrimitive(Condition cond, const ValueOperand& value,
Label* label)

View File

@ -337,9 +337,6 @@ class MacroAssemblerMIPS64Compat : public MacroAssemblerMIPS64
return SecondScratchReg;
}
void branchTestGCThing(Condition cond, const Address& address, Label* label);
void branchTestGCThing(Condition cond, const BaseIndex& src, Label* label);
void branchTestPrimitive(Condition cond, const ValueOperand& value, Label* label);
void branchTestPrimitive(Condition cond, Register tag, Label* label);

View File

@ -345,7 +345,6 @@ class MacroAssemblerNone : public Assembler
Register splitTagForTest(ValueOperand) { 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(); }

View File

@ -683,11 +683,6 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
cmp32(reg, tag);
}
template <typename T>
void branchTestGCThing(Condition cond, const T& src, Label* label) {
cond = testGCThing(cond, src);
j(cond, label);
}
template <typename T>
void branchTestPrimitive(Condition cond, const T& t, Label* label) {
cond = testPrimitive(cond, t);

View File

@ -713,6 +713,26 @@ MacroAssembler::branchTestObjectImpl(Condition cond, const T& t, Label* label)
j(cond, label);
}
void
MacroAssembler::branchTestGCThing(Condition cond, const Address& address, Label* label)
{
branchTestGCThingImpl(cond, address, label);
}
void
MacroAssembler::branchTestGCThing(Condition cond, const BaseIndex& address, Label* label)
{
branchTestGCThingImpl(cond, address, label);
}
template <typename T>
void
MacroAssembler::branchTestGCThingImpl(Condition cond, const T& t, Label* label)
{
cond = testGCThing(cond, t);
j(cond, label);
}
//}}} check_macroassembler_style
// ===============================================================

View File

@ -660,11 +660,6 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
// Type testing instructions can take a tag in a register or a
// ValueOperand.
template <typename T>
void branchTestGCThing(Condition cond, const T& t, Label* label) {
cond = testGCThing(cond, t);
j(cond, label);
}
template <typename T>
void branchTestPrimitive(Condition cond, const T& t, Label* label) {
cond = testPrimitive(cond, t);
j(cond, label);