Bug 1608791 - Harden the Rabaldr register wrappers. r=rhunt

By cleaning up the register set APIs very slightly we can simplify the wrappers and
make space for meaningful assertions.

Differential Revision: https://phabricator.services.mozilla.com/D59673

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Lars T Hansen 2020-01-20 07:34:31 +00:00
Родитель 0f2e97ec33
Коммит 716cc538b0
4 изменённых файлов: 34 добавлений и 29 удалений

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

@ -386,8 +386,11 @@ class VFPRegister {
bool isUInt() const { return kind == UInt; }
bool equiv(const VFPRegister& other) const { return other.kind == kind; }
size_t size() const { return (kind == Double) ? 8 : 4; }
bool isInvalid() const;
bool isMissing() const;
bool isInvalid() const { return _isInvalid; }
bool isMissing() const {
MOZ_ASSERT(!_isInvalid);
return _isMissing;
}
VFPRegister doubleOverlay(unsigned int which = 0) const;
VFPRegister singleOverlay(unsigned int which = 0) const;

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

@ -1114,13 +1114,6 @@ VFPRegister VFPRegister::uintOverlay(unsigned int which) const {
return VFPRegister(code_, UInt);
}
bool VFPRegister::isInvalid() const { return _isInvalid; }
bool VFPRegister::isMissing() const {
MOZ_ASSERT(!_isInvalid);
return _isMissing;
}
bool Assembler::oom() const {
return AssemblerShared::oom() || m_buffer.oom() || jumpRelocations_.oom() ||
dataRelocations_.oom();

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

@ -137,6 +137,7 @@ class FloatRegister : public FloatRegisterMIPSShared {
bool isSingle() const { return kind_ == Single; }
bool isDouble() const { return kind_ == Double; }
bool isInvalid() const { return code_ == FloatRegisters::invalid_freg; }
FloatRegister doubleOverlay() const;
FloatRegister singleOverlay() const;

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

@ -299,42 +299,50 @@ struct RegTypeOf<MIRType::Double> {
struct RegI32 : public Register {
RegI32() : Register(Register::Invalid()) {}
explicit RegI32(Register reg) : Register(reg) {}
bool isValid() const { return *this != Invalid(); }
bool isInvalid() const { return !isValid(); }
static RegI32 Invalid() { return RegI32(Register::Invalid()); }
explicit RegI32(Register reg) : Register(reg) {
MOZ_ASSERT(reg != Invalid());
}
bool isInvalid() const { return *this == Invalid(); }
bool isValid() const { return !isInvalid(); }
static RegI32 Invalid() { return RegI32(); }
};
struct RegI64 : public Register64 {
RegI64() : Register64(Register64::Invalid()) {}
explicit RegI64(Register64 reg) : Register64(reg) {}
bool isValid() const { return *this != Invalid(); }
bool isInvalid() const { return !isValid(); }
static RegI64 Invalid() { return RegI64(Register64::Invalid()); }
explicit RegI64(Register64 reg) : Register64(reg) {
MOZ_ASSERT(reg != Invalid());
}
bool isInvalid() const { return *this == Invalid(); }
bool isValid() const { return !isInvalid(); }
static RegI64 Invalid() { return RegI64(); }
};
struct RegPtr : public Register {
RegPtr() : Register(Register::Invalid()) {}
explicit RegPtr(Register reg) : Register(reg) {}
bool isValid() const { return *this != Invalid(); }
bool isInvalid() const { return !isValid(); }
static RegPtr Invalid() { return RegPtr(Register::Invalid()); }
explicit RegPtr(Register reg) : Register(reg) {
MOZ_ASSERT(reg != Invalid());
}
bool isInvalid() const { return *this == Invalid(); }
bool isValid() const { return !isInvalid(); }
static RegPtr Invalid() { return RegPtr(); }
};
struct RegF32 : public FloatRegister {
RegF32() : FloatRegister() {}
explicit RegF32(FloatRegister reg) : FloatRegister(reg) {}
bool isValid() const { return *this != Invalid(); }
bool isInvalid() const { return !isValid(); }
static RegF32 Invalid() { return RegF32(InvalidFloatReg); }
explicit RegF32(FloatRegister reg) : FloatRegister(reg) {
MOZ_ASSERT(isSingle());
}
bool isValid() const { return !isInvalid(); }
static RegF32 Invalid() { return RegF32(); }
};
struct RegF64 : public FloatRegister {
RegF64() : FloatRegister() {}
explicit RegF64(FloatRegister reg) : FloatRegister(reg) {}
bool isValid() const { return *this != Invalid(); }
bool isInvalid() const { return !isValid(); }
static RegF64 Invalid() { return RegF64(InvalidFloatReg); }
explicit RegF64(FloatRegister reg) : FloatRegister(reg) {
MOZ_ASSERT(isDouble());
}
bool isValid() const { return !isInvalid(); }
static RegF64 Invalid() { return RegF64(); }
};
struct AnyReg {