зеркало из https://github.com/mozilla/gecko-dev.git
Bug 854051 - Remove HashTable::clearWithoutCallingDestructors; r=billm
--HG-- extra : rebase_source : 6ae023e1dc878f33e823d80c8cd0a91950159d94
This commit is contained in:
Родитель
7ca7a4cb72
Коммит
13df67cf01
|
@ -653,7 +653,6 @@ class HashTableEntry
|
||||||
bool isFree() const { return keyHash == sFreeKey; }
|
bool isFree() const { return keyHash == sFreeKey; }
|
||||||
void clearLive() { JS_ASSERT(isLive()); keyHash = sFreeKey; mem.addr()->~T(); }
|
void clearLive() { JS_ASSERT(isLive()); keyHash = sFreeKey; mem.addr()->~T(); }
|
||||||
void clear() { if (isLive()) mem.addr()->~T(); keyHash = sFreeKey; }
|
void clear() { if (isLive()) mem.addr()->~T(); keyHash = sFreeKey; }
|
||||||
void clearNoDtor() { keyHash = sFreeKey; }
|
|
||||||
bool isRemoved() const { return keyHash == sRemovedKey; }
|
bool isRemoved() const { return keyHash == sRemovedKey; }
|
||||||
void removeLive() { JS_ASSERT(isLive()); keyHash = sRemovedKey; mem.addr()->~T(); }
|
void removeLive() { JS_ASSERT(isLive()); keyHash = sRemovedKey; mem.addr()->~T(); }
|
||||||
bool isLive() const { return isLiveHash(keyHash); }
|
bool isLive() const { return isLiveHash(keyHash); }
|
||||||
|
@ -1299,20 +1298,6 @@ class HashTable : private AllocPolicy
|
||||||
mutationCount++;
|
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()
|
void finish()
|
||||||
{
|
{
|
||||||
JS_ASSERT(!entered);
|
JS_ASSERT(!entered);
|
||||||
|
|
|
@ -373,11 +373,6 @@ WeakMap_finalize(FreeOp *fop, RawObject obj)
|
||||||
{
|
{
|
||||||
if (ObjectValueMap *map = GetObjectMap(obj)) {
|
if (ObjectValueMap *map = GetObjectMap(obj)) {
|
||||||
map->check();
|
map->check();
|
||||||
/*
|
|
||||||
* The map may contain finalized entries, so drop them before destructing to avoid calling
|
|
||||||
* ~EncapsulatedPtr.
|
|
||||||
*/
|
|
||||||
map->clearWithoutCallingDestructors();
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
map->~ObjectValueMap();
|
map->~ObjectValueMap();
|
||||||
memset(static_cast<void *>(map), 0xdc, sizeof(*map));
|
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. */
|
/* This always happens in the GC thread, so no locking is required. */
|
||||||
JS_ASSERT(object->compartment()->rt->isHeapBusy());
|
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
|
* 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.
|
* 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;
|
DebugScopes *scopes = c->debugScopes;
|
||||||
if (scopes) {
|
if (scopes) {
|
||||||
if (c->rt->isHeapBusy()) {
|
scopes->proxiedScopes.clear();
|
||||||
scopes->proxiedScopes.clearWithoutCallingDestructors();
|
scopes->missingScopes.clear();
|
||||||
scopes->missingScopes.clearWithoutCallingDestructors();
|
scopes->liveScopes.clear();
|
||||||
scopes->liveScopes.clearWithoutCallingDestructors();
|
|
||||||
} else {
|
|
||||||
scopes->proxiedScopes.clear();
|
|
||||||
scopes->missingScopes.clear();
|
|
||||||
scopes->liveScopes.clear();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче