From 14ad857e167fc7fa1324d2620197ce5833d7b1b9 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 15 May 2012 19:31:01 -0700 Subject: [PATCH] Bug 755581 (part 5) - Add "cross-compartment-wrappers" reporter. r=luke. --HG-- extra : rebase_source : 1dfb5eb522008acd59f6bce5e1724af1dc0da9f0 --- js/public/MemoryMetrics.h | 1 + js/src/MemoryMetrics.cpp | 2 ++ js/xpconnect/src/XPCJSRuntime.cpp | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/js/public/MemoryMetrics.h b/js/public/MemoryMetrics.h index 49cabaa2028..81172f3747e 100644 --- a/js/public/MemoryMetrics.h +++ b/js/public/MemoryMetrics.h @@ -135,6 +135,7 @@ struct CompartmentStats size_t shapesCompartmentTables; size_t scriptData; size_t mjitData; + size_t crossCompartmentWrappers; TypeInferenceSizes typeInferenceSizes; }; diff --git a/js/src/MemoryMetrics.cpp b/js/src/MemoryMetrics.cpp index 95207d327b3..46e0d990a73 100644 --- a/js/src/MemoryMetrics.cpp +++ b/js/src/MemoryMetrics.cpp @@ -69,6 +69,8 @@ StatsCompartmentCallback(JSRuntime *rt, void *data, JSCompartment *compartment) // 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 diff --git a/js/xpconnect/src/XPCJSRuntime.cpp b/js/xpconnect/src/XPCJSRuntime.cpp index ec7c3acba6c..351b18f93de 100644 --- a/js/xpconnect/src/XPCJSRuntime.cpp +++ b/js/xpconnect/src/XPCJSRuntime.cpp @@ -1487,6 +1487,11 @@ ReportCompartmentStats(const JS::CompartmentStats &cStats, "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,