mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 844932 - HashTable rekey fixup does not guarantee !overloaded; r=sfink
--HG-- extra : rebase_source : e9354d0d3377f75c56cee8a0b2d6078fa9d9fbdb
This commit is contained in:
parent
c839fd97fc
commit
1d56d4f28d
@ -815,8 +815,10 @@ class HashTable : private AllocPolicy
|
||||
|
||||
// Potentially rehashes the table.
|
||||
~Enum() {
|
||||
if (rekeyed)
|
||||
if (rekeyed) {
|
||||
table.gen++;
|
||||
table.checkOverRemoved();
|
||||
}
|
||||
|
||||
if (removed)
|
||||
table.compactIfUnderloaded();
|
||||
@ -1189,9 +1191,8 @@ class HashTable : private AllocPolicy
|
||||
void checkOverRemoved()
|
||||
{
|
||||
if (overloaded()) {
|
||||
METER(stats.rehashes++);
|
||||
rehashTable();
|
||||
JS_ASSERT(!overloaded());
|
||||
if (checkOverloaded() == RehashFailed)
|
||||
rehashTableInPlace();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1241,8 +1242,9 @@ class HashTable : private AllocPolicy
|
||||
// the element is already inserted or still waiting to be inserted. Since
|
||||
// already-inserted elements win any conflicts, we get the same table as we
|
||||
// would have gotten through random insertion order.
|
||||
void rehashTable()
|
||||
void rehashTableInPlace()
|
||||
{
|
||||
METER(stats.rehashes++);
|
||||
removedCount = 0;
|
||||
for (size_t i = 0; i < capacity(); ++i)
|
||||
table[i].unsetCollision();
|
||||
|
Loading…
Reference in New Issue
Block a user