зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1202526 (part 8) - Use PLDHashTable::RemoveEntry() in the cycle collector. r=mccr8.
This avoids repeating the hash table search in order to remove a CC graph entry, which is good because it's a common operation.
This commit is contained in:
Родитель
957b39e8ff
Коммит
ffb1fefc9f
|
@ -868,9 +868,10 @@ public:
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
PtrToNodeEntry* FindNodeEntry(void* aPtr);
|
||||||
PtrInfo* FindNode(void* aPtr);
|
PtrInfo* FindNode(void* aPtr);
|
||||||
PtrToNodeEntry* AddNodeToMap(void* aPtr);
|
PtrToNodeEntry* AddNodeToMap(void* aPtr);
|
||||||
void RemoveNodeFromMap(void* aPtr);
|
void RemoveNodeFromMap(PtrToNodeEntry* aPtr);
|
||||||
|
|
||||||
uint32_t MapCount() const
|
uint32_t MapCount() const
|
||||||
{
|
{
|
||||||
|
@ -894,11 +895,17 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
PtrToNodeEntry*
|
||||||
|
CCGraph::FindNodeEntry(void* aPtr)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
static_cast<PtrToNodeEntry*>(PL_DHashTableSearch(&mPtrToNodeMap, aPtr));
|
||||||
|
}
|
||||||
|
|
||||||
PtrInfo*
|
PtrInfo*
|
||||||
CCGraph::FindNode(void* aPtr)
|
CCGraph::FindNode(void* aPtr)
|
||||||
{
|
{
|
||||||
PtrToNodeEntry* e =
|
PtrToNodeEntry* e = FindNodeEntry(aPtr);
|
||||||
static_cast<PtrToNodeEntry*>(PL_DHashTableSearch(&mPtrToNodeMap, aPtr));
|
|
||||||
return e ? e->mNode : nullptr;
|
return e ? e->mNode : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -921,9 +928,9 @@ CCGraph::AddNodeToMap(void* aPtr)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CCGraph::RemoveNodeFromMap(void* aPtr)
|
CCGraph::RemoveNodeFromMap(PtrToNodeEntry* aEntry)
|
||||||
{
|
{
|
||||||
PL_DHashTableRemove(&mPtrToNodeMap, aPtr);
|
mPtrToNodeMap.RemoveEntry(aEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3838,8 +3845,10 @@ nsCycleCollector::RemoveObjectFromGraph(void* aObj)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PtrInfo* pinfo = mGraph.FindNode(aObj)) {
|
PtrToNodeEntry* e = mGraph.FindNodeEntry(aObj);
|
||||||
mGraph.RemoveNodeFromMap(aObj);
|
PtrInfo* pinfo = e ? e->mNode : nullptr;
|
||||||
|
if (pinfo) {
|
||||||
|
mGraph.RemoveNodeFromMap(e);
|
||||||
|
|
||||||
pinfo->mPointer = nullptr;
|
pinfo->mPointer = nullptr;
|
||||||
pinfo->mParticipant = nullptr;
|
pinfo->mParticipant = nullptr;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче