mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 751377 - Rename PropertyTable to ShapeTable, so that the new property representation can use the PropertyTable name in the interim while both representations are compiled but only one is used. r=bhackett
--HG-- extra : rebase_source : 43867f7bc935fd5ba41e93ea9f25e4bd8af60d4d
This commit is contained in:
parent
1d2ba95dba
commit
32c9789b3d
@ -4325,10 +4325,10 @@ JSObject::allocSlot(JSContext *cx, uint32_t *slotp)
|
||||
|
||||
/*
|
||||
* If this object is in dictionary mode, try to pull a free slot from the
|
||||
* property table's slot-number freelist.
|
||||
* shape table's slot-number freelist.
|
||||
*/
|
||||
if (inDictionaryMode()) {
|
||||
PropertyTable &table = lastProperty()->table();
|
||||
ShapeTable &table = lastProperty()->table();
|
||||
uint32_t last = table.freelist;
|
||||
if (last != SHAPE_INVALID_SLOT) {
|
||||
#ifdef DEBUG
|
||||
@ -6178,8 +6178,8 @@ JSObject::dump()
|
||||
if (obj->isNative()) {
|
||||
if (obj->inDictionaryMode())
|
||||
fprintf(stderr, " inDictionaryMode");
|
||||
if (obj->hasPropertyTable())
|
||||
fprintf(stderr, " hasPropertyTable");
|
||||
if (obj->hasShapeTable())
|
||||
fprintf(stderr, " hasShapeTable");
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
|
@ -396,7 +396,7 @@ struct JSObject : public js::ObjectImpl
|
||||
|
||||
inline uint32_t propertyCount() const;
|
||||
|
||||
inline bool hasPropertyTable() const;
|
||||
inline bool hasShapeTable() const;
|
||||
|
||||
inline size_t computedSizeOfThisSlotsElements() const;
|
||||
|
||||
|
@ -975,7 +975,7 @@ JSObject::propertyCount() const
|
||||
}
|
||||
|
||||
inline bool
|
||||
JSObject::hasPropertyTable() const
|
||||
JSObject::hasShapeTable() const
|
||||
{
|
||||
return lastProperty()->hasTable();
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ using namespace js;
|
||||
using namespace js::gc;
|
||||
|
||||
bool
|
||||
PropertyTable::init(JSRuntime *rt, Shape *lastProp)
|
||||
ShapeTable::init(JSRuntime *rt, Shape *lastProp)
|
||||
{
|
||||
/*
|
||||
* Either we're creating a table for a large scope that was populated
|
||||
@ -82,7 +82,7 @@ PropertyTable::init(JSRuntime *rt, Shape *lastProp)
|
||||
|
||||
/*
|
||||
* Use rt->calloc_ for memory accounting and overpressure handling
|
||||
* without OOM reporting. See PropertyTable::change.
|
||||
* without OOM reporting. See ShapeTable::change.
|
||||
*/
|
||||
entries = (Shape **) rt->calloc_(sizeOfEntries(JS_BIT(sizeLog2)));
|
||||
if (!entries)
|
||||
@ -154,7 +154,7 @@ Shape::hashify(JSContext *cx)
|
||||
return false;
|
||||
|
||||
JSRuntime *rt = cx->runtime;
|
||||
PropertyTable *table = rt->new_<PropertyTable>(self->entryCount());
|
||||
ShapeTable *table = rt->new_<ShapeTable>(self->entryCount());
|
||||
if (!table)
|
||||
return false;
|
||||
|
||||
@ -175,7 +175,7 @@ Shape::hashify(JSContext *cx)
|
||||
#define HASH2(hash0,log2,shift) ((((hash0) << (log2)) >> (shift)) | 1)
|
||||
|
||||
Shape **
|
||||
PropertyTable::search(jsid id, bool adding)
|
||||
ShapeTable::search(jsid id, bool adding)
|
||||
{
|
||||
JSHashNumber hash0, hash1, hash2;
|
||||
int sizeLog2;
|
||||
@ -253,7 +253,7 @@ PropertyTable::search(jsid id, bool adding)
|
||||
}
|
||||
|
||||
bool
|
||||
PropertyTable::change(int log2Delta, JSContext *cx)
|
||||
ShapeTable::change(int log2Delta, JSContext *cx)
|
||||
{
|
||||
JS_ASSERT(entries);
|
||||
|
||||
@ -291,7 +291,7 @@ PropertyTable::change(int log2Delta, JSContext *cx)
|
||||
}
|
||||
|
||||
bool
|
||||
PropertyTable::grow(JSContext *cx)
|
||||
ShapeTable::grow(JSContext *cx)
|
||||
{
|
||||
JS_ASSERT(needsToGrow());
|
||||
|
||||
@ -544,7 +544,7 @@ JSObject::addPropertyInternal(JSContext *cx, jsid id,
|
||||
|
||||
RootGetterSetter gsRoot(cx, attrs, &getter, &setter);
|
||||
|
||||
PropertyTable *table = NULL;
|
||||
ShapeTable *table = NULL;
|
||||
if (!inDictionaryMode()) {
|
||||
bool stableSlot =
|
||||
(slot == SHAPE_INVALID_SLOT) ||
|
||||
@ -899,7 +899,7 @@ JSObject::removeProperty(JSContext *cx, jsid id)
|
||||
* list and hash in place.
|
||||
*/
|
||||
if (self->inDictionaryMode()) {
|
||||
PropertyTable &table = self->lastProperty()->table();
|
||||
ShapeTable &table = self->lastProperty()->table();
|
||||
|
||||
if (SHAPE_HAD_COLLISION(*spp)) {
|
||||
*spp = SHAPE_REMOVED;
|
||||
@ -933,11 +933,11 @@ JSObject::removeProperty(JSContext *cx, jsid id)
|
||||
|
||||
/* Consider shrinking table if its load factor is <= .25. */
|
||||
uint32_t size = table.capacity();
|
||||
if (size > PropertyTable::MIN_SIZE && table.entryCount <= size >> 2)
|
||||
if (size > ShapeTable::MIN_SIZE && table.entryCount <= size >> 2)
|
||||
(void) table.change(-1, cx);
|
||||
} else {
|
||||
/*
|
||||
* Non-dictionary-mode property tables are shared immutables, so all we
|
||||
* Non-dictionary-mode shape tables are shared immutables, so all we
|
||||
* need do is retract the last property and we'll either get or else
|
||||
* lazily make via a later hashify the exact table for the new property
|
||||
* lineage.
|
||||
@ -1012,7 +1012,7 @@ JSObject::replaceWithNewEquivalentShape(JSContext *cx, Shape *oldShape, Shape *n
|
||||
new (newShape) Shape(oldShape->base()->unowned(), 0);
|
||||
}
|
||||
|
||||
PropertyTable &table = self->lastProperty()->table();
|
||||
ShapeTable &table = self->lastProperty()->table();
|
||||
Shape **spp = oldShape->isEmptyShape()
|
||||
? NULL
|
||||
: table.search(oldShape->propidRef(), false);
|
||||
|
@ -113,10 +113,10 @@
|
||||
* a linear search. But if the number of searches starting at any particular
|
||||
* Shape in the property tree exceeds MAX_LINEAR_SEARCHES and the Shape's
|
||||
* lineage has (excluding the EmptyShape) at least MIN_ENTRIES, we create an
|
||||
* auxiliary hash table -- the PropertyTable -- that allows faster lookup.
|
||||
* Furthermore, a PropertyTable is always created for dictionary mode lists,
|
||||
* and it is attached to the last Shape in the lineage. Property tables for
|
||||
* property tree Shapes never change, but property tables for dictionary mode
|
||||
* auxiliary hash table -- the ShapeTable -- that allows faster lookup.
|
||||
* Furthermore, a ShapeTable is always created for dictionary mode lists,
|
||||
* and it is attached to the last Shape in the lineage. Shape tables for
|
||||
* property tree Shapes never change, but shape tables for dictionary mode
|
||||
* Shapes can grow and shrink.
|
||||
*
|
||||
* There used to be a long, math-heavy comment here explaining why property
|
||||
@ -138,7 +138,7 @@ static const uint32_t SHAPE_MAXIMUM_SLOT = JS_BIT(24) - 2;
|
||||
* Shapes use multiplicative hashing, but specialized to
|
||||
* minimize footprint.
|
||||
*/
|
||||
struct PropertyTable {
|
||||
struct ShapeTable {
|
||||
static const uint32_t HASH_BITS = tl::BitSize<HashNumber>::result;
|
||||
static const uint32_t MIN_ENTRIES = 7;
|
||||
static const uint32_t MIN_SIZE_LOG2 = 4;
|
||||
@ -153,7 +153,7 @@ struct PropertyTable {
|
||||
object */
|
||||
js::Shape **entries; /* table of ptrs to shared tree nodes */
|
||||
|
||||
PropertyTable(uint32_t nentries)
|
||||
ShapeTable(uint32_t nentries)
|
||||
: hashShift(HASH_BITS - MIN_SIZE_LOG2),
|
||||
entryCount(nentries),
|
||||
removedCount(0),
|
||||
@ -162,7 +162,7 @@ struct PropertyTable {
|
||||
/* NB: entries is set by init, which must be called. */
|
||||
}
|
||||
|
||||
~PropertyTable() {
|
||||
~ShapeTable() {
|
||||
js::UnwantedForeground::free_(entries);
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ struct PropertyTable {
|
||||
static size_t sizeOfEntries(size_t cap) { return cap * sizeof(Shape *); }
|
||||
|
||||
/*
|
||||
* This counts the PropertyTable object itself (which must be
|
||||
* This counts the ShapeTable object itself (which must be
|
||||
* heap-allocated) and its |entries| array.
|
||||
*/
|
||||
size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const {
|
||||
@ -226,7 +226,7 @@ class PropertyTree;
|
||||
* whose entries are all owned by that dictionary. Unowned Shapes are all in
|
||||
* the property tree.
|
||||
*
|
||||
* Owned BaseShapes are used for shapes which have property tables, including
|
||||
* Owned BaseShapes are used for shapes which have shape tables, including
|
||||
* the last properties in all dictionaries. Unowned BaseShapes compactly store
|
||||
* information common to many shapes. In a given compartment there is a single
|
||||
* BaseShape for each combination of BaseShape information. This information
|
||||
@ -247,11 +247,11 @@ class PropertyTree;
|
||||
*
|
||||
* Unowned Shape, Owned BaseShape:
|
||||
*
|
||||
* Property in the property tree which has a property table.
|
||||
* Property in the property tree which has a shape table.
|
||||
*
|
||||
* Unowned Shape, Unowned BaseShape:
|
||||
*
|
||||
* Property in the property tree which does not have a property table.
|
||||
* Property in the property tree which does not have a shape table.
|
||||
*
|
||||
* BaseShapes additionally encode some information about the referring object
|
||||
* itself. This includes the object's class, parent and various flags that may
|
||||
@ -324,8 +324,8 @@ class BaseShape : public js::gc::Cell
|
||||
/* For owned BaseShapes, the canonical unowned BaseShape. */
|
||||
HeapPtr<UnownedBaseShape> unowned_;
|
||||
|
||||
/* For owned BaseShapes, the shape's property table. */
|
||||
PropertyTable *table_;
|
||||
/* For owned BaseShapes, the shape's shape table. */
|
||||
ShapeTable *table_;
|
||||
|
||||
public:
|
||||
void finalize(FreeOp *fop);
|
||||
@ -358,8 +358,8 @@ class BaseShape : public js::gc::Cell
|
||||
JSObject *setterObject() const { JS_ASSERT(hasSetterObject()); return setterObj; }
|
||||
|
||||
bool hasTable() const { JS_ASSERT_IF(table_, isOwned()); return table_ != NULL; }
|
||||
PropertyTable &table() const { JS_ASSERT(table_ && isOwned()); return *table_; }
|
||||
void setTable(PropertyTable *table) { JS_ASSERT(isOwned()); table_ = table; }
|
||||
ShapeTable &table() const { JS_ASSERT(table_ && isOwned()); return *table_; }
|
||||
void setTable(ShapeTable *table) { JS_ASSERT(isOwned()); table_ = table; }
|
||||
|
||||
uint32_t slotSpan() const { JS_ASSERT(isOwned()); return slotSpan_; }
|
||||
void setSlotSpan(uint32_t slotSpan) { JS_ASSERT(isOwned()); slotSpan_ = slotSpan; }
|
||||
@ -550,7 +550,7 @@ struct Shape : public js::gc::Cell
|
||||
|
||||
public:
|
||||
bool hasTable() const { return base()->hasTable(); }
|
||||
js::PropertyTable &table() const { return base()->table(); }
|
||||
js::ShapeTable &table() const { return base()->table(); }
|
||||
|
||||
void sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf,
|
||||
size_t *propTableSize, size_t *kidsSize) const {
|
||||
@ -852,13 +852,13 @@ struct Shape : public js::gc::Cell
|
||||
return count;
|
||||
}
|
||||
|
||||
bool isBigEnoughForAPropertyTable() const {
|
||||
bool isBigEnoughForAShapeTable() const {
|
||||
JS_ASSERT(!hasTable());
|
||||
const js::Shape *shape = this;
|
||||
uint32_t count = 0;
|
||||
for (js::Shape::Range r = shape->all(); !r.empty(); r.popFront()) {
|
||||
++count;
|
||||
if (count >= PropertyTable::MIN_ENTRIES)
|
||||
if (count >= ShapeTable::MIN_ENTRIES)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -1073,7 +1073,7 @@ Shape::search(JSContext *cx, Shape *start, jsid id, Shape ***pspp, bool adding)
|
||||
}
|
||||
|
||||
if (start->numLinearSearches() == LINEAR_SEARCHES_MAX) {
|
||||
if (start->isBigEnoughForAPropertyTable()) {
|
||||
if (start->isBigEnoughForAShapeTable()) {
|
||||
RootShape startRoot(cx, &start);
|
||||
RootId idRoot(cx, &id);
|
||||
if (start->hashify(cx)) {
|
||||
|
@ -176,7 +176,7 @@ BaseShape::adoptUnowned(UnownedBaseShape *other)
|
||||
JS_ASSERT((flags & other->getObjectFlags()) == flags);
|
||||
|
||||
uint32_t span = slotSpan();
|
||||
PropertyTable *table = &this->table();
|
||||
ShapeTable *table = &this->table();
|
||||
|
||||
*this = *other;
|
||||
setOwned(other);
|
||||
|
@ -170,7 +170,7 @@ js::ObjectImpl::checkShapeConsistency()
|
||||
if (inDictionaryMode()) {
|
||||
MOZ_ASSERT(shape->hasTable());
|
||||
|
||||
PropertyTable &table = shape->table();
|
||||
ShapeTable &table = shape->table();
|
||||
for (uint32_t fslot = table.freelist; fslot != SHAPE_INVALID_SLOT;
|
||||
fslot = getSlot(fslot).toPrivateUint32()) {
|
||||
MOZ_ASSERT(fslot < slotSpan());
|
||||
@ -197,7 +197,7 @@ js::ObjectImpl::checkShapeConsistency()
|
||||
} else {
|
||||
for (int n = throttle; --n >= 0 && shape->parent; shape = shape->parent) {
|
||||
if (shape->hasTable()) {
|
||||
PropertyTable &table = shape->table();
|
||||
ShapeTable &table = shape->table();
|
||||
MOZ_ASSERT(shape->parent);
|
||||
for (Shape::Range r(shape); !r.empty(); r.popFront()) {
|
||||
Shape **spp = table.search(r.front().propid(), false);
|
||||
|
Loading…
Reference in New Issue
Block a user