Bug 1245112 - Part 27: Move MacroAssembler::branchTestStringTruthy into generic macro assembler. r=sstangl

This commit is contained in:
Tooru Fujisawa 2016-03-03 08:03:43 +09:00
parent db57c2037f
commit 0fa4cdb134
15 changed files with 41 additions and 37 deletions

View File

@ -966,6 +966,8 @@ class MacroAssembler : public MacroAssemblerSpecific
DEFINED_ON(arm, arm64, mips32, mips64, x86_shared);
inline void branchTestDoubleTruthy(bool truthy, FloatRegister reg, Label* label) PER_SHARED_ARCH;
inline void branchTestBooleanTruthy(bool truthy, const ValueOperand& value, Label* label) PER_ARCH;
inline void branchTestStringTruthy(bool truthy, const ValueOperand& value, Label* label)
DEFINED_ON(arm, arm64, mips32, mips64, x86_shared);
private:

View File

@ -994,6 +994,13 @@ MacroAssembler::branchTestStringImpl(Condition cond, const T& t, Label* label)
ma_b(label, c);
}
void
MacroAssembler::branchTestStringTruthy(bool truthy, const ValueOperand& value, Label* label)
{
Condition c = testStringTruthy(truthy, value);
ma_b(label, c);
}
//}}} check_macroassembler_style
// ===============================================================

View File

@ -787,10 +787,6 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
MOZ_ASSERT(cond == Equal || cond == NotEqual);
branchTestValue(cond, val, MagicValue(why), label);
}
void branchTestStringTruthy(bool truthy, const ValueOperand& value, Label* label) {
Condition c = testStringTruthy(truthy, value);
ma_b(label, c);
}
void moveValue(const Value& val, Register type, Register data);
CodeOffsetJump jumpWithPatch(RepatchLabel* label, Condition cond = Always,

View File

@ -1093,6 +1093,13 @@ MacroAssembler::branchTestStringImpl(Condition cond, const T& t, Label* label)
B(label, c);
}
void
MacroAssembler::branchTestStringTruthy(bool truthy, const ValueOperand& value, Label* label)
{
Condition c = testStringTruthy(truthy, value);
B(label, c);
}
//}}} check_macroassembler_style
// ===============================================================

View File

