зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1245112 - Part 23: Move MacroAssembler::branchTestBoolean into generic macro assembler. r=sstangl
This commit is contained in:
Родитель
7a23ca6f2e
Коммит
c0652fed25
|
@ -927,6 +927,7 @@ class MacroAssembler : public MacroAssemblerSpecific
|
|||
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.
|
||||
|
@ -943,6 +944,11 @@ class MacroAssembler : public MacroAssemblerSpecific
|
|||
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)
|
||||
|
@ -961,6 +967,9 @@ class MacroAssembler : public MacroAssemblerSpecific
|
|||
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:
|
||||
|
|
|
@ -897,6 +897,38 @@ MacroAssembler::branchTestNumberImpl(Condition cond, const T& t, Label* label)
|
|||
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
|
||||
// ===============================================================
|
||||
|
||||
|
|
|
@ -762,11 +762,6 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
|
|||
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);
|
||||
|
|
|
@ -996,6 +996,38 @@ MacroAssembler::branchTestNumberImpl(Condition cond, const T& t, Label* label)
|
|||
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
|
||||
// ===============================================================
|
||||
|
||||
|
|
|
@ -1332,10 +1332,6 @@ class MacroAssemblerCompat : public vixl::MacroAssembler
|
|||
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);
|
||||
|
@ -1357,10 +1353,6 @@ class MacroAssemblerCompat : public vixl::MacroAssembler
|
|||
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);
|
||||
|
@ -1384,10 +1376,6 @@ class MacroAssemblerCompat : public vixl::MacroAssembler
|
|||
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);
|
||||
|
@ -1411,10 +1399,6 @@ class MacroAssemblerCompat : public vixl::MacroAssembler
|
|||
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);
|
||||
|
|
|
@ -564,6 +564,29 @@ MacroAssembler::branchTestNumber(Condition cond, Register tag, Label* label)
|
|||
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
|
||||
// ===============================================================
|
||||
|
||||
|
|
|
@ -322,6 +322,13 @@ MacroAssembler::branchTestNumber(Condition cond, const ValueOperand& value, Labe
|
|||
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
|
||||
// ===============================================================
|
||||
|
||||
|
|
|
@ -1126,37 +1126,6 @@ MacroAssemblerMIPSCompat::branchTestPrimitive(Condition cond, Register tag, Labe
|
|||
(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)
|
||||
{
|
||||
|
|
|
@ -375,12 +375,6 @@ class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS
|
|||
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);
|
||||
|
|
|
@ -264,6 +264,14 @@ MacroAssembler::branchTestNumber(Condition cond, const ValueOperand& value, Labe
|
|||
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
|
||||
// ===============================================================
|
||||
|
||||
|
|
|
@ -1254,38 +1254,6 @@ MacroAssemblerMIPS64Compat::branchTestPrimitive(Condition cond, Register tag, La
|
|||
(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)
|
||||
{
|
||||
|
|
|
@ -416,12 +416,6 @@ class MacroAssemblerMIPS64Compat : public MacroAssemblerMIPS64
|
|||
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);
|
||||
|
|
|
@ -346,7 +346,6 @@ class MacroAssemblerNone : public Assembler
|
|||
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(); }
|
||||
|
|
|
@ -333,9 +333,8 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
|
|||
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());
|
||||
|
@ -690,10 +689,6 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
|
|||
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);
|
||||
|
@ -723,15 +718,6 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
|
|||
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))));
|
||||
|
@ -754,11 +740,6 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
|
|||
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);
|
||||
|
@ -782,11 +763,6 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
|
|||
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);
|
||||
|
|
|
@ -526,6 +526,38 @@ MacroAssembler::branchTestNumberImpl(Condition cond, const T& t, Label* label)
|
|||
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
|
||||
// ===============================================================
|
||||
|
||||
|
|
|
@ -665,11 +665,6 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
|
|||
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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче