mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-28 12:45:27 +00:00
Bug 1245112 - Part 21: Move MacroAssembler::branchTestDoubleTruthy into generic macro assembler. r=nbp
This commit is contained in:
parent
3297a75e4f
commit
280ab4adae
@ -943,6 +943,7 @@ class MacroAssembler : public MacroAssemblerSpecific
|
||||
// The type of the value should match the type of the method.
|
||||
inline void branchTestInt32Truthy(bool truthy, const ValueOperand& value, Label* label)
|
||||
DEFINED_ON(arm, arm64, mips32, mips64, x86_shared);
|
||||
inline void branchTestDoubleTruthy(bool truthy, FloatRegister reg, Label* label) PER_SHARED_ARCH;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -870,6 +870,13 @@ MacroAssembler::branchTestDoubleImpl(Condition cond, const T& t, Label* label)
|
||||
ma_b(label, c);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchTestDoubleTruthy(bool truthy, FloatRegister reg, Label* label)
|
||||
{
|
||||
Condition c = testDoubleTruthy(truthy, reg);
|
||||
ma_b(label, c);
|
||||
}
|
||||
|
||||
//}}} check_macroassembler_style
|
||||
// ===============================================================
|
||||
|
||||
|
@ -811,10 +811,6 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
|
||||
Condition c = testBooleanTruthy(truthy, operand);
|
||||
ma_b(label, c);
|
||||
}
|
||||
void branchTestDoubleTruthy(bool truthy, FloatRegister reg, Label* label) {
|
||||
Condition c = testDoubleTruthy(truthy, reg);
|
||||
ma_b(label, c);
|
||||
}
|
||||
void branchTestStringTruthy(bool truthy, const ValueOperand& value, Label* label) {
|
||||
Condition c = testStringTruthy(truthy, value);
|
||||
ma_b(label, c);
|
||||
|
@ -957,6 +957,25 @@ MacroAssembler::branchTestDoubleImpl(Condition cond, const T& t, Label* label)
|
||||
B(label, c);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchTestDoubleTruthy(bool truthy, FloatRegister reg, Label* label)
|
||||
{
|
||||
Fcmp(ARMFPRegister(reg, 64), 0.0);
|
||||
if (!truthy) {
|
||||
// falsy values are zero, and NaN.
|
||||
branch(Zero, label);
|
||||
branch(Overflow, label);
|
||||
} else {
|
||||
// truthy values are non-zero and not nan.
|
||||
// If it is overflow
|
||||
Label onFalse;
|
||||
branch(Zero, &onFalse);
|
||||
branch(Overflow, &onFalse);
|
||||
B(label);
|
||||
bind(&onFalse);
|
||||
}
|
||||
}
|
||||
|
||||
//}}} check_macroassembler_style
|
||||
// ===============================================================
|
||||
|
||||
|
@ -1948,23 +1948,6 @@ class MacroAssemblerCompat : public vixl::MacroAssembler
|
||||
return truthy ? NonZero : Zero;
|
||||
}
|
||||
|
||||
void branchTestDoubleTruthy(bool truthy, FloatRegister reg, Label* label) {
|
||||
Fcmp(ARMFPRegister(reg, 64), 0.0);
|
||||
if (!truthy) {
|
||||
// falsy values are zero, and NaN.
|
||||
branch(Zero, label);
|
||||
branch(Overflow, label);
|
||||
} else {
|
||||
// truthy values are non-zero and not nan.
|
||||
// If it is overflow
|
||||
Label onFalse;
|
||||
branch(Zero, &onFalse);
|
||||
branch(Overflow, &onFalse);
|
||||
B(label);
|
||||
bind(&onFalse);
|
||||
}
|
||||
}
|
||||
|
||||
Condition testBooleanTruthy(bool truthy, const ValueOperand& operand) {
|
||||
ARMRegister payload32(operand.valueReg(), 32);
|
||||
Tst(payload32, payload32);
|
||||
|
@ -548,6 +548,14 @@ MacroAssembler::branchTestDouble(Condition cond, const BaseIndex& address, Label
|
||||
branchTestDouble(cond, scratch2, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchTestDoubleTruthy(bool b, FloatRegister value, Label* label)
|
||||
{
|
||||
ma_lid(ScratchDoubleReg, 0.0);
|
||||
DoubleCondition cond = b ? DoubleNotEqual : DoubleEqualOrUnordered;
|
||||
ma_bc1d(value, ScratchDoubleReg, label, cond);
|
||||
}
|
||||
|
||||
//}}} check_macroassembler_style
|
||||
// ===============================================================
|
||||
|
||||
|
@ -1613,14 +1613,6 @@ MacroAssemblerMIPSCompat::branchTestStringTruthy(bool b, const ValueOperand& val
|
||||
ma_b(SecondScratchReg, Imm32(0), label, b ? NotEqual : Equal);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssemblerMIPSCompat::branchTestDoubleTruthy(bool b, FloatRegister value, Label* label)
|
||||
{
|
||||
ma_lid(ScratchDoubleReg, 0.0);
|
||||
DoubleCondition cond = b ? DoubleNotEqual : DoubleEqualOrUnordered;
|
||||
ma_bc1d(value, ScratchDoubleReg, label, cond);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssemblerMIPSCompat::branchTestBooleanTruthy(bool b, const ValueOperand& operand,
|
||||
Label* label)
|
||||
|
@ -424,8 +424,6 @@ class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS
|
||||
|
||||
void branchTestStringTruthy(bool b, const ValueOperand& value, Label* label);
|
||||
|
||||
void branchTestDoubleTruthy(bool b, FloatRegister value, Label* label);
|
||||
|
||||
void branchTestBooleanTruthy(bool b, const ValueOperand& operand, Label* label);
|
||||
|
||||
// higher level tag testing code
|
||||
|
@ -1837,14 +1837,6 @@ MacroAssemblerMIPS64Compat::branchTestStringTruthy(bool b, const ValueOperand& v
|
||||
ma_b(SecondScratchReg, Imm32(0), label, b ? NotEqual : Equal);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssemblerMIPS64Compat::branchTestDoubleTruthy(bool b, FloatRegister value, Label* label)
|
||||
{
|
||||
ma_lid(ScratchDoubleReg, 0.0);
|
||||
DoubleCondition cond = b ? DoubleNotEqual : DoubleEqualOrUnordered;
|
||||
ma_bc1d(value, ScratchDoubleReg, label, cond);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssemblerMIPS64Compat::branchTestBooleanTruthy(bool b, const ValueOperand& operand,
|
||||
Label* label)
|
||||
|
@ -465,8 +465,6 @@ class MacroAssemblerMIPS64Compat : public MacroAssemblerMIPS64
|
||||
|
||||
void branchTestStringTruthy(bool b, const ValueOperand& value, Label* label);
|
||||
|
||||
void branchTestDoubleTruthy(bool b, FloatRegister value, Label* label);
|
||||
|
||||
void branchTestBooleanTruthy(bool b, const ValueOperand& operand, Label* label);
|
||||
|
||||
// higher level tag testing code
|
||||
|
@ -395,7 +395,6 @@ class MacroAssemblerNone : public Assembler
|
||||
Condition testStringTruthy(bool, ValueOperand) { MOZ_CRASH(); }
|
||||
void branchTestBooleanTruthy(bool, ValueOperand, Label*) { MOZ_CRASH(); }
|
||||
void branchTestStringTruthy(bool, ValueOperand, Label*) { MOZ_CRASH(); }
|
||||
void branchTestDoubleTruthy(bool, FloatRegister, Label*) { MOZ_CRASH(); }
|
||||
|
||||
template <typename T> void loadUnboxedValue(T, MIRType, AnyRegister) { MOZ_CRASH(); }
|
||||
template <typename T> void storeUnboxedValue(ConstantOrRegister, MIRType, T, MIRType) { MOZ_CRASH(); }
|
||||
|
@ -499,6 +499,13 @@ MacroAssembler::branchTestDoubleImpl(Condition cond, const T& t, Label* label)
|
||||
j(cond, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchTestDoubleTruthy(bool truthy, FloatRegister reg, Label* label)
|
||||
{
|
||||
Condition cond = testDoubleTruthy(truthy, reg);
|
||||
j(cond, label);
|
||||
}
|
||||
|
||||
//}}} check_macroassembler_style
|
||||
// ===============================================================
|
||||
|
||||
|
@ -582,10 +582,6 @@ class MacroAssemblerX86Shared : public Assembler
|
||||
vucomisd(reg, scratch);
|
||||
return truthy ? NonZero : Zero;
|
||||
}
|
||||
void branchTestDoubleTruthy(bool truthy, FloatRegister reg, Label* label) {
|
||||
Condition cond = testDoubleTruthy(truthy, reg);
|
||||
j(cond, label);
|
||||
}
|
||||
|
||||
// Class which ensures that registers used in byte ops are compatible with
|
||||
// such instructions, even if the original register passed in wasn't. This
|
||||
|
Loading…
Reference in New Issue
Block a user