Bug 1245112 - Part 4: Move MacroAssembler::branchTest64 into generic macro assembler. r=nbp

This commit is contained in:
Tooru Fujisawa 2016-02-15 23:01:48 +09:00
parent ba86a8bc78
commit 231afb7336
16 changed files with 67 additions and 57 deletions

View File

@ -841,6 +841,9 @@ class MacroAssembler : public MacroAssemblerSpecific
// boxed inside a js::Value, with a raw pointer (rhs).
inline void branchPrivatePtr(Condition cond, const Address& lhs, Register rhs, Label* label) PER_ARCH;
inline void branchTest64(Condition cond, Register64 lhs, Register64 rhs, Register temp,
Label* label) PER_ARCH;
//}}} check_macroassembler_style
public:

View File

@ -575,6 +575,20 @@ MacroAssembler::branchPrivatePtr(Condition cond, const Address& lhs, Register rh
branchPtr(cond, lhs, rhs, label);
}
void
MacroAssembler::branchTest64(Condition cond, Register64 lhs, Register64 rhs, Register temp,
Label* label)
{
if (cond == Assembler::Zero) {
MOZ_ASSERT(lhs.low == rhs.low);
MOZ_ASSERT(lhs.high == rhs.high);
ma_orr(lhs.low, lhs.high, ScratchRegister);
branchTestPtr(cond, ScratchRegister, ScratchRegister, label);
} else {
MOZ_CRASH("Unsupported condition");
}
}
//}}} check_macroassembler_style
// ===============================================================

View File

@ -3235,22 +3235,6 @@ template void
MacroAssemblerARMCompat::storeUnboxedValue(ConstantOrRegister value, MIRType valueType,
const BaseIndex& dest, MIRType slotType);
void
MacroAssemblerARMCompat::branchTest64(Condition cond, Register64 lhs, Register64 rhs,
Register temp, Label* label)
{
if (cond == Assembler::Zero) {
MOZ_ASSERT(lhs.low == rhs.low);
MOZ_ASSERT(lhs.high == rhs.high);
mov(lhs.low, ScratchRegister);
asMasm().or32(lhs.high, ScratchRegister);
branchTestPtr(cond, ScratchRegister, ScratchRegister, label);
} else {
MOZ_CRASH("Unsupported condition");
}
}
void
MacroAssemblerARMCompat::moveValue(const Value& val, Register type, Register data)
{

View File

@ -878,7 +878,6 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
ma_sub(imm, lhs, SetCC);
as_b(label, cond);
}
void branchTest64(Condition cond, Register64 lhs, Register64 rhs, Register temp, Label* label);
void moveValue(const Value& val, Register type, Register data);
CodeOffsetJump jumpWithPatch(RepatchLabel* label, Condition cond = Always,

View File

@ -652,6 +652,13 @@ MacroAssembler::branchPrivatePtr(Condition cond, const Address& lhs, Register rh
branchPtr(cond, lhs, scratch, label);
}
void
MacroAssembler::branchTest64(Condition cond, Register64 lhs, Register64 rhs, Register temp,
Label* label)
{
branchTestPtr(cond, lhs.reg, rhs.reg, label);
}
//}}} check_macroassembler_style
// ===============================================================

View File

@ -1641,9 +1641,6 @@ class MacroAssemblerCompat : public vixl::MacroAssembler
Cmp(ARMRegister(value.valueReg(), 64), Operand(scratch64));
B(label, cond);
}
void branchTest64(Condition cond, Register64 lhs, Register64 rhs, Register temp, Label* label) {
branchTestPtr(cond, lhs.reg, rhs.reg, label);
}
void compareDouble(DoubleCondition cond, FloatRegister lhs, FloatRegister rhs) {
Fcmp(ARMFPRegister(lhs, 64), ARMFPRegister(rhs, 64));

View File

@ -245,6 +245,20 @@ MacroAssembler::branchPrivatePtr(Condition cond, const Address& lhs, Register rh
branchPtr(cond, lhs, rhs, label);
}
void
MacroAssembler::branchTest64(Condition cond, Register64 lhs, Register64 rhs, Register temp,
Label* label)
{
if (cond == Assembler::Zero) {
MOZ_ASSERT(lhs.low == rhs.low);
MOZ_ASSERT(lhs.high == rhs.high);
as_or(ScratchRegister, lhs.low, lhs.high);
branchTestPtr(cond, ScratchRegister, ScratchRegister, label);
} else {
MOZ_CRASH("Unsupported condition");
}
}
//}}} check_macroassembler_style
// ===============================================================

View File

@ -1731,20 +1731,6 @@ MacroAssemblerMIPSCompat::branchTestBooleanTruthy(bool b, const ValueOperand& op
ma_b(operand.payloadReg(), operand.payloadReg(), label, b ? NonZero : Zero);
}
void
MacroAssemblerMIPSCompat::branchTest64(Condition cond, Register64 lhs, Register64 rhs,
Register temp, Label* label)
{
if (cond == Assembler::Zero) {
MOZ_ASSERT(lhs.low == rhs.low);
MOZ_ASSERT(lhs.high == rhs.high);
as_or(ScratchRegister, lhs.low, lhs.high);
branchTestPtr(cond, ScratchRegister, ScratchRegister, label);
} else {
MOZ_CRASH("Unsupported condition");
}
}
Register
MacroAssemblerMIPSCompat::extractObject(const Address& address, Register scratch)
{

View File

@ -475,8 +475,6 @@ class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS
loadPtr(lhs, SecondScratchReg);
branchTestPtr(cond, SecondScratchReg, imm, label);
}
void branchTest64(Condition cond, Register64 lhs, Register64 rhs, Register temp,
Label* label);
inline void decBranchPtr(Condition cond, Register lhs, Imm32 imm, Label* label);
// higher level tag testing code

View File

@ -190,6 +190,13 @@ MacroAssembler::branchPrivatePtr(Condition cond, const Address& lhs, Register rh
branchPtr(cond, lhs, ScratchRegister, label);
}
void
MacroAssembler::branchTest64(Condition cond, Register64 lhs, Register64 rhs, Register temp,
Label* label)
{
branchTestPtr(cond, lhs.reg, rhs.reg, label);
}
//}}} check_macroassembler_style
// ===============================================================

View File

@ -516,10 +516,6 @@ class MacroAssemblerMIPS64Compat : public MacroAssemblerMIPS64
loadPtr(lhs, SecondScratchReg);
branchTestPtr(cond, SecondScratchReg, imm, label);
}
void branchTest64(Condition cond, Register64 lhs, Register64 rhs, Register temp,
Label* label) {
branchTestPtr(cond, lhs.reg, rhs.reg, label);
}
inline void decBranchPtr(Condition cond, Register lhs, Imm32 imm, Label* label);
// higher level tag testing code

