Bug 1202222 - IonMonkey: MIPS32: Move compat functions to MacroAssemblerMIPSCompat. r=nbp

--HG--
extra : rebase_source : 1f28c4c80af738146ef3aedaaf404285d6d7fba5
This commit is contained in:
Heiher 2015-09-10 19:41:00 +02:00
Родитель 025fee3612
Коммит 918201465a
2 изменённых файлов: 111 добавлений и 120 удалений

Просмотреть файл

@ -30,7 +30,7 @@ static const int32_t TAG_OFFSET = NUNBOX32_TYPE_OFFSET;
static_assert(sizeof(intptr_t) == 4, "Not 64-bit clean.");
void
MacroAssemblerMIPS::convertBoolToInt32(Register src, Register dest)
MacroAssemblerMIPSCompat::convertBoolToInt32(Register src, Register dest)
{
// Note that C++ bool is only 1 byte, so zero extend it to clear the
// higher-order bits.
@ -38,14 +38,14 @@ MacroAssemblerMIPS::convertBoolToInt32(Register src, Register dest)
}
void
MacroAssemblerMIPS::convertInt32ToDouble(Register src, FloatRegister dest)
MacroAssemblerMIPSCompat::convertInt32ToDouble(Register src, FloatRegister dest)
{
as_mtc1(src, dest);
as_cvtdw(dest, dest);
}
void
MacroAssemblerMIPS::convertInt32ToDouble(const Address& src, FloatRegister dest)
MacroAssemblerMIPSCompat::convertInt32ToDouble(const Address& src, FloatRegister dest)
{
ma_lw(ScratchRegister, src);
as_mtc1(ScratchRegister, dest);
@ -53,14 +53,14 @@ MacroAssemblerMIPS::convertInt32ToDouble(const Address& src, FloatRegister dest)
}
void
MacroAssemblerMIPS::convertInt32ToDouble(const BaseIndex& src, FloatRegister dest)
MacroAssemblerMIPSCompat::convertInt32ToDouble(const BaseIndex& src, FloatRegister dest)
{
computeScaledAddress(src, SecondScratchReg);
convertInt32ToDouble(Address(SecondScratchReg, src.offset), dest);
}
void
MacroAssemblerMIPS::convertUInt32ToDouble(Register src, FloatRegister dest)
MacroAssemblerMIPSCompat::convertUInt32ToDouble(Register src, FloatRegister dest)
{
// We use SecondScratchDoubleReg because MacroAssembler::loadFromTypedArray
// calls with ScratchDoubleReg as dest.
@ -79,7 +79,7 @@ MacroAssemblerMIPS::convertUInt32ToDouble(Register src, FloatRegister dest)
}
void
MacroAssemblerMIPS::convertUInt32ToFloat32(Register src, FloatRegister dest)
MacroAssemblerMIPSCompat::convertUInt32ToFloat32(Register src, FloatRegister dest)
{
Label positive, done;
ma_b(src, src, &positive, NotSigned, ShortJump);
@ -97,7 +97,7 @@ MacroAssemblerMIPS::convertUInt32ToFloat32(Register src, FloatRegister dest)
}
void
MacroAssemblerMIPS::convertDoubleToFloat32(FloatRegister src, FloatRegister dest)
MacroAssemblerMIPSCompat::convertDoubleToFloat32(FloatRegister src, FloatRegister dest)
{
as_cvtsd(dest, src);
}
@ -107,7 +107,7 @@ MacroAssemblerMIPS::convertDoubleToFloat32(FloatRegister src, FloatRegister dest
// NOTE: if the value really was supposed to be INT32_MAX / INT32_MIN then it
// will be wrong.
void
MacroAssemblerMIPS::branchTruncateDouble(FloatRegister src, Register dest,
MacroAssemblerMIPSCompat::branchTruncateDouble(FloatRegister src, Register dest,
Label* fail)
{
Label test, success;
@ -122,7 +122,7 @@ MacroAssemblerMIPS::branchTruncateDouble(FloatRegister src, Register dest,
// integer is written to the output register. Otherwise, a bailout is taken to
// the given snapshot. This function overwrites the scratch float register.
void
MacroAssemblerMIPS::convertDoubleToInt32(FloatRegister src, Register dest,
MacroAssemblerMIPSCompat::convertDoubleToInt32(FloatRegister src, Register dest,
Label* fail, bool negativeZeroCheck)
{
// Convert double to int, then convert back and check if we have the
@ -148,7 +148,7 @@ MacroAssemblerMIPS::convertDoubleToInt32(FloatRegister src, Register dest,
// integer is written to the output register. Otherwise, a bailout is taken to
// the given snapshot. This function overwrites the scratch float register.
void
MacroAssemblerMIPS::convertFloat32ToInt32(FloatRegister src, Register dest,
MacroAssemblerMIPSCompat::convertFloat32ToInt32(FloatRegister src, Register dest,
Label* fail, bool negativeZeroCheck)
{
// Converting the floating point value to an integer and then converting it
@ -177,13 +177,13 @@ MacroAssemblerMIPS::convertFloat32ToInt32(FloatRegister src, Register dest,
}
void
MacroAssemblerMIPS::convertFloat32ToDouble(FloatRegister src, FloatRegister dest)
MacroAssemblerMIPSCompat::convertFloat32ToDouble(FloatRegister src, FloatRegister dest)
{
as_cvtds(dest, src);
}
void
MacroAssemblerMIPS::branchTruncateFloat32(FloatRegister src, Register dest,
MacroAssemblerMIPSCompat::branchTruncateFloat32(FloatRegister src, Register dest,
Label* fail)
{
Label test, success;
@ -194,14 +194,14 @@ MacroAssemblerMIPS::branchTruncateFloat32(FloatRegister src, Register dest,
}
void
MacroAssemblerMIPS::convertInt32ToFloat32(Register src, FloatRegister dest)
MacroAssemblerMIPSCompat::convertInt32ToFloat32(Register src, FloatRegister dest)
{
as_mtc1(src, dest);
as_cvtsw(dest, dest);
}
void
MacroAssemblerMIPS::convertInt32ToFloat32(const Address& src, FloatRegister dest)
MacroAssemblerMIPSCompat::convertInt32ToFloat32(const Address& src, FloatRegister dest)
{
ma_lw(ScratchRegister, src);
as_mtc1(ScratchRegister, dest);
@ -209,37 +209,37 @@ MacroAssemblerMIPS::convertInt32ToFloat32(const Address& src, FloatRegister dest
}
void
MacroAssemblerMIPS::addDouble(FloatRegister src, FloatRegister dest)
MacroAssemblerMIPSCompat::addDouble(FloatRegister src, FloatRegister dest)
{
as_addd(dest, dest, src);
}
void
MacroAssemblerMIPS::subDouble(FloatRegister src, FloatRegister dest)
MacroAssemblerMIPSCompat::subDouble(FloatRegister src, FloatRegister dest)
{
as_subd(dest, dest, src);
}
void
MacroAssemblerMIPS::mulDouble(FloatRegister src, FloatRegister dest)
MacroAssemblerMIPSCompat::mulDouble(FloatRegister src, FloatRegister dest)
{
as_muld(dest, dest, src);
}
void
MacroAssemblerMIPS::divDouble(FloatRegister src, FloatRegister dest)
MacroAssemblerMIPSCompat::divDouble(FloatRegister src, FloatRegister dest)
{
as_divd(dest, dest, src);
}
void
MacroAssemblerMIPS::negateDouble(FloatRegister reg)
MacroAssemblerMIPSCompat::negateDouble(FloatRegister reg)
{
as_negd(reg, reg);
}
void
MacroAssemblerMIPS::inc64(AbsoluteAddress dest)
MacroAssemblerMIPSCompat::inc64(AbsoluteAddress dest)
{
ma_li(ScratchRegister, Imm32((int32_t)dest.addr));
as_lw(SecondScratchReg, ScratchRegister, 0);
@ -758,7 +758,7 @@ void
MacroAssemblerMIPS::ma_load(Register dest, const BaseIndex& src,
LoadStoreSize size, LoadStoreExtension extension)
{
computeScaledAddress(src, SecondScratchReg);
asMasm().computeScaledAddress(src, SecondScratchReg);
ma_load(dest, Address(SecondScratchReg, src.offset), size, extension);
}
@ -797,7 +797,7 @@ void
MacroAssemblerMIPS::ma_store(Register data, const BaseIndex& dest,
LoadStoreSize size, LoadStoreExtension extension)
{
computeScaledAddress(dest, SecondScratchReg);
asMasm().computeScaledAddress(dest, SecondScratchReg);
ma_store(data, Address(SecondScratchReg, dest.offset), size, extension);
}
@ -807,7 +807,7 @@ MacroAssemblerMIPS::ma_store(Imm32 imm, const BaseIndex& dest,
{
// Make sure that SecondScratchReg contains absolute address so that
// offset is 0.
computeEffectiveAddress(dest, SecondScratchReg);
asMasm().computeEffectiveAddress(dest, SecondScratchReg);
// Scrach register is free now, use it for loading imm value
ma_li(ScratchRegister, imm);
@ -818,7 +818,7 @@ MacroAssemblerMIPS::ma_store(Imm32 imm, const BaseIndex& dest,
}
void
MacroAssemblerMIPS::computeScaledAddress(const BaseIndex& address, Register dest)
MacroAssemblerMIPSCompat::computeScaledAddress(const BaseIndex& address, Register dest)
{
int32_t shift = Imm32::ShiftOf(address.scale).value;
if (shift) {
@ -1448,7 +1448,7 @@ MacroAssemblerMIPS::ma_sd(FloatRegister ft, Address address)
void
MacroAssemblerMIPS::ma_sd(FloatRegister ft, BaseIndex address)
{
computeScaledAddress(address, SecondScratchReg);
asMasm().computeScaledAddress(address, SecondScratchReg);
ma_sd(ft, Address(SecondScratchReg, address.offset));
}
@ -1467,7 +1467,7 @@ MacroAssemblerMIPS::ma_ss(FloatRegister ft, Address address)
void
MacroAssemblerMIPS::ma_ss(FloatRegister ft, BaseIndex address)
{
computeScaledAddress(address, SecondScratchReg);
asMasm().computeScaledAddress(address, SecondScratchReg);
ma_ss(ft, Address(SecondScratchReg, address.offset));
}
@ -2070,13 +2070,13 @@ MacroAssemblerMIPSCompat::branchFloat(DoubleCondition cond, FloatRegister lhs,
// higher level tag testing code
Operand
MacroAssemblerMIPS::ToPayload(Operand base)
MacroAssemblerMIPSCompat::ToPayload(Operand base)
{
return Operand(Register::FromCode(base.base()), base.disp() + PAYLOAD_OFFSET);
}
Operand
MacroAssemblerMIPS::ToType(Operand base)
MacroAssemblerMIPSCompat::ToType(Operand base)
{
return Operand(Register::FromCode(base.base()), base.disp() + TAG_OFFSET);
}
@ -3262,13 +3262,13 @@ MacroAssemblerMIPSCompat::profilerExitFrame()
}
MacroAssembler&
MacroAssemblerMIPSCompat::asMasm()
MacroAssemblerMIPS::asMasm()
{
return *static_cast<MacroAssembler*>(this);
}
const MacroAssembler&
MacroAssemblerMIPSCompat::asMasm() const
MacroAssemblerMIPS::asMasm() const
{
return *static_cast<const MacroAssembler*>(this);
}

Просмотреть файл

@ -67,49 +67,19 @@ static_assert(1 << defaultShift == sizeof(JS::Value), "The defaultShift is wrong
class MacroAssemblerMIPS : public Assembler
{
public:
// higher level tag testing code
Operand ToPayload(Operand base);
Address ToPayload(Address base) {
return ToPayload(Operand(base)).toAddress();
}
protected:
Operand ToType(Operand base);
Address ToType(Address base) {
return ToType(Operand(base)).toAddress();
}
// Perform a downcast. Should be removed by Bug 996602.
MacroAssembler& asMasm();
const MacroAssembler& asMasm() const;
void branchWithCode(InstImm code, Label* label, JumpKind jumpKind);
Condition ma_cmp(Register rd, Register lhs, Register rhs, Condition c);
void compareFloatingPoint(FloatFormat fmt, FloatRegister lhs, FloatRegister rhs,
DoubleCondition c, FloatTestKind* testKind,
FPConditionBit fcc = FCC0);
public:
void convertBoolToInt32(Register source, Register dest);
void convertInt32ToDouble(Register src, FloatRegister dest);
void convertInt32ToDouble(const Address& src, FloatRegister dest);
void convertInt32ToDouble(const BaseIndex& src, FloatRegister dest);
void convertUInt32ToDouble(Register src, FloatRegister dest);
void convertUInt32ToFloat32(Register src, FloatRegister dest);
void convertDoubleToFloat32(FloatRegister src, FloatRegister dest);
void branchTruncateDouble(FloatRegister src, Register dest, Label* fail);
void convertDoubleToInt32(FloatRegister src, Register dest, Label* fail,
bool negativeZeroCheck = true);
void convertFloat32ToInt32(FloatRegister src, Register dest, Label* fail,
bool negativeZeroCheck = true);
void convertFloat32ToDouble(FloatRegister src, FloatRegister dest);
void branchTruncateFloat32(FloatRegister src, Register dest, Label* fail);
void convertInt32ToFloat32(Register src, FloatRegister dest);
void convertInt32ToFloat32(const Address& src, FloatRegister dest);
void addDouble(FloatRegister src, FloatRegister dest);
void subDouble(FloatRegister src, FloatRegister dest);
void mulDouble(FloatRegister src, FloatRegister dest);
void divDouble(FloatRegister src, FloatRegister dest);
void negateDouble(FloatRegister reg);
void inc64(AbsoluteAddress dest);
public:
void ma_move(Register rd, Register rs);
void ma_li(Register dest, ImmGCPtr ptr);
@ -170,19 +140,6 @@ class MacroAssemblerMIPS : public Assembler
void ma_store(Imm32 imm, const BaseIndex& dest, LoadStoreSize size = SizeWord,
LoadStoreExtension extension = SignExtend);
void computeScaledAddress(const BaseIndex& address, Register dest);
void computeEffectiveAddress(const Address& address, Register dest) {
ma_addu(dest, address.base, Imm32(address.offset));
}
void computeEffectiveAddress(const BaseIndex& address, Register dest) {
computeScaledAddress(address, dest);
if (address.offset) {
ma_addu(dest, dest, Imm32(address.offset));
}
}
// arithmetic based ops
// add
void ma_addu(Register rd, Register rs, Imm32 imm);
@ -280,6 +237,24 @@ class MacroAssemblerMIPS : public Assembler
void ma_bc1d(FloatRegister lhs, FloatRegister rhs, Label* label, DoubleCondition c,
JumpKind jumpKind = LongJump, FPConditionBit fcc = FCC0);
void ma_call(ImmPtr dest);
void ma_jump(ImmPtr dest);
void ma_cmp_set(Register dst, Register lhs, Register rhs, Condition c);
void ma_cmp_set(Register dst, Register lhs, Imm32 imm, Condition c);
void ma_cmp_set(Register dst, Register lhs, ImmPtr imm, Condition c) {
ma_cmp_set(dst, lhs, Imm32(uint32_t(imm.value)), c);
}
void ma_cmp_set(Register rd, Register rs, Address addr, Condition c);
void ma_cmp_set(Register dst, Address lhs, Register rhs, Condition c);
void ma_cmp_set(Register dst, Address lhs, ImmPtr imm, Condition c) {
ma_lw(ScratchRegister, lhs);
ma_li(SecondScratchReg, Imm32(uint32_t(imm.value)));
ma_cmp_set(dst, ScratchRegister, SecondScratchReg, c);
}
void ma_cmp_set_double(Register dst, FloatRegister lhs, FloatRegister rhs, DoubleCondition c);
void ma_cmp_set_float32(Register dst, FloatRegister lhs, FloatRegister rhs, DoubleCondition c);
// These fuctions abstract the access to high part of the double precision
// float register. It is intended to work on both 32 bit and 64 bit
@ -305,51 +280,56 @@ class MacroAssemblerMIPS : public Assembler
void moveFromFloat32(FloatRegister src, Register dest) {
as_mfc1(dest, src);
}
protected:
void branchWithCode(InstImm code, Label* label, JumpKind jumpKind);
Condition ma_cmp(Register rd, Register lhs, Register rhs, Condition c);
void compareFloatingPoint(FloatFormat fmt, FloatRegister lhs, FloatRegister rhs,
DoubleCondition c, FloatTestKind* testKind,
FPConditionBit fcc = FCC0);
public:
void ma_call(ImmPtr dest);
void ma_jump(ImmPtr dest);
void ma_cmp_set(Register dst, Register lhs, Register rhs, Condition c);
void ma_cmp_set(Register dst, Register lhs, Imm32 imm, Condition c);
void ma_cmp_set(Register dst, Register lhs, ImmPtr imm, Condition c) {
ma_cmp_set(dst, lhs, Imm32(uint32_t(imm.value)), c);
}
void ma_cmp_set(Register rd, Register rs, Address addr, Condition c);
void ma_cmp_set(Register dst, Address lhs, Register rhs, Condition c);
void ma_cmp_set(Register dst, Address lhs, ImmPtr imm, Condition c) {
ma_lw(ScratchRegister, lhs);
ma_li(SecondScratchReg, Imm32(uint32_t(imm.value)));
ma_cmp_set(dst, ScratchRegister, SecondScratchReg, c);
}
void ma_cmp_set_double(Register dst, FloatRegister lhs, FloatRegister rhs, DoubleCondition c);
void ma_cmp_set_float32(Register dst, FloatRegister lhs, FloatRegister rhs, DoubleCondition c);
};
class MacroAssembler;
class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS
{
private:
// Perform a downcast. Should be removed by Bug 996602.
MacroAssembler& asMasm();
const MacroAssembler& asMasm() const;
public:
using MacroAssemblerMIPS::call;
MacroAssemblerMIPSCompat()
{ }
public:
using MacroAssemblerMIPS::call;
void convertBoolToInt32(Register source, Register dest);
void convertInt32ToDouble(Register src, FloatRegister dest);
void convertInt32ToDouble(const Address& src, FloatRegister dest);
void convertInt32ToDouble(const BaseIndex& src, FloatRegister dest);
void convertUInt32ToDouble(Register src, FloatRegister dest);
void convertUInt32ToFloat32(Register src, FloatRegister dest);
void convertDoubleToFloat32(FloatRegister src, FloatRegister dest);
void branchTruncateDouble(FloatRegister src, Register dest, Label* fail);
void convertDoubleToInt32(FloatRegister src, Register dest, Label* fail,
bool negativeZeroCheck = true);
void convertFloat32ToInt32(FloatRegister src, Register dest, Label* fail,
bool negativeZeroCheck = true);
void convertFloat32ToDouble(FloatRegister src, FloatRegister dest);
void branchTruncateFloat32(FloatRegister src, Register dest, Label* fail);
void convertInt32ToFloat32(Register src, FloatRegister dest);
void convertInt32ToFloat32(const Address& src, FloatRegister dest);
void addDouble(FloatRegister src, FloatRegister dest);
void subDouble(FloatRegister src, FloatRegister dest);
void mulDouble(FloatRegister src, FloatRegister dest);
void divDouble(FloatRegister src, FloatRegister dest);
void negateDouble(FloatRegister reg);
void inc64(AbsoluteAddress dest);
void computeScaledAddress(const BaseIndex& address, Register dest);
void computeEffectiveAddress(const Address& address, Register dest) {
ma_addu(dest, address.base, Imm32(address.offset));
}
void computeEffectiveAddress(const BaseIndex& address, Register dest) {
computeScaledAddress(address, dest);
if (address.offset) {
ma_addu(dest, dest, Imm32(address.offset));
}
}
void j(Label* dest) {
ma_b(dest);
@ -715,10 +695,21 @@ class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS
branch32(cond, lhs, Imm32(0), label);
}
protected:
// higher level tag testing code
Operand ToPayload(Operand base);
Address ToPayload(Address base) {
return ToPayload(Operand(base)).toAddress();
}
protected:
Operand ToType(Operand base);
Address ToType(Address base) {
return ToType(Operand(base)).toAddress();
}
uint32_t getType(const Value& val);
void moveData(const Value& val, Register data);
public:
public:
void moveValue(const Value& val, Register type, Register data);
CodeOffsetJump backedgeJump(RepatchLabel* label, Label* documentation = nullptr);