Bug 1196848 - Add Zone::uniqueIds to about:memory reports; r=njn

This commit is contained in:
Terrence Cole 2015-08-26 14:51:43 -07:00
parent 24bdc50b8b
commit 32ab4ea833
5 changed files with 18 additions and 4 deletions

View File

@ -586,7 +586,8 @@ struct ZoneStats
macro(Other, GCHeapUsed, objectGroupsGCHeap) \
macro(Other, MallocHeap, objectGroupsMallocHeap) \
macro(Other, MallocHeap, typePool) \
macro(Other, MallocHeap, baselineStubsOptimized)
macro(Other, MallocHeap, baselineStubsOptimized) \
macro(Other, MallocHeap, uniqueIdMap)
ZoneStats()
: FOR_EACH_SIZE(ZERO_SIZE)

View File

@ -119,6 +119,11 @@ class UniqueIdMap
void remove(Cell* cell) {
map.remove(Pair(cell, 0));
}
size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const {
// All data allocated by |map| is contained in |alloc|.
return alloc.sizeOfExcludingThis(mallocSizeOf);
}
};
extern uint64_t NextCellUniqueId(JSRuntime* rt);
@ -183,7 +188,8 @@ struct Zone : public JS::shadow::Zone,
void addSizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf,
size_t* typePool,
size_t* baselineStubsOptimized);
size_t* baselineStubsOptimized,
size_t* uniqueIdMap);
void resetGCMallocBytes();
void setGCMaxMallocBytes(size_t value);

View File

@ -311,7 +311,8 @@ StatsZoneCallback(JSRuntime* rt, void* data, Zone* zone)
zone->addSizeOfIncludingThis(rtStats->mallocSizeOf_,
&zStats.typePool,
&zStats.baselineStubsOptimized);
&zStats.baselineStubsOptimized,
&zStats.uniqueIdMap);
}
static void

View File

@ -4276,13 +4276,15 @@ TypeScript::destroy()
void
Zone::addSizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf,
size_t* typePool,
size_t* baselineStubsOptimized)
size_t* baselineStubsOptimized,
size_t* uniqueIdMap)
{
*typePool += types.typeLifoAlloc.sizeOfExcludingThis(mallocSizeOf);
if (jitZone()) {
*baselineStubsOptimized +=
jitZone()->optimizedStubSpace()->sizeOfExcludingThis(mallocSizeOf);
}
*uniqueIdMap += uniqueIds_.sizeOfExcludingThis(mallocSizeOf);
}
TypeZone::TypeZone(Zone* zone)

View File

@ -1883,6 +1883,10 @@ ReportZoneStats(const JS::ZoneStats& zStats,
zStats.unusedGCThings.totalSize(),
"Unused GC thing cells within non-empty arenas.");
ZCREPORT_BYTES(pathPrefix + NS_LITERAL_CSTRING("unique-id-map"),
zStats.uniqueIdMap,
"Address-independent cell identities.");
ZCREPORT_GC_BYTES(pathPrefix + NS_LITERAL_CSTRING("lazy-scripts/gc-heap"),
zStats.lazyScriptsGCHeap,
"Scripts that haven't executed yet.");