diff --git a/js/public/MemoryMetrics.h b/js/public/MemoryMetrics.h index 54faf160f40a..67566d6a31cf 100644 --- a/js/public/MemoryMetrics.h +++ b/js/public/MemoryMetrics.h @@ -123,6 +123,7 @@ struct ObjectsExtraSizes macro(Objects, NotLiveGCThing, mallocHeapElementsNonAsmJS) \ macro(Objects, NotLiveGCThing, mallocHeapElementsAsmJS) \ macro(Objects, NotLiveGCThing, nonHeapElementsAsmJS) \ + macro(Objects, NotLiveGCThing, nonHeapElementsMapped) \ macro(Objects, NotLiveGCThing, nonHeapCodeAsmJS) \ macro(Objects, NotLiveGCThing, mallocHeapAsmJSModuleData) \ macro(Objects, NotLiveGCThing, mallocHeapArgumentsData) \ diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index 24a5b2629c78..00ac52a1fb41 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -5908,6 +5908,8 @@ JSObject::addSizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf, JS::Objects #else sizes->mallocHeapElementsAsmJS += mallocSizeOf(elements); #endif + } else if (MOZ_UNLIKELY(elements->isMappedArrayBuffer())) { + sizes->nonHeapElementsMapped += as().byteLength(); } else { sizes->mallocHeapElementsNonAsmJS += mallocSizeOf(elements); } diff --git a/js/xpconnect/src/XPCJSRuntime.cpp b/js/xpconnect/src/XPCJSRuntime.cpp index 845c6bcade39..6b8c708eda69 100644 --- a/js/xpconnect/src/XPCJSRuntime.cpp +++ b/js/xpconnect/src/XPCJSRuntime.cpp @@ -2139,6 +2139,12 @@ ReportCompartmentStats(const JS::CompartmentStats &cStats, "the GC heap."); } + if (cStats.objectsExtra.nonHeapElementsMapped > 0) { + REPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("objects/non-heap/elements/mapped"), + KIND_NONHEAP, cStats.objectsExtra.nonHeapElementsMapped, + "Memory-mapped array buffer elements."); + } + REPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("objects/non-heap/code/asm.js"), KIND_NONHEAP, cStats.objectsExtra.nonHeapCodeAsmJS, "AOT-compiled asm.js code.");