mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Modularize to avoid inline vs. not ShapeHasher static woes (595615, r=dbaron)
This commit is contained in:
parent
0366d26673
commit
7bcb596924
@ -438,6 +438,37 @@ PropertyTree::getChild(JSContext *cx, Shape *parent, const Shape &child)
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
void
|
||||
KidsPointer::checkConsistency(const Shape *aKid) const
|
||||
{
|
||||
if (isShape()) {
|
||||
JS_ASSERT(toShape() == aKid);
|
||||
} else if (isChunk()) {
|
||||
bool found = false;
|
||||
for (KidsChunk *chunk = toChunk(); chunk; chunk = chunk->next) {
|
||||
for (uintN i = 0; i < MAX_KIDS_PER_CHUNK; i++) {
|
||||
if (!chunk->kids[i]) {
|
||||
JS_ASSERT(!chunk->next);
|
||||
for (uintN j = i + 1; j < MAX_KIDS_PER_CHUNK; j++)
|
||||
JS_ASSERT(!chunk->kids[j]);
|
||||
break;
|
||||
}
|
||||
if (chunk->kids[i] == aKid) {
|
||||
JS_ASSERT(!found);
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
JS_ASSERT(found);
|
||||
} else {
|
||||
JS_ASSERT(isHash());
|
||||
KidsHash *hash = toHash();
|
||||
KidsHash::Ptr ptr = hash->lookup(aKid);
|
||||
JS_ASSERT(*ptr == aKid);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Shape::dump(JSContext *cx, FILE *fp) const
|
||||
{
|
||||
@ -495,9 +526,6 @@ Shape::dump(JSContext *cx, FILE *fp) const
|
||||
|
||||
fprintf(fp, "shortid %d\n", shortid);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
static void
|
||||
MeterKidCount(JSBasicStats *bs, uintN nkids)
|
||||
|
@ -63,8 +63,8 @@ struct ShapeHasher {
|
||||
typedef js::Shape *Key;
|
||||
typedef const js::Shape *Lookup;
|
||||
|
||||
static HashNumber hash(const Lookup l);
|
||||
static bool match(Key k, Lookup l);
|
||||
static inline HashNumber hash(const Lookup l);
|
||||
static inline bool match(Key k, Lookup l);
|
||||
};
|
||||
|
||||
typedef HashSet<js::Shape *, ShapeHasher, SystemAllocPolicy> KidsHash;
|
||||
@ -117,6 +117,10 @@ class KidsPointer {
|
||||
JS_ASSERT((reinterpret_cast<jsuword>(hash) & TAG) == 0);
|
||||
w = reinterpret_cast<jsuword>(hash) | HASH;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void checkConsistency(const js::Shape *aKid) const;
|
||||
#endif
|
||||
};
|
||||
|
||||
class PropertyTree
|
||||
|
@ -687,30 +687,7 @@ JSObject::checkShapeConsistency()
|
||||
}
|
||||
if (prev) {
|
||||
JS_ASSERT(prev->slotSpan >= shape->slotSpan);
|
||||
if (shape->kids.isShape()) {
|
||||
JS_ASSERT(shape->kids.toShape() == prev);
|
||||
} else if (shape->kids.isChunk()) {
|
||||
bool found = false;
|
||||
for (KidsChunk *chunk = shape->kids.toChunk(); chunk; chunk = chunk->next) {
|
||||
for (uintN i = 0; i < MAX_KIDS_PER_CHUNK; i++) {
|
||||
if (!chunk->kids[i]) {
|
||||
JS_ASSERT(!chunk->next);
|
||||
for (uintN j = i + 1; j < MAX_KIDS_PER_CHUNK; j++)
|
||||
JS_ASSERT(!chunk->kids[j]);
|
||||
JS_ASSERT(found);
|
||||
}
|
||||
if (chunk->kids[i] == prev) {
|
||||
JS_ASSERT(!found);
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
JS_ASSERT(shape->kids.isHash());
|
||||
KidsHash *hash = shape->kids.toHash();
|
||||
KidsHash::Ptr ptr = hash->lookup(prev);
|
||||
JS_ASSERT(*ptr == prev);
|
||||
}
|
||||
shape->kids.checkConsistency(prev);
|
||||
}
|
||||
prev = shape;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user