Bug 744052 - Restructure HashTable::checkOverflow for easier reading; r=luke

When I added this function, I just copied the existing logical structure.  It
makes more sense here to check overflowed and return early, since we can do this
now.
This commit is contained in:
Terrence Cole 2012-04-10 09:51:48 -07:00
parent 5ec5cf5d06
commit dfd9f312e5

View File

@ -619,21 +619,20 @@ class HashTable : private AllocPolicy
bool checkOverloaded()
{
if (overloaded()) {
/* Compress if a quarter or more of all entries are removed. */
int deltaLog2;
if (removedCount >= (capacity() >> 2)) {
METER(stats.compresses++);
deltaLog2 = 0;
} else {
METER(stats.grows++);
deltaLog2 = 1;
}
if (!overloaded())
return false;
return changeTableSize(deltaLog2);
/* Compress if a quarter or more of all entries are removed. */
int deltaLog2;
if (removedCount >= (capacity() >> 2)) {
METER(stats.compresses++);
deltaLog2 = 0;
} else {
METER(stats.grows++);
deltaLog2 = 1;
}
return false;
return changeTableSize(deltaLog2);
}
void remove(Entry &e)