Bug 1536699 - Part 1: Add missing helpers for Register64. r=jandem

These functions are needed for the next parts.

Differential Revision: https://phabricator.services.mozilla.com/D72639
This commit is contained in:
André Bargull 2020-05-06 10:57:31 +00:00
Родитель b873d056bc
Коммит a38ee50677
5 изменённых файлов: 66 добавлений и 2 удалений

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

@ -332,10 +332,14 @@ class LInt64Value {
ValT high() const { return high_; }
ValT low() const { return low_; }
const ValT* pointerHigh() const { return &high_; }
const ValT* pointerLow() const { return &low_; }
#else
explicit LInt64Value(ValT value) : value_(value) {}
ValT value() const { return value_; }
const ValT* pointer() const { return &value_; }
#endif
};
@ -1039,6 +1043,15 @@ class LInstructionFixedDefsTempsHelper : public LInstruction {
MOZ_ASSERT(index < Temps);
return &defsAndTemps_[Defs + index];
}
LInt64Definition getInt64Temp(size_t index) {
MOZ_ASSERT(index + INT64_PIECES <= Temps);
#if JS_BITS_PER_WORD == 32
return LInt64Definition(defsAndTemps_[Defs + index + INT64HIGH_INDEX],
defsAndTemps_[Defs + index + INT64LOW_INDEX]);
#else
return LInt64Definition(defsAndTemps_[Defs + index]);
#endif
}
void setDef(size_t index, const LDefinition& def) {
MOZ_ASSERT(index < Defs);

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

@ -2626,6 +2626,16 @@ void MacroAssembler::Push(JSValueType type, Register reg) {
framePushed_ += sizeof(Value);
}
void MacroAssembler::Push(const Register64 reg) {
#if JS_BITS_PER_WORD == 64
Push(reg.reg);
#else
MOZ_ASSERT(MOZ_LITTLE_ENDIAN(), "Big-endian not supported.");
Push(reg.high);
Push(reg.low);
#endif
}
void MacroAssembler::PushValue(const Address& addr) {
MOZ_ASSERT(addr.base != getStackPointer());
pushValue(addr);

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

@ -387,6 +387,7 @@ class MacroAssembler : public MacroAssemblerSpecific {
void Push(const ValueOperand& val);
void Push(const Value& val);
void Push(JSValueType type, Register reg);
void Push(const Register64 reg);
void PushValue(const Address& addr);
void PushEmptyRooted(VMFunctionData::RootType rootType);
inline CodeOffset PushWithPatch(ImmWord word);

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

@ -855,8 +855,8 @@ class SpecializedRegSet<Accessors, RegisterSet> : public Accessors {
};
// Interface which is common to all register set implementations. It overloads
// |add|, |take| and |takeUnchecked| methods for types such as |ValueOperand|
// and |TypedOrValueRegister|.
// |add|, |take| and |takeUnchecked| methods for types such as |ValueOperand|,
// |TypedOrValueRegister|, and |Register64|.
template <class Accessors, typename Set>
class CommonRegSet : public SpecializedRegSet<Accessors, Set> {
typedef SpecializedRegSet<Accessors, Set> Parent;
@ -879,6 +879,14 @@ class CommonRegSet : public SpecializedRegSet<Accessors, Set> {
add(value.valueReg());
#else
# error "Bad architecture"
#endif
}
void add(Register64 reg) {
#if JS_BITS_PER_WORD == 32
add(reg.high);
add(reg.low);
#else
add(reg.reg);
#endif
}
@ -891,6 +899,14 @@ class CommonRegSet : public SpecializedRegSet<Accessors, Set> {
addUnchecked(value.valueReg());
#else
# error "Bad architecture"
#endif
}
void addUnchecked(Register64 reg) {
#if JS_BITS_PER_WORD == 32
take(reg.high);
take(reg.low);
#else
take(reg.reg);
#endif
}
@ -920,6 +936,14 @@ class CommonRegSet : public SpecializedRegSet<Accessors, Set> {
take(reg.typedReg());
}
}
void take(Register64 reg) {
#if JS_BITS_PER_WORD == 32
take(reg.high);
take(reg.low);
#else
take(reg.reg);
#endif
}
using Parent::takeUnchecked;
void takeUnchecked(ValueOperand value) {
@ -939,6 +963,14 @@ class CommonRegSet : public SpecializedRegSet<Accessors, Set> {
takeUnchecked(reg.typedReg());
}
}
void takeUnchecked(Register64 reg) {
#if JS_BITS_PER_WORD == 32
takeUnchecked(reg.high);
takeUnchecked(reg.low);
#else
takeUnchecked(reg.reg);
#endif
}
};
// These classes do not provide any additional members, they only use their

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

@ -107,6 +107,14 @@ static inline Register64 ToRegister64(const LInt64Allocation& a) {
#endif
}
static inline Register64 ToRegister64(const LInt64Definition& a) {
#if JS_BITS_PER_WORD == 32
return Register64(ToRegister(a.pointerHigh()), ToRegister(a.pointerLow()));
#else
return Register64(ToRegister(a.pointer()));
#endif
}
static inline Register ToTempRegisterOrInvalid(const LDefinition* def) {
if (def->isBogusTemp()) {
return InvalidReg;