Bug 854051 - Remove HashTable::clearWithoutCallingDestructors; r=billm

--HG--
extra : rebase_source : 6ae023e1dc878f33e823d80c8cd0a91950159d94
This commit is contained in:
Terrence Cole 2013-03-25 11:48:26 -07:00
Родитель 7ca7a4cb72
Коммит 13df67cf01
4 изменённых файлов: 3 добавлений и 37 удалений

Просмотреть файл

@ -653,7 +653,6 @@ class HashTableEntry
bool isFree() const { return keyHash == sFreeKey; }
void clearLive() { JS_ASSERT(isLive()); keyHash = sFreeKey; mem.addr()->~T(); }
void clear() { if (isLive()) mem.addr()->~T(); keyHash = sFreeKey; }
void clearNoDtor() { keyHash = sFreeKey; }
bool isRemoved() const { return keyHash == sRemovedKey; }
void removeLive() { JS_ASSERT(isLive()); keyHash = sRemovedKey; mem.addr()->~T(); }
bool isLive() const { return isLiveHash(keyHash); }
@ -1299,20 +1298,6 @@ class HashTable : private AllocPolicy
mutationCount++;
}
void clearWithoutCallingDestructors()
{
if (mozilla::IsPod<Entry>::value) {
memset(table, 0, sizeof(*table) * capacity());
} else {
uint32_t tableCapacity = capacity();
for (Entry *e = table, *end = table + tableCapacity; e < end; ++e)
e->clearNoDtor();
}
removedCount = 0;
entryCount = 0;
mutationCount++;
}
void finish()
{
JS_ASSERT(!entered);

Просмотреть файл

@ -373,11 +373,6 @@ WeakMap_finalize(FreeOp *fop, RawObject obj)
{
if (ObjectValueMap *map = GetObjectMap(obj)) {
map->check();
/*
* The map may contain finalized entries, so drop them before destructing to avoid calling
* ~EncapsulatedPtr.
*/
map->clearWithoutCallingDestructors();
#ifdef DEBUG
map->~ObjectValueMap();
memset(static_cast<void *>(map), 0xdc, sizeof(*map));

Просмотреть файл

@ -379,14 +379,6 @@ Debugger::~Debugger()
/* This always happens in the GC thread, so no locking is required. */
JS_ASSERT(object->compartment()->rt->isHeapBusy());
/*
* These maps may contain finalized entries, so drop them before destructing to avoid calling
* ~EncapsulatedPtr.
*/
scripts.clearWithoutCallingDestructors();
objects.clearWithoutCallingDestructors();
environments.clearWithoutCallingDestructors();
/*
* Since the inactive state for this link is a singleton cycle, it's always
* safe to apply JS_REMOVE_LINK to it, regardless of whether we're in the list or not.

Просмотреть файл

@ -1891,15 +1891,9 @@ DebugScopes::onCompartmentLeaveDebugMode(JSCompartment *c)
{
DebugScopes *scopes = c->debugScopes;
if (scopes) {
if (c->rt->isHeapBusy()) {
scopes->proxiedScopes.clearWithoutCallingDestructors();
scopes->missingScopes.clearWithoutCallingDestructors();
scopes->liveScopes.clearWithoutCallingDestructors();
} else {
scopes->proxiedScopes.clear();
scopes->missingScopes.clear();
scopes->liveScopes.clear();
}
scopes->proxiedScopes.clear();
scopes->missingScopes.clear();
scopes->liveScopes.clear();
}
}