зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1715512 part 16 - Rename inDictionary to isDictionary. r=jonco
Also rename the IN_DICTIONARY flag to IS_DICTIONARY. Shapes are no longer "part of" a dictionary list. Differential Revision: https://phabricator.services.mozilla.com/D117316
This commit is contained in:
Родитель
5694cde5ee
Коммит
f40586484d
|
@ -4766,7 +4766,7 @@ void ShapeSnapshot::checkSelf(JSContext* cx) const {
|
|||
// Assertions based on a single snapshot.
|
||||
|
||||
// Non-dictionary shapes must not be mutated.
|
||||
if (!shape_->inDictionary()) {
|
||||
if (!shape_->isDictionary()) {
|
||||
MOZ_RELEASE_ASSERT(shape_->base() == baseShape_);
|
||||
MOZ_RELEASE_ASSERT(shape_->objectFlags() == objectFlags_);
|
||||
}
|
||||
|
|
|
@ -4562,7 +4562,7 @@ AttachDecision SetPropIRGenerator::tryAttachAddSlotStub(HandleShape oldShape) {
|
|||
#endif
|
||||
|
||||
// Basic shape checks.
|
||||
if (newShape->inDictionary() || !propInfo.isDataProperty() ||
|
||||
if (newShape->isDictionary() || !propInfo.isDataProperty() ||
|
||||
!propInfo.writable()) {
|
||||
return AttachDecision::NoAction;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ inline bool TemplateObject::isPlainObject() const {
|
|||
|
||||
inline gc::Cell* TemplateObject::shape() const {
|
||||
Shape* shape = obj_->shape();
|
||||
MOZ_ASSERT(!shape->inDictionary());
|
||||
MOZ_ASSERT(!shape->isDictionary());
|
||||
return shape;
|
||||
}
|
||||
|
||||
|
|
|
@ -493,7 +493,7 @@ static void StatsCellCallback(JSRuntime* rt, void* data, JS::GCCellPtr cellptr,
|
|||
Shape* shape = &cellptr.as<Shape>();
|
||||
|
||||
JS::ShapeInfo info; // This zeroes all the sizes.
|
||||
if (shape->inDictionary()) {
|
||||
if (shape->isDictionary()) {
|
||||
info.shapesGCHeapDict += thingSize;
|
||||
} else {
|
||||
info.shapesGCHeapTree += thingSize;
|
||||
|
|
|
@ -533,7 +533,7 @@ MOZ_ALWAYS_INLINE void NativeObject::setEmptyDynamicSlots(
|
|||
MOZ_ALWAYS_INLINE bool NativeObject::setShapeAndUpdateSlots(JSContext* cx,
|
||||
Shape* newShape) {
|
||||
MOZ_ASSERT(!inDictionaryMode());
|
||||
MOZ_ASSERT(!newShape->inDictionary());
|
||||
MOZ_ASSERT(!newShape->isDictionary());
|
||||
MOZ_ASSERT(newShape->zone() == zone());
|
||||
MOZ_ASSERT(newShape->numFixedSlots() == numFixedSlots());
|
||||
MOZ_ASSERT(newShape->getObjectClass() == getClass());
|
||||
|
@ -557,7 +557,7 @@ MOZ_ALWAYS_INLINE bool NativeObject::setShapeAndUpdateSlots(JSContext* cx,
|
|||
MOZ_ALWAYS_INLINE bool NativeObject::setShapeAndUpdateSlotsForNewSlot(
|
||||
JSContext* cx, Shape* newShape, uint32_t slot) {
|
||||
MOZ_ASSERT(!inDictionaryMode());
|
||||
MOZ_ASSERT(!newShape->inDictionary());
|
||||
MOZ_ASSERT(!newShape->isDictionary());
|
||||
MOZ_ASSERT(newShape->zone() == zone());
|
||||
MOZ_ASSERT(newShape->numFixedSlots() == numFixedSlots());
|
||||
|
||||
|
|
|
@ -606,7 +606,7 @@ class NativeObject : public JSObject {
|
|||
if (lastProperty()->numFixedSlots() != shape->numFixedSlots()) {
|
||||
return false;
|
||||
}
|
||||
if (lastProperty()->inDictionary() || shape->inDictionary()) {
|
||||
if (lastProperty()->isDictionary() || shape->isDictionary()) {
|
||||
return false;
|
||||
}
|
||||
if (lastProperty()->base() != shape->base()) {
|
||||
|
@ -978,9 +978,8 @@ class NativeObject : public JSObject {
|
|||
|
||||
public:
|
||||
// Return true if this object has been converted from shared-immutable
|
||||
// prototype-rooted shape storage to dictionary-shapes in a doubly-linked
|
||||
// list.
|
||||
bool inDictionaryMode() const { return lastProperty()->inDictionary(); }
|
||||
// shapes to object-owned dictionary shapes.
|
||||
bool inDictionaryMode() const { return shape()->isDictionary(); }
|
||||
|
||||
const Value& getSlot(uint32_t slot) const {
|
||||
MOZ_ASSERT(slotInRange(slot));
|
||||
|
|
|
@ -42,7 +42,7 @@ using JS::AutoCheckCannotGC;
|
|||
Shape* Shape::replaceShape(JSContext* cx, ObjectFlags objectFlags,
|
||||
TaggedProto proto, uint32_t nfixed,
|
||||
HandleShape shape) {
|
||||
MOZ_ASSERT(!shape->inDictionary());
|
||||
MOZ_ASSERT(!shape->isDictionary());
|
||||
|
||||
if (shape->propMap()) {
|
||||
Rooted<BaseShape*> base(cx, shape->base());
|
||||
|
@ -916,7 +916,7 @@ bool NativeObject::clearFlag(JSContext* cx, HandleNativeObject obj,
|
|||
|
||||
/* static */
|
||||
Shape* Shape::setObjectFlag(JSContext* cx, ObjectFlag flag, Shape* shape) {
|
||||
MOZ_ASSERT(!shape->inDictionary());
|
||||
MOZ_ASSERT(!shape->isDictionary());
|
||||
MOZ_ASSERT(!shape->hasObjectFlag(flag));
|
||||
|
||||
ObjectFlags objectFlags = shape->objectFlags();
|
||||
|
@ -953,7 +953,7 @@ bool NativeObject::changeNumFixedSlotsAfterSwap(JSContext* cx,
|
|||
|
||||
/* static */
|
||||
Shape* Shape::setProto(JSContext* cx, TaggedProto proto, Shape* shape) {
|
||||
MOZ_ASSERT(!shape->inDictionary());
|
||||
MOZ_ASSERT(!shape->isDictionary());
|
||||
MOZ_ASSERT(shape->proto() != proto);
|
||||
|
||||
RootedShape shapeRoot(cx, shape);
|
||||
|
|
|
@ -286,7 +286,7 @@ class Shape : public gc::CellWithTenuredGCPointer<gc::TenuredCell, BaseShape> {
|
|||
MAP_LENGTH_MASK = BitMask(4),
|
||||
|
||||
// If set, this is a dictionary shape.
|
||||
IN_DICTIONARY = 1 << 4,
|
||||
IS_DICTIONARY = 1 << 4,
|
||||
|
||||
// Number of fixed slots in objects with this shape.
|
||||
// FIXED_SLOTS_MAX is the biggest count of fixed slots a Shape can store.
|
||||
|
@ -324,7 +324,7 @@ class Shape : public gc::CellWithTenuredGCPointer<gc::TenuredCell, BaseShape> {
|
|||
HandleShape shape);
|
||||
|
||||
void setObjectFlags(ObjectFlags flags) {
|
||||
MOZ_ASSERT(inDictionary());
|
||||
MOZ_ASSERT(isDictionary());
|
||||
objectFlags_ = flags;
|
||||
}
|
||||
|
||||
|
@ -343,11 +343,11 @@ class Shape : public gc::CellWithTenuredGCPointer<gc::TenuredCell, BaseShape> {
|
|||
ShapeCachePtr cache() const { return cache_; }
|
||||
|
||||
SharedPropMap* sharedPropMap() const {
|
||||
MOZ_ASSERT(!inDictionary());
|
||||
MOZ_ASSERT(!isDictionary());
|
||||
return propMap_ ? propMap_->asShared() : nullptr;
|
||||
}
|
||||
DictionaryPropMap* dictionaryPropMap() const {
|
||||
MOZ_ASSERT(inDictionary());
|
||||
MOZ_ASSERT(isDictionary());
|
||||
MOZ_ASSERT(propMap_);
|
||||
return propMap_->asDictionary();
|
||||
}
|
||||
|
@ -367,7 +367,7 @@ class Shape : public gc::CellWithTenuredGCPointer<gc::TenuredCell, BaseShape> {
|
|||
bool lastPropertyMatchesForAdd(PropertyKey key, PropertyFlags flags,
|
||||
uint32_t* slot) const {
|
||||
MOZ_ASSERT(propMapLength() > 0);
|
||||
MOZ_ASSERT(!inDictionary());
|
||||
MOZ_ASSERT(!isDictionary());
|
||||
uint32_t index = propMapLength() - 1;
|
||||
SharedPropMap* map = sharedPropMap();
|
||||
if (map->getKey(index) != key) {
|
||||
|
@ -403,7 +403,7 @@ class Shape : public gc::CellWithTenuredGCPointer<gc::TenuredCell, BaseShape> {
|
|||
Shape(BaseShape* base, ObjectFlags objectFlags, uint32_t nfixed, PropMap* map,
|
||||
uint32_t mapLength, bool isDictionary)
|
||||
: CellWithTenuredGCPointer(base),
|
||||
immutableFlags((isDictionary ? IN_DICTIONARY : 0) |
|
||||
immutableFlags((isDictionary ? IS_DICTIONARY : 0) |
|
||||
(nfixed << FIXED_SLOTS_SHIFT) | mapLength),
|
||||
objectFlags_(objectFlags),
|
||||
propMap_(map) {
|
||||
|
@ -417,16 +417,16 @@ class Shape : public gc::CellWithTenuredGCPointer<gc::TenuredCell, BaseShape> {
|
|||
Shape(const Shape& other) = delete;
|
||||
|
||||
public:
|
||||
bool inDictionary() const { return immutableFlags & IN_DICTIONARY; }
|
||||
bool isDictionary() const { return immutableFlags & IS_DICTIONARY; }
|
||||
|
||||
uint32_t slotSpanSlow() const {
|
||||
MOZ_ASSERT(!inDictionary());
|
||||
MOZ_ASSERT(!isDictionary());
|
||||
const JSClass* clasp = getObjectClass();
|
||||
return SharedPropMap::slotSpan(clasp, sharedPropMap(), propMapLength());
|
||||
}
|
||||
|
||||
void initSmallSlotSpan() {
|
||||
MOZ_ASSERT(!inDictionary());
|
||||
MOZ_ASSERT(!isDictionary());
|
||||
uint32_t slotSpan = slotSpanSlow();
|
||||
if (slotSpan > SMALL_SLOTSPAN_MAX) {
|
||||
slotSpan = SMALL_SLOTSPAN_MAX;
|
||||
|
@ -436,7 +436,7 @@ class Shape : public gc::CellWithTenuredGCPointer<gc::TenuredCell, BaseShape> {
|
|||
}
|
||||
|
||||
uint32_t slotSpan() const {
|
||||
MOZ_ASSERT(!inDictionary());
|
||||
MOZ_ASSERT(!isDictionary());
|
||||
MOZ_ASSERT(getObjectClass()->isNativeObject());
|
||||
uint32_t span =
|
||||
(immutableFlags & SMALL_SLOTSPAN_MASK) >> SMALL_SLOTSPAN_SHIFT;
|
||||
|
@ -459,7 +459,7 @@ class Shape : public gc::CellWithTenuredGCPointer<gc::TenuredCell, BaseShape> {
|
|||
|
||||
void setBase(BaseShape* base) {
|
||||
MOZ_ASSERT(base);
|
||||
MOZ_ASSERT(inDictionary());
|
||||
MOZ_ASSERT(isDictionary());
|
||||
setHeaderPtr(base);
|
||||
}
|
||||
|
||||
|
@ -493,7 +493,7 @@ class Shape : public gc::CellWithTenuredGCPointer<gc::TenuredCell, BaseShape> {
|
|||
private:
|
||||
void updateNewDictionaryShape(ObjectFlags flags, DictionaryPropMap* map,
|
||||
uint32_t mapLength) {
|
||||
MOZ_ASSERT(inDictionary());
|
||||
MOZ_ASSERT(isDictionary());
|
||||
objectFlags_ = flags;
|
||||
propMap_ = map;
|
||||
immutableFlags = (immutableFlags & ~MAP_LENGTH_MASK) | mapLength;
|
||||
|
@ -607,7 +607,7 @@ class MOZ_RAII ShapePropertyIter {
|
|||
ShapePropertyIter(JSContext* cx, Shape* shape)
|
||||
: map_(cx, shape->propMap()),
|
||||
mapLength_(shape->propMapLength()),
|
||||
isDictionary_(shape->inDictionary()) {
|
||||
isDictionary_(shape->isDictionary()) {
|
||||
static_assert(allowGC == CanGC);
|
||||
MOZ_ASSERT(shape->getObjectClass()->isNativeObject());
|
||||
}
|
||||
|
@ -615,7 +615,7 @@ class MOZ_RAII ShapePropertyIter {
|
|||
explicit ShapePropertyIter(Shape* shape)
|
||||
: map_(nullptr, shape->propMap()),
|
||||
mapLength_(shape->propMapLength()),
|
||||
isDictionary_(shape->inDictionary()) {
|
||||
isDictionary_(shape->isDictionary()) {
|
||||
static_assert(allowGC == NoGC);
|
||||
MOZ_ASSERT(shape->getObjectClass()->isNativeObject());
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче