Bug 755581 (part 5) - Add "cross-compartment-wrappers" reporter. r=luke.
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 15 May 2012 19:31:01 -0700
changeset 94194 747124aac893ffeac20d6256c487d96bf030b0eb
parent 94193 bf84a728f4ed503eb0b8f0fb64b6d66c1a2aaf6a
child 94195 bc49f6d612979d992fb247d8cb6afb3b7fe8b383
push id9505
push usernnethercote@mozilla.com
push dateThu, 17 May 2012 01:08:58 +0000
treeherdermozilla-inbound@747124aac893 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs755581
milestone15.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 755581 (part 5) - Add "cross-compartment-wrappers" reporter. r=luke.
js/public/MemoryMetrics.h
js/src/MemoryMetrics.cpp
js/xpconnect/src/XPCJSRuntime.cpp
--- a/js/public/MemoryMetrics.h
+++ b/js/public/MemoryMetrics.h
@@ -130,16 +130,17 @@ struct CompartmentStats
     size_t objectMisc;
     size_t stringChars;
     size_t shapesExtraTreeTables;
     size_t shapesExtraDictTables;
     size_t shapesExtraTreeShapeKids;
     size_t shapesCompartmentTables;
     size_t scriptData;
     size_t mjitData;
+    size_t crossCompartmentWrappers;
 
     TypeInferenceSizes typeInferenceSizes;
 };
 
 struct RuntimeStats
 {
     RuntimeStats(JSMallocSizeOfFun mallocSizeOf)
       : runtime()
--- a/js/src/MemoryMetrics.cpp
+++ b/js/src/MemoryMetrics.cpp
@@ -64,16 +64,18 @@ StatsCompartmentCallback(JSRuntime *rt, 
     MOZ_ALWAYS_TRUE(rtStats->compartmentStatsVector.growBy(1));
     CompartmentStats &cStats = rtStats->compartmentStatsVector.back();
     rtStats->initExtraCompartmentStats(compartment, &cStats);
     rtStats->currCompartmentStats = &cStats;
 
     // Get the compartment-level numbers.
     compartment->sizeOfTypeInferenceData(&cStats.typeInferenceSizes, rtStats->mallocSizeOf);
     cStats.shapesCompartmentTables = compartment->sizeOfShapeTable(rtStats->mallocSizeOf);
+    cStats.crossCompartmentWrappers =
+        compartment->crossCompartmentWrappers.sizeOfExcludingThis(rtStats->mallocSizeOf);
 }
 
 static void
 StatsChunkCallback(JSRuntime *rt, void *data, gc::Chunk *chunk)
 {
     // Nb: This function is only called for dirty chunks, which is why we
     // increment gcHeapChunkDirtyDecommitted.
     RuntimeStats *rtStats = static_cast<RuntimeStats *>(data);
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -1482,16 +1482,21 @@ ReportCompartmentStats(const JS::Compart
                   "variable-length tables.");
 
     REPORT_BYTES0(MakePath(pathPrefix, cStats, "mjit-data"),
                   nsIMemoryReporter::KIND_HEAP, cStats.mjitData,
                   "Memory used by the method JIT for the compartment's "
                   "compilation data: JITScripts, native maps, and inline "
                   "cache structs.");
 
+    REPORT_BYTES0(MakePath(pathPrefix, cStats, "cross-compartment-wrappers"),
+                  nsIMemoryReporter::KIND_HEAP, cStats.crossCompartmentWrappers,
+                  "Memory used by the compartment's cross-compartment "
+                  "wrappers.");
+
     REPORT_BYTES0(MakePath(pathPrefix, cStats, "type-inference/script-main"),
                   nsIMemoryReporter::KIND_HEAP,
                   cStats.typeInferenceSizes.scripts,
                   "Memory used during type inference to store type sets of "
                   "variables and dynamically observed types.");
 
     REPORT_BYTES0(MakePath(pathPrefix, cStats, "type-inference/object-main"),
                   nsIMemoryReporter::KIND_HEAP,