diff --git a/js/public/MemoryMetrics.h b/js/public/MemoryMetrics.h index 28ac3145704d..1bc4949e1c99 100644 --- a/js/public/MemoryMetrics.h +++ b/js/public/MemoryMetrics.h @@ -73,15 +73,15 @@ struct ZoneStatsPod { #define FOR_EACH_SIZE(macro) \ macro(NotLiveGCThing, gcHeapArenaAdmin) \ - macro(NotLiveGCThing, gcHeapUnusedGcThings) \ - macro(IsLiveGCThing, gcHeapStringsNormal) \ - macro(IsLiveGCThing, gcHeapStringsShort) \ - macro(IsLiveGCThing, gcHeapLazyScripts) \ - macro(IsLiveGCThing, gcHeapTypeObjects) \ - macro(IsLiveGCThing, gcHeapIonCodes) \ - macro(NotLiveGCThing, stringCharsNonNotable) \ - macro(NotLiveGCThing, lazyScripts) \ - macro(NotLiveGCThing, typeObjects) \ + macro(NotLiveGCThing, unusedGCThings) \ + macro(IsLiveGCThing, stringsNormalGCHeap) \ + macro(IsLiveGCThing, stringsShortGCHeap) \ + macro(IsLiveGCThing, lazyScriptsGCHeap) \ + macro(IsLiveGCThing, typeObjectsGCHeap) \ + macro(IsLiveGCThing, ionCodesGCHeap) \ + macro(NotLiveGCThing, stringsNormalMallocHeap) \ + macro(NotLiveGCThing, lazyScriptsMallocHeap) \ + macro(NotLiveGCThing, typeObjectsMallocHeap) \ macro(NotLiveGCThing, typePool) ZoneStatsPod() @@ -206,40 +206,39 @@ struct CodeSizes struct StringInfo { StringInfo() - : length(0), numCopies(0), sizeOfShortStringGCThings(0), - sizeOfNormalStringGCThings(0), sizeOfAllStringChars(0) + : length(0), numCopies(0), shortGCHeap(0), normalGCHeap(0), normalMallocHeap(0) {} StringInfo(size_t len, size_t shorts, size_t normals, size_t chars) : length(len), numCopies(1), - sizeOfShortStringGCThings(shorts), - sizeOfNormalStringGCThings(normals), - sizeOfAllStringChars(chars) + shortGCHeap(shorts), + normalGCHeap(normals), + normalMallocHeap(chars) {} void add(size_t shorts, size_t normals, size_t chars) { - sizeOfShortStringGCThings += shorts; - sizeOfNormalStringGCThings += normals; - sizeOfAllStringChars += chars; + shortGCHeap += shorts; + normalGCHeap += normals; + normalMallocHeap += chars; numCopies++; } void add(const StringInfo& info) { MOZ_ASSERT(length == info.length); - sizeOfShortStringGCThings += info.sizeOfShortStringGCThings; - sizeOfNormalStringGCThings += info.sizeOfNormalStringGCThings; - sizeOfAllStringChars += info.sizeOfAllStringChars; + shortGCHeap += info.shortGCHeap; + normalGCHeap += info.normalGCHeap; + normalMallocHeap += info.normalMallocHeap; numCopies += info.numCopies; } size_t totalSizeOf() const { - return sizeOfShortStringGCThings + sizeOfNormalStringGCThings + sizeOfAllStringChars; + return shortGCHeap + normalGCHeap + normalMallocHeap; } - size_t totalGCThingSizeOf() const { - return sizeOfShortStringGCThings + sizeOfNormalStringGCThings; + size_t totalGCHeapSizeOf() const { + return shortGCHeap + normalGCHeap; } // The string's length, excluding the null-terminator. @@ -249,9 +248,9 @@ struct StringInfo size_t numCopies; // These are all totals across all copies of the string we've seen. - size_t sizeOfShortStringGCThings; - size_t sizeOfNormalStringGCThings; - size_t sizeOfAllStringChars; + size_t shortGCHeap; + size_t normalGCHeap; + size_t normalMallocHeap; }; // Holds data about a notable string (one which uses more than @@ -452,10 +451,10 @@ struct RuntimeStats // - unused bytes // - rtStats.gcHeapUnusedChunks (empty chunks) // - rtStats.gcHeapUnusedArenas (empty arenas within non-empty chunks) - // - rtStats.total.gcHeapUnusedGcThings (empty GC thing slots within non-empty arenas) + // - rtStats.zTotals.unusedGCThings (empty GC thing slots within non-empty arenas) // - used bytes // - rtStats.gcHeapChunkAdmin - // - rtStats.total.gcHeapArenaAdmin + // - rtStats.zTotals.gcHeapArenaAdmin // - rtStats.gcHeapGcThings (in-use GC things) // // It's possible that some arenas in empty chunks may be decommitted, but diff --git a/js/src/vm/MemoryMetrics.cpp b/js/src/vm/MemoryMetrics.cpp index 3eec19bdf0d5..5f4a9062f904 100644 --- a/js/src/vm/MemoryMetrics.cpp +++ b/js/src/vm/MemoryMetrics.cpp @@ -235,7 +235,7 @@ StatsArenaCallback(JSRuntime *rt, void *data, gc::Arena *arena, // unused space like this: arenaUnused = maxArenaUnused - arenaUsed. // We do this by setting arenaUnused to maxArenaUnused here, and then // subtracting thingSize for every used cell, in StatsCellCallback(). - rtStats->currZoneStats->gcHeapUnusedGcThings += allocationSpace; + rtStats->currZoneStats->unusedGCThings += allocationSpace; } static CompartmentStats * @@ -297,9 +297,9 @@ StatsCellCallback(JSRuntime *rt, void *data, void *thing, JSGCTraceKind traceKin p->value.add(shortStringThingSize, normalStringThingSize, strCharsSize); } - zStats->gcHeapStringsShort += shortStringThingSize; - zStats->gcHeapStringsNormal += normalStringThingSize; - zStats->stringCharsNonNotable += strCharsSize; + zStats->stringsShortGCHeap += shortStringThingSize; + zStats->stringsNormalGCHeap += normalStringThingSize; + zStats->stringsNormalMallocHeap += strCharsSize; break; } @@ -357,14 +357,14 @@ StatsCellCallback(JSRuntime *rt, void *data, void *thing, JSGCTraceKind traceKin case JSTRACE_LAZY_SCRIPT: { LazyScript *lazy = static_cast(thing); - zStats->gcHeapLazyScripts += thingSize; - zStats->lazyScripts += lazy->sizeOfExcludingThis(rtStats->mallocSizeOf_); + zStats->lazyScriptsGCHeap += thingSize; + zStats->lazyScriptsMallocHeap += lazy->sizeOfExcludingThis(rtStats->mallocSizeOf_); break; } case JSTRACE_IONCODE: { #ifdef JS_ION - zStats->gcHeapIonCodes += thingSize; + zStats->ionCodesGCHeap += thingSize; // The code for a script is counted in ExecutableAllocator::sizeOfCode(). #endif break; @@ -372,15 +372,15 @@ StatsCellCallback(JSRuntime *rt, void *data, void *thing, JSGCTraceKind traceKin case JSTRACE_TYPE_OBJECT: { types::TypeObject *obj = static_cast(thing); - zStats->gcHeapTypeObjects += thingSize; - zStats->typeObjects += obj->sizeOfExcludingThis(rtStats->mallocSizeOf_); + zStats->typeObjectsGCHeap += thingSize; + zStats->typeObjectsMallocHeap += obj->sizeOfExcludingThis(rtStats->mallocSizeOf_); break; } } // Yes, this is a subtraction: see StatsArenaCallback() for details. - zStats->gcHeapUnusedGcThings -= thingSize; + zStats->unusedGCThings -= thingSize; } static void @@ -408,12 +408,12 @@ FindNotableStrings(ZoneStats &zStats) // We're moving this string from a non-notable to a notable bucket, so // subtract it out of the non-notable tallies. - MOZ_ASSERT(zStats.gcHeapStringsShort >= info.sizeOfShortStringGCThings); - MOZ_ASSERT(zStats.gcHeapStringsNormal >= info.sizeOfNormalStringGCThings); - MOZ_ASSERT(zStats.stringCharsNonNotable >= info.sizeOfAllStringChars); - zStats.gcHeapStringsShort -= info.sizeOfShortStringGCThings; - zStats.gcHeapStringsNormal -= info.sizeOfNormalStringGCThings; - zStats.stringCharsNonNotable -= info.sizeOfAllStringChars; + MOZ_ASSERT(zStats.stringsShortGCHeap >= info.shortGCHeap); + MOZ_ASSERT(zStats.stringsNormalGCHeap >= info.normalGCHeap); + MOZ_ASSERT(zStats.stringsNormalMallocHeap >= info.normalMallocHeap); + zStats.stringsShortGCHeap -= info.shortGCHeap; + zStats.stringsNormalGCHeap -= info.normalGCHeap; + zStats.stringsNormalMallocHeap -= info.normalMallocHeap; } // zStats.strings holds unrooted JSString pointers, which we don't want to @@ -459,7 +459,7 @@ JS::CollectRuntimeStats(JSRuntime *rt, RuntimeStats *rtStats, ObjectPrivateVisit rtStats->zTotals.add(zStats); rtStats->gcHeapGcThings += zStats.sizeOfLiveGCThings(); #ifdef DEBUG - totalArenaSize += zStats.gcHeapArenaAdmin + zStats.gcHeapUnusedGcThings; + totalArenaSize += zStats.gcHeapArenaAdmin + zStats.unusedGCThings; #endif // Move any strings which take up more than the sundries threshold @@ -496,7 +496,7 @@ JS::CollectRuntimeStats(JSRuntime *rt, RuntimeStats *rtStats, ObjectPrivateVisit rtStats->gcHeapUnusedArenas = rtStats->gcHeapChunkTotal - rtStats->gcHeapDecommittedArenas - rtStats->gcHeapUnusedChunks - - rtStats->zTotals.gcHeapUnusedGcThings - + rtStats->zTotals.unusedGCThings - rtStats->gcHeapChunkAdmin - rtStats->zTotals.gcHeapArenaAdmin - rtStats->gcHeapGcThings; diff --git a/js/xpconnect/src/XPCJSRuntime.cpp b/js/xpconnect/src/XPCJSRuntime.cpp index fe49d3565735..0925159e248e 100644 --- a/js/xpconnect/src/XPCJSRuntime.cpp +++ b/js/xpconnect/src/XPCJSRuntime.cpp @@ -1752,34 +1752,34 @@ ReportZoneStats(const JS::ZoneStats &zStats, "align GC things."); ZCREPORT_GC_BYTES(pathPrefix + NS_LITERAL_CSTRING("unused-gc-things"), - zStats.gcHeapUnusedGcThings, + zStats.unusedGCThings, "Memory on the garbage-collected JavaScript " "heap taken by empty GC thing slots within non-empty " "arenas."); ZCREPORT_GC_BYTES(pathPrefix + NS_LITERAL_CSTRING("lazy-scripts/gc-heap"), - zStats.gcHeapLazyScripts, + zStats.lazyScriptsGCHeap, "Memory on the garbage-collected JavaScript " "heap that represents scripts which haven't executed yet."); ZCREPORT_GC_BYTES(pathPrefix + NS_LITERAL_CSTRING("type-objects/gc-heap"), - zStats.gcHeapTypeObjects, + zStats.typeObjectsGCHeap, "Memory on the garbage-collected JavaScript " "heap that holds type inference information."); - ZCREPORT_GC_BYTES(pathPrefix + NS_LITERAL_CSTRING("ion-codes/gc-heap"), - zStats.gcHeapIonCodes, + ZCREPORT_GC_BYTES(pathPrefix + NS_LITERAL_CSTRING("ion-codes-gc-heap"), + zStats.ionCodesGCHeap, "Memory on the garbage-collected JavaScript " "heap that holds references to executable code pools " "used by the IonMonkey JIT."); ZCREPORT_BYTES(pathPrefix + NS_LITERAL_CSTRING("lazy-scripts/malloc-heap"), - zStats.lazyScripts, + zStats.lazyScriptsMallocHeap, "Memory holding miscellaneous additional information associated with lazy " "scripts. This memory is allocated on the malloc heap."); - ZCREPORT_BYTES(pathPrefix + NS_LITERAL_CSTRING("type-objects"), - zStats.typeObjects, + ZCREPORT_BYTES(pathPrefix + NS_LITERAL_CSTRING("type-objects/malloc-heap"), + zStats.typeObjectsMallocHeap, "Memory holding miscellaneous additional information associated with type " "objects."); @@ -1787,8 +1787,8 @@ ReportZoneStats(const JS::ZoneStats &zStats, zStats.typePool, "Memory holding contents of type sets and related data."); - size_t gcHeapStringsAboutMemory = 0; - size_t stringCharsAboutMemory = 0; + size_t stringsNotableAboutMemoryGCHeap = 0; + size_t stringsNotableAboutMemoryMallocHeap = 0; for (size_t i = 0; i < zStats.notableStrings.length(); i++) { const JS::NotableStringInfo& info = zStats.notableStrings[i]; @@ -1805,8 +1805,8 @@ ReportZoneStats(const JS::ZoneStats &zStats, // bucket. # define STRING_LENGTH "string(length=" if (FindInReadable(NS_LITERAL_CSTRING(STRING_LENGTH), notableString)) { - gcHeapStringsAboutMemory += info.totalGCThingSizeOf(); - stringCharsAboutMemory += info.sizeOfAllStringChars; + stringsNotableAboutMemoryGCHeap += info.totalGCHeapSizeOf(); + stringsNotableAboutMemoryMallocHeap += info.normalMallocHeap; continue; } @@ -1825,7 +1825,7 @@ ReportZoneStats(const JS::ZoneStats &zStats, REPORT_BYTES2(path + NS_LITERAL_CSTRING("gc-heap"), KIND_NONHEAP, - info.totalGCThingSizeOf(), + info.totalGCHeapSizeOf(), nsPrintfCString("Memory allocated to hold headers for copies of " "the given notable string. A string is notable if all of its copies " "together use more than %d bytes total of JS GC heap and malloc heap " @@ -1834,12 +1834,12 @@ ReportZoneStats(const JS::ZoneStats &zStats, "is short enough. If so, the string won't have any memory reported " "under 'string-chars'.", JS::NotableStringInfo::notableSize())); - gcTotal += info.totalGCThingSizeOf(); + gcTotal += info.totalGCHeapSizeOf(); - if (info.sizeOfAllStringChars > 0) { + if (info.normalMallocHeap > 0) { REPORT_BYTES2(path + NS_LITERAL_CSTRING("malloc-heap"), KIND_HEAP, - info.sizeOfAllStringChars, + info.normalMallocHeap, nsPrintfCString("Memory allocated on the malloc heap to hold " "string data for copies of the given notable string. A string is " "notable if all of its copies together use more than %d bytes " @@ -1848,15 +1848,15 @@ ReportZoneStats(const JS::ZoneStats &zStats, } } - ZCREPORT_GC_BYTES(pathPrefix + NS_LITERAL_CSTRING("strings/short/gc-heap"), - zStats.gcHeapStringsShort, + ZCREPORT_GC_BYTES(pathPrefix + NS_LITERAL_CSTRING("strings/short-gc-heap"), + zStats.stringsShortGCHeap, "Memory on the garbage-collected JavaScript " "heap that holds headers for strings which are short " "enough to be stored completely within the header. That " "is, a 'short' string uses no string-chars."); ZCREPORT_GC_BYTES(pathPrefix + NS_LITERAL_CSTRING("strings/normal/gc-heap"), - zStats.gcHeapStringsNormal, + zStats.stringsNormalGCHeap, "Memory on the garbage-collected JavaScript " "heap that holds string headers for strings which are too " "long to fit entirely within the header. The character " @@ -1864,15 +1864,15 @@ ReportZoneStats(const JS::ZoneStats &zStats, "strings/normal/malloc-heap."); ZCREPORT_BYTES(pathPrefix + NS_LITERAL_CSTRING("strings/normal/malloc-heap"), - zStats.stringCharsNonNotable, + zStats.stringsNormalMallocHeap, "Memory allocated to hold characters for strings which are too long " "to fit entirely within their string headers.\n\n" "Sometimes more memory is allocated than necessary, to " "simplify string concatenation."); - if (gcHeapStringsAboutMemory > 0) { + if (stringsNotableAboutMemoryGCHeap > 0) { ZCREPORT_GC_BYTES(pathPrefix + NS_LITERAL_CSTRING("strings/notable/about-memory/gc-heap"), - gcHeapStringsAboutMemory, + stringsNotableAboutMemoryGCHeap, "Memory allocated on the garbage-collected JavaScript " "heap that holds headers for notable strings which " "contain the string '" STRING_LENGTH "'. These " @@ -1882,10 +1882,10 @@ ReportZoneStats(const JS::ZoneStats &zStats, "time you refresh about:memory."); } - if (stringCharsAboutMemory > 0) { + if (stringsNotableAboutMemoryMallocHeap > 0) { ZCREPORT_BYTES(pathPrefix + NS_LITERAL_CSTRING("strings/notable/about-memory/malloc-heap"), - stringCharsAboutMemory, + stringsNotableAboutMemoryMallocHeap, "Memory allocated to hold characters of notable strings " "which contain the string '" STRING_LENGTH "'. These " "strings are likely from about:memory itself. We filter " @@ -2637,8 +2637,8 @@ JSReporter::CollectReports(WindowPaths *windowPaths, REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-committed/unused/gc-things"), KIND_OTHER, - rtStats.zTotals.gcHeapUnusedGcThings, - "The same as 'js-main-runtime/compartments/gc-heap/unused-gc-things'."); + rtStats.zTotals.unusedGCThings, + "The same as 'js-main-runtime/zones/unused-gc-things'."); REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-committed/used/chunk-admin"), KIND_OTHER, @@ -2648,7 +2648,7 @@ JSReporter::CollectReports(WindowPaths *windowPaths, REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-committed/used/arena-admin"), KIND_OTHER, rtStats.zTotals.gcHeapArenaAdmin, - "The same as 'js-main-runtime/compartments/gc-heap/arena-admin'."); + "The same as 'js-main-runtime/zones/gc-heap-arena-admin'."); REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-committed/used/gc-things"), KIND_OTHER,