@ -1906,10 +1906,6 @@ class MacroAssemblerCompat : public vixl::MacroAssembler
Cmp(scratch32, Operand(0));
return truthy ? Condition::NonZero : Condition::Zero;
}
void branchTestStringTruthy(bool truthy, const ValueOperand& value, Label* label) {
Condition c = testStringTruthy(truthy, value);
B(label, c);
}
void int32OrDouble(Register src, ARMFPRegister dest) {
Label isInt32;
Label join;

View File

@ -347,6 +347,15 @@ MacroAssembler::branchTestString(Condition cond, const ValueOperand& value, Labe
branchTestString(cond, value.typeReg(), label);
}
void
MacroAssembler::branchTestStringTruthy(bool b, const ValueOperand& value, Label* label)
{
Register string = value.payloadReg();
SecondScratchRegisterScope scratch2(*this);
ma_lw(scratch2, Address(string, JSString::offsetOfLength()));
ma_b(scratch2, Imm32(0), label, b ? NotEqual : Equal);
}
//}}} check_macroassembler_style
// ===============================================================

View File

@ -1508,14 +1508,6 @@ MacroAssemblerMIPSCompat::loadConstantDouble(double dp, FloatRegister dest)
ma_lid(dest, dp);
}
void
MacroAssemblerMIPSCompat::branchTestStringTruthy(bool b, const ValueOperand& value, Label* label)
{
Register string = value.payloadReg();
ma_lw(SecondScratchReg, Address(string, JSString::offsetOfLength()));
ma_b(SecondScratchReg, Imm32(0), label, b ? NotEqual : Equal);
}
Register
MacroAssemblerMIPSCompat::extractObject(const Address& address, Register scratch)
{

View File

@ -405,8 +405,6 @@ class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS
branchTestValue(cond, val, MagicValue(why), label);
}
void branchTestStringTruthy(bool b, const ValueOperand& value, Label* label);
// higher level tag testing code
Operand ToPayload(Operand base);
Address ToPayload(Address base) {

View File

@ -296,6 +296,15 @@ MacroAssembler::branchTestString(Condition cond, const ValueOperand& value, Labe
branchTestString(cond, scratch2, label);
}
void
MacroAssembler::branchTestStringTruthy(bool b, const ValueOperand& value, Label* label)
{
SecondScratchRegisterScope scratch2(*this);
unboxString(value, scratch2);
load32(Address(scratch2, JSString::offsetOfLength()), scratch2);
ma_b(scratch2, Imm32(0), label, b ? NotEqual : Equal);
}
//}}} check_macroassembler_style
// ===============================================================

View File

@ -1728,14 +1728,6 @@ MacroAssemblerMIPS64Compat::loadConstantDouble(double dp, FloatRegister dest)
ma_lid(dest, dp);
}
void
MacroAssemblerMIPS64Compat::branchTestStringTruthy(bool b, const ValueOperand& value, Label* label)
{
unboxString(value, SecondScratchReg);
load32(Address(SecondScratchReg, JSString::offsetOfLength()), SecondScratchReg);
ma_b(SecondScratchReg, Imm32(0), label, b ? NotEqual : Equal);
}
Register
MacroAssemblerMIPS64Compat::extractObject(const Address& address, Register scratch)
{

View File

@ -446,8 +446,6 @@ class MacroAssemblerMIPS64Compat : public MacroAssemblerMIPS64
branchTestValue(cond, val, MagicValue(why), label);
}
void branchTestStringTruthy(bool b, const ValueOperand& value, Label* label);
// higher level tag testing code
Address ToPayload(Address value) {
return value;

View File

@ -389,7 +389,6 @@ class MacroAssemblerNone : public Assembler
void loadConstantFloat32(float, FloatRegister) { MOZ_CRASH(); }
Condition testInt32Truthy(bool, ValueOperand) { MOZ_CRASH(); }
Condition testStringTruthy(bool, ValueOperand) { MOZ_CRASH(); }
void branchTestStringTruthy(bool, ValueOperand, Label*) { MOZ_CRASH(); }
template <typename T> void loadUnboxedValue(T, MIRType, AnyRegister) { MOZ_CRASH(); }
template <typename T> void storeUnboxedValue(ConstantOrRegister, MIRType, T, MIRType) { MOZ_CRASH(); }

View File

@ -966,10 +966,6 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
cmp32(Operand(scratch, JSString::offsetOfLength()), Imm32(0));
return truthy ? Assembler::NotEqual : Assembler::Equal;
}
void branchTestStringTruthy(bool truthy, const ValueOperand& value, Label* label) {
Condition cond = testStringTruthy(truthy, value);
j(cond, label);
}
template <typename T>
inline void loadInt32OrDouble(const T& src, FloatRegister dest);

View File

@ -616,6 +616,13 @@ MacroAssembler::branchTestStringImpl(Condition cond, const T& t, Label* label)
j(cond, label);
}
void
MacroAssembler::branchTestStringTruthy(bool truthy, const ValueOperand& value, Label* label)
{
Condition cond = testStringTruthy(truthy, value);
j(cond, label);
}
//}}} check_macroassembler_style
// ===============================================================

View File

@ -825,10 +825,6 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
cmp32(Operand(string, JSString::offsetOfLength()), Imm32(0));
return truthy ? Assembler::NotEqual : Assembler::Equal;
}
void branchTestStringTruthy(bool truthy, const ValueOperand& value, Label* label) {
Condition cond = testStringTruthy(truthy, value);
j(cond, label);
}
template <typename T>
inline void loadInt32OrDouble(const T& src, FloatRegister dest);