зеркало из https://github.com/mozilla/gecko-dev.git
Bug 697931 - Remove KidHashes when possible. r=luke.
This commit is contained in:
Родитель
6ec5c499b1
Коммит
9e7657a444
|
@ -645,12 +645,16 @@ class HashTable : private AllocPolicy
|
|||
return entryCount;
|
||||
}
|
||||
|
||||
uint32 capacity() const {
|
||||
return tableCapacity;
|
||||
}
|
||||
|
||||
uint32 generation() const {
|
||||
return gen;
|
||||
}
|
||||
|
||||
/*
|
||||
* This counts the HashTable's |table| array. If |countMe| is true is also
|
||||
* This counts the HashTable's |table| array. If |countMe| is true it also
|
||||
* counts the HashTable object itself.
|
||||
*/
|
||||
size_t sizeOf(JSUsableSizeFun usf, bool countMe) const {
|
||||
|
@ -1087,6 +1091,7 @@ class HashMap
|
|||
typedef typename Impl::Range Range;
|
||||
Range all() const { return impl.all(); }
|
||||
size_t count() const { return impl.count(); }
|
||||
size_t capacity() const { return impl.capacity(); }
|
||||
size_t sizeOf(JSUsableSizeFun usf, bool cm) const { return impl.sizeOf(usf, cm); }
|
||||
|
||||
/*
|
||||
|
@ -1289,6 +1294,7 @@ class HashSet
|
|||
typedef typename Impl::Range Range;
|
||||
Range all() const { return impl.all(); }
|
||||
size_t count() const { return impl.count(); }
|
||||
size_t capacity() const { return impl.capacity(); }
|
||||
size_t sizeOf(JSUsableSizeFun usf, bool cm) const { return impl.sizeOf(usf, cm); }
|
||||
|
||||
/*
|
||||
|
|
|
@ -139,13 +139,24 @@ Shape::removeChild(Shape *child)
|
|||
JS_ASSERT(!JSID_IS_VOID(propid));
|
||||
|
||||
KidsPointer *kidp = &kids;
|
||||
|
||||
if (kidp->isShape()) {
|
||||
JS_ASSERT(kidp->toShape() == child);
|
||||
kids.setNull();
|
||||
kidp->setNull();
|
||||
return;
|
||||
}
|
||||
|
||||
kidp->toHash()->remove(child);
|
||||
KidsHash *hash = kidp->toHash();
|
||||
JS_ASSERT(hash->count() >= 2); /* otherwise kidp->isShape() should be true */
|
||||
hash->remove(child);
|
||||
if (hash->count() == 1) {
|
||||
/* Convert from HASH form back to SHAPE form. */
|
||||
KidsHash::Range r = hash->all();
|
||||
Shape *otherChild = r.front();
|
||||
JS_ASSERT((r.popFront(), r.empty())); /* No more elements! */
|
||||
kidp->setShape(otherChild);
|
||||
js::UnwantedForeground::delete_(hash);
|
||||
}
|
||||
}
|
||||
|
||||
Shape *
|
||||
|
|
|
@ -647,7 +647,6 @@ struct Shape : public js::gc::Cell
|
|||
|
||||
void finalize(JSContext *cx);
|
||||
void removeChild(js::Shape *child);
|
||||
void removeChildSlowly(js::Shape *child);
|
||||
};
|
||||
|
||||
struct EmptyShape : public js::Shape
|
||||
|
|
Загрузка…
Ссылка в новой задаче