Revert #1142 - Remove unboxed objects

- accounting for removal of watch()/unwatch()
This commit is contained in:
wolfbeast 2020-02-22 21:09:32 +01:00 • committed by Roy Tam
commit 47781d6165
48 changed files with 3400 additions and 75 deletions

View file

@ -375,7 +375,7 @@ class AliasSet {
Element = 1 << 1, // A Value member of obj->elements or
// a typed object.
UnboxedElement = 1 << 2, // An unboxed scalar or reference member of
// typed object.
// typed object or unboxed object.
DynamicSlot = 1 << 3, // A Value member of obj->slots.
FixedSlot = 1 << 4, // A Value member of obj->fixedSlots().
DOMProperty = 1 << 5, // A DOM property
@ -3758,9 +3758,14 @@ class MObjectState
{
private:
uint32_t numSlots_;
uint32_t numFixedSlots_;
uint32_t numFixedSlots_; // valid if isUnboxed() == false.
OperandIndexMap* operandIndex_; // valid if isUnboxed() == true.
MObjectState(JSObject *templateObject);
bool isUnboxed() const {
return operandIndex_ != nullptr;
}
MObjectState(JSObject *templateObject, OperandIndexMap* operandIndex);
explicit MObjectState(MObjectState* state);
MOZ_MUST_USE bool init(TempAllocator& alloc, MDefinition* obj);
@ -3820,6 +3825,18 @@ class MObjectState
setSlot(slot + numFixedSlots(), def);
}
// Interface reserved for unboxed objects.
bool hasOffset(uint32_t offset) const {
MOZ_ASSERT(isUnboxed());
return offset < operandIndex_->map.length() && operandIndex_->map[offset] != 0;
}
MDefinition* getOffset(uint32_t offset) const {
return getOperand(operandIndex_->map[offset]);
}
void setOffset(uint32_t offset, MDefinition* def) {
replaceOperand(operandIndex_->map[offset], def);
}
MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override;
bool canRecoverOnBailout() const override {
return true;