mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1043605 - Fix up DEBUG/JS_DEBUG confusion in HashTable.h. r=jwalden.
--HG-- extra : rebase_source : ae56e815766be675083596e177844e2365e93906
This commit is contained in:
parent
77af944fa8
commit
ca88efe960
@ -11,7 +11,6 @@
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Casting.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/Move.h"
|
||||
#include "mozilla/NullPtr.h"
|
||||
@ -762,7 +761,7 @@ class HashTable : private AllocPolicy
|
||||
void nonNull() {}
|
||||
|
||||
Entry *entry_;
|
||||
#ifdef DEBUG
|
||||
#ifdef JS_DEBUG
|
||||
const HashTable *table_;
|
||||
uint32_t generation;
|
||||
#endif
|
||||
@ -770,7 +769,7 @@ class HashTable : private AllocPolicy
|
||||
protected:
|
||||
Ptr(Entry &entry, const HashTable &tableArg)
|
||||
: entry_(&entry)
|
||||
#ifdef DEBUG
|
||||
#ifdef JS_DEBUG
|
||||
, table_(&tableArg)
|
||||
, generation(tableArg.generation())
|
||||
#endif
|
||||
@ -785,7 +784,9 @@ class HashTable : private AllocPolicy
|
||||
}
|
||||
|
||||
bool found() const {
|
||||
#ifdef JS_DEBUG
|
||||
MOZ_ASSERT(generation == table_->generation());
|
||||
#endif
|
||||
return entry_->isLive();
|
||||
}
|
||||
|
||||
@ -799,17 +800,23 @@ class HashTable : private AllocPolicy
|
||||
}
|
||||
|
||||
bool operator!=(const Ptr &rhs) const {
|
||||
#ifdef JS_DEBUG
|
||||
MOZ_ASSERT(generation == table_->generation());
|
||||
#endif
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
T &operator*() const {
|
||||
#ifdef JS_DEBUG
|
||||
MOZ_ASSERT(generation == table_->generation());
|
||||
#endif
|
||||
return entry_->get();
|
||||
}
|
||||
|
||||
T *operator->() const {
|
||||
#ifdef JS_DEBUG
|
||||
MOZ_ASSERT(generation == table_->generation());
|
||||
#endif
|
||||
return &entry_->get();
|
||||
}
|
||||
};
|
||||
@ -819,14 +826,14 @@ class HashTable : private AllocPolicy
|
||||
{
|
||||
friend class HashTable;
|
||||
HashNumber keyHash;
|
||||
#ifdef DEBUG
|
||||
#ifdef JS_DEBUG
|
||||
uint64_t mutationCount;
|
||||
#endif
|
||||
|
||||
AddPtr(Entry &entry, const HashTable &tableArg, HashNumber hn)
|
||||
: Ptr(entry, tableArg)
|
||||
, keyHash(hn)
|
||||
#ifdef DEBUG
|
||||
#ifdef JS_DEBUG
|
||||
, mutationCount(tableArg.mutationCount)
|
||||
#endif
|
||||
{}
|
||||
@ -848,7 +855,7 @@ class HashTable : private AllocPolicy
|
||||
Range(const HashTable &tableArg, Entry *c, Entry *e)
|
||||
: cur(c)
|
||||
, end(e)
|
||||
#ifdef DEBUG
|
||||
#ifdef JS_DEBUG
|
||||
, table_(&tableArg)
|
||||
, mutationCount(tableArg.mutationCount)
|
||||
, generation(tableArg.generation())
|
||||
@ -860,7 +867,7 @@ class HashTable : private AllocPolicy
|
||||
}
|
||||
|
||||
Entry *cur, *end;
|
||||
#ifdef DEBUG
|
||||
#ifdef JS_DEBUG
|
||||
const HashTable *table_;
|
||||
uint64_t mutationCount;
|
||||
uint32_t generation;
|
||||
@ -871,7 +878,7 @@ class HashTable : private AllocPolicy
|
||||
Range()
|
||||
: cur(nullptr)
|
||||
, end(nullptr)
|
||||
#ifdef DEBUG
|
||||
#ifdef JS_DEBUG
|
||||
, table_(nullptr)
|
||||
, mutationCount(0)
|
||||
, generation(0)
|
||||
@ -880,26 +887,32 @@ class HashTable : private AllocPolicy
|
||||
{}
|
||||
|
||||
bool empty() const {
|
||||
#ifdef JS_DEBUG
|
||||
MOZ_ASSERT(generation == table_->generation());
|
||||
MOZ_ASSERT(mutationCount == table_->mutationCount);
|
||||
#endif
|
||||
return cur == end;
|
||||
}
|
||||
|
||||
T &front() const {
|
||||
MOZ_ASSERT(validEntry);
|
||||
MOZ_ASSERT(!empty());
|
||||
#ifdef JS_DEBUG
|
||||
MOZ_ASSERT(validEntry);
|
||||
MOZ_ASSERT(generation == table_->generation());
|
||||
MOZ_ASSERT(mutationCount == table_->mutationCount);
|
||||
#endif
|
||||
return cur->get();
|
||||
}
|
||||
|
||||
void popFront() {
|
||||
MOZ_ASSERT(!empty());
|
||||
#ifdef JS_DEBUG
|
||||
MOZ_ASSERT(generation == table_->generation());
|
||||
MOZ_ASSERT(mutationCount == table_->mutationCount);
|
||||
#endif
|
||||
while (++cur < end && !cur->isLive())
|
||||
continue;
|
||||
#ifdef DEBUG
|
||||
#ifdef JS_DEBUG
|
||||
validEntry = true;
|
||||
#endif
|
||||
}
|
||||
@ -936,7 +949,7 @@ class HashTable : private AllocPolicy
|
||||
void removeFront() {
|
||||
table_.remove(*this->cur);
|
||||
removed = true;
|
||||
#ifdef DEBUG
|
||||
#ifdef JS_DEBUG
|
||||
this->validEntry = false;
|
||||
this->mutationCount = table_.mutationCount;
|
||||
#endif
|
||||
@ -949,7 +962,7 @@ class HashTable : private AllocPolicy
|
||||
Ptr p(*this->cur, table_);
|
||||
table_.rekeyWithoutRehash(p, l, k);
|
||||
rekeyed = true;
|
||||
#ifdef DEBUG
|
||||
#ifdef JS_DEBUG
|
||||
this->validEntry = false;
|
||||
this->mutationCount = table_.mutationCount;
|
||||
#endif
|
||||
@ -1002,8 +1015,8 @@ class HashTable : private AllocPolicy
|
||||
uint32_t hashShift:8; // multiplicative hash shift
|
||||
|
||||
#ifdef JS_DEBUG
|
||||
mozilla::DebugOnly<uint64_t> mutationCount;
|
||||
mutable mozilla::DebugOnly<bool> mEntered;
|
||||
uint64_t mutationCount;
|
||||
mutable bool mEntered;
|
||||
mutable struct Stats
|
||||
{
|
||||
uint32_t searches; // total number of table searches
|
||||
@ -1085,7 +1098,7 @@ class HashTable : private AllocPolicy
|
||||
, entryCount(0)
|
||||
, removedCount(0)
|
||||
, hashShift(sHashBits)
|
||||
#ifdef DEBUG
|
||||
#ifdef JS_DEBUG
|
||||
, mutationCount(0)
|
||||
, mEntered(false)
|
||||
#endif
|
||||
@ -1375,7 +1388,7 @@ class HashTable : private AllocPolicy
|
||||
e.clearLive();
|
||||
}
|
||||
entryCount--;
|
||||
#ifdef DEBUG
|
||||
#ifdef JS_DEBUG
|
||||
mutationCount++;
|
||||
#endif
|
||||
}
|
||||
@ -1460,15 +1473,16 @@ class HashTable : private AllocPolicy
|
||||
}
|
||||
removedCount = 0;
|
||||
entryCount = 0;
|
||||
#ifdef DEBUG
|
||||
#ifdef JS_DEBUG
|
||||
mutationCount++;
|
||||
#endif
|
||||
}
|
||||
|
||||
void finish()
|
||||
{
|
||||
#ifdef JS_DEBUG
|
||||
MOZ_ASSERT(!mEntered);
|
||||
|
||||
#endif
|
||||
if (!table)
|
||||
return;
|
||||
|
||||
@ -1477,7 +1491,7 @@ class HashTable : private AllocPolicy
|
||||
gen++;
|
||||
entryCount = 0;
|
||||
removedCount = 0;
|
||||
#ifdef DEBUG
|
||||
#ifdef JS_DEBUG
|
||||
mutationCount++;
|
||||
#endif
|
||||
}
|
||||
@ -1569,7 +1583,7 @@ class HashTable : private AllocPolicy
|
||||
|
||||
p.entry_->setLive(p.keyHash, mozilla::Forward<U>(u));
|
||||
entryCount++;
|
||||
#ifdef DEBUG
|
||||
#ifdef JS_DEBUG
|
||||
mutationCount++;
|
||||
p.generation = generation();
|
||||
p.mutationCount = mutationCount;
|
||||
@ -1595,7 +1609,7 @@ class HashTable : private AllocPolicy
|
||||
|
||||
entry->setLive(keyHash, mozilla::Forward<U>(u));
|
||||
entryCount++;
|
||||
#ifdef DEBUG
|
||||
#ifdef JS_DEBUG
|
||||
mutationCount++;
|
||||
#endif
|
||||
}
|
||||
@ -1617,7 +1631,7 @@ class HashTable : private AllocPolicy
|
||||
template <class U>
|
||||
bool relookupOrAdd(AddPtr& p, const Lookup &l, U &&u)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
#ifdef JS_DEBUG
|
||||
p.generation = generation();
|
||||
p.mutationCount = mutationCount;
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user