View File

@ -251,7 +251,6 @@ class MacroAssemblerNone : public Assembler
template <typename T, typename S> void branchDouble(DoubleCondition, T, S, Label*) { MOZ_CRASH(); }
template <typename T, typename S> void branchFloat(DoubleCondition, T, S, Label*) { MOZ_CRASH(); }
template <typename T, typename S> void decBranchPtr(Condition, T, S, Label*) { MOZ_CRASH(); }
template <typename T, typename S> void branchTest64(Condition, T, T, S, Label*) { MOZ_CRASH(); }
template <typename T, typename S> void mov(T, S) { MOZ_CRASH(); }
template <typename T, typename S> void movq(T, S) { MOZ_CRASH(); }
template <typename T, typename S> void movePtr(T, S) { MOZ_CRASH(); }

View File

@ -298,6 +298,13 @@ MacroAssembler::branchPrivatePtr(Condition cond, const Address& lhs, Register rh
branchPtr(cond, lhs, scratch, label);
}
void
MacroAssembler::branchTest64(Condition cond, Register64 lhs, Register64 rhs, Register temp,
Label* label)
{
branchTestPtr(cond, lhs.reg, rhs.reg, label);
}
//}}} check_macroassembler_style
// ===============================================================

View File

@ -579,10 +579,6 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
j(cond, label);
}
void branchTest64(Condition cond, Register64 lhs, Register64 rhs, Register temp, Label* label) {
branchTestPtr(cond, lhs.reg, rhs.reg, label);
}
void movePtr(Register src, Register dest) {
movq(src, dest);
}

View File

@ -304,6 +304,21 @@ MacroAssembler::branchPrivatePtr(Condition cond, const Address& lhs, Register rh
branchPtr(cond, lhs, rhs, label);
}
void
MacroAssembler::branchTest64(Condition cond, Register64 lhs, Register64 rhs, Register temp,
Label* label)
{
if (cond == Assembler::Zero) {
MOZ_ASSERT(lhs.low == rhs.low);
MOZ_ASSERT(lhs.high == rhs.high);
movl(lhs.low, temp);
orl(lhs.high, temp);
branchTestPtr(cond, temp, temp, label);
} else {
MOZ_CRASH("Unsupported condition");
}
}
//}}} check_macroassembler_style
// ===============================================================

View File

@ -607,18 +607,6 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
j(cond, label);
}
void branchTest64(Condition cond, Register64 lhs, Register64 rhs, Register temp, Label* label) {
if (cond == Assembler::Zero) {
MOZ_ASSERT(lhs.low == rhs.low);
MOZ_ASSERT(lhs.high == rhs.high);
movl(lhs.low, temp);
orl(lhs.high, temp);
branchTestPtr(cond, temp, temp, label);
} else {
MOZ_CRASH("Unsupported condition");
}
}
void movePtr(ImmWord imm, Register dest) {
movl(Imm32(imm.value), dest);
}