Bug 805915 (part 5) - Add more detail to shape memory reports. r=luke.
authorNicholas Nethercote <nnethercote@mozilla.com>
Mon, 29 Oct 2012 08:51:21 +1100
changeset 111642 7d95543f47506a5975dfb42cedb1ff20cb51ce91
parent 111641 b23881c4de78e3e751fc932139789420c74c03da
child 111643 9e606320e6a54b57a1dfa50d23429cf6d4c87fa7
push id17174
push usernnethercote@mozilla.com
push dateMon, 29 Oct 2012 00:17:39 +0000
treeherdermozilla-inbound@7d95543f4750 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs805915
milestone19.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 805915 (part 5) - Add more detail to shape memory reports. r=luke.
js/public/MemoryMetrics.h
js/src/jsmemorymetrics.cpp
js/xpconnect/src/XPCJSRuntime.cpp
--- a/js/public/MemoryMetrics.h
+++ b/js/public/MemoryMetrics.h
@@ -131,17 +131,18 @@ struct CompartmentStats
       , gcHeapUnusedGcThings(0)
       , gcHeapObjectsOrdinary(0)
       , gcHeapObjectsFunction(0)
       , gcHeapObjectsDenseArray(0)
       , gcHeapObjectsSlowArray(0)
       , gcHeapObjectsCrossCompartmentWrapper(0)
       , gcHeapStringsNormal(0)
       , gcHeapStringsShort(0)
-      , gcHeapShapesTree(0)
+      , gcHeapShapesTreeGlobalParented(0)
+      , gcHeapShapesTreeNonGlobalParented(0)
       , gcHeapShapesDict(0)
       , gcHeapShapesBase(0)
       , gcHeapScripts(0)
       , gcHeapTypeObjects(0)
       , gcHeapIonCodes(0)
 #if JS_HAS_XML_SUPPORT
       , gcHeapXML(0)
 #endif
@@ -170,17 +171,18 @@ struct CompartmentStats
       , gcHeapUnusedGcThings(other.gcHeapUnusedGcThings)
       , gcHeapObjectsOrdinary(other.gcHeapObjectsOrdinary)
       , gcHeapObjectsFunction(other.gcHeapObjectsFunction)
       , gcHeapObjectsDenseArray(other.gcHeapObjectsDenseArray)
       , gcHeapObjectsSlowArray(other.gcHeapObjectsSlowArray)
       , gcHeapObjectsCrossCompartmentWrapper(other.gcHeapObjectsCrossCompartmentWrapper)
       , gcHeapStringsNormal(other.gcHeapStringsNormal)
       , gcHeapStringsShort(other.gcHeapStringsShort)
-      , gcHeapShapesTree(other.gcHeapShapesTree)
+      , gcHeapShapesTreeGlobalParented(other.gcHeapShapesTreeGlobalParented)
+      , gcHeapShapesTreeNonGlobalParented(other.gcHeapShapesTreeNonGlobalParented)
       , gcHeapShapesDict(other.gcHeapShapesDict)
       , gcHeapShapesBase(other.gcHeapShapesBase)
       , gcHeapScripts(other.gcHeapScripts)
       , gcHeapTypeObjects(other.gcHeapTypeObjects)
       , gcHeapIonCodes(other.gcHeapIonCodes)
 #if JS_HAS_XML_SUPPORT
       , gcHeapXML(other.gcHeapXML)
 #endif
@@ -216,17 +218,18 @@ struct CompartmentStats
 
     size_t gcHeapObjectsOrdinary;
     size_t gcHeapObjectsFunction;
     size_t gcHeapObjectsDenseArray;
     size_t gcHeapObjectsSlowArray;
     size_t gcHeapObjectsCrossCompartmentWrapper;
     size_t gcHeapStringsNormal;
     size_t gcHeapStringsShort;
-    size_t gcHeapShapesTree;
+    size_t gcHeapShapesTreeGlobalParented;
+    size_t gcHeapShapesTreeNonGlobalParented;
     size_t gcHeapShapesDict;
     size_t gcHeapShapesBase;
     size_t gcHeapScripts;
     size_t gcHeapTypeObjects;
     size_t gcHeapIonCodes;
 #if JS_HAS_XML_SUPPORT
     size_t gcHeapXML;
 #endif
@@ -261,17 +264,18 @@ struct CompartmentStats
 
         ADD(gcHeapObjectsOrdinary);
         ADD(gcHeapObjectsFunction);
         ADD(gcHeapObjectsDenseArray);
         ADD(gcHeapObjectsSlowArray);
         ADD(gcHeapObjectsCrossCompartmentWrapper);
         ADD(gcHeapStringsNormal);
         ADD(gcHeapStringsShort);
-        ADD(gcHeapShapesTree);
+        ADD(gcHeapShapesTreeGlobalParented);
+        ADD(gcHeapShapesTreeNonGlobalParented);
         ADD(gcHeapShapesDict);
         ADD(gcHeapShapesBase);
         ADD(gcHeapScripts);
         ADD(gcHeapTypeObjects);
         ADD(gcHeapIonCodes);
     #if JS_HAS_XML_SUPPORT
         ADD(gcHeapXML);
     #endif
--- a/js/src/jsmemorymetrics.cpp
+++ b/js/src/jsmemorymetrics.cpp
@@ -56,17 +56,18 @@ CompartmentStats::gcHeapThingsSize()
     size_t n = 0;
     n += gcHeapObjectsOrdinary;
     n += gcHeapObjectsFunction;
     n += gcHeapObjectsDenseArray;
     n += gcHeapObjectsSlowArray;
     n += gcHeapObjectsCrossCompartmentWrapper;
     n += gcHeapStringsNormal;
     n += gcHeapStringsShort;
-    n += gcHeapShapesTree;
+    n += gcHeapShapesTreeGlobalParented;
+    n += gcHeapShapesTreeNonGlobalParented;
     n += gcHeapShapesDict;
     n += gcHeapShapesBase;
     n += gcHeapScripts;
     n += gcHeapTypeObjects;
     n += gcHeapIonCodes;
 #if JS_HAS_XML_SUPPORT
     n += gcHeapXML;
 #endif
@@ -199,17 +200,21 @@ StatsCellCallback(JSRuntime *rt, void *d
         Shape *shape = static_cast<Shape*>(thing);
         size_t propTableSize, kidsSize;
         shape->sizeOfExcludingThis(rtStats->mallocSizeOf, &propTableSize, &kidsSize);
         if (shape->inDictionary()) {
             cStats->gcHeapShapesDict += thingSize;
             cStats->shapesExtraDictTables += propTableSize;
             JS_ASSERT(kidsSize == 0);
         } else {
-            cStats->gcHeapShapesTree += thingSize;
+            if (shape->base()->getObjectParent() == shape->compartment()->maybeGlobal()) {
+                cStats->gcHeapShapesTreeGlobalParented += thingSize;
+            } else {
+                cStats->gcHeapShapesTreeNonGlobalParented += thingSize;
+            }
             cStats->shapesExtraTreeTables += propTableSize;
             cStats->shapesExtraTreeShapeKids += kidsSize;
         }
         break;
     }
     case JSTRACE_BASE_SHAPE:
     {
         cStats->gcHeapShapesBase += thingSize;
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -1514,20 +1514,27 @@ ReportCompartmentStats(const JS::Compart
 
     CREPORT_GC_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("gc-heap/scripts"),
                      cStats.gcHeapScripts,
                      "Memory on the garbage-collected JavaScript "
                      "heap that holds JSScript instances. A JSScript is "
                      "created for each user-defined function in a script. One "
                      "is also created for the top-level code in a script.");
 
-    CREPORT_GC_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("gc-heap/shapes/tree"),
-                     cStats.gcHeapShapesTree,
-                     "Memory on the garbage-collected JavaScript "
-                     "heap that holds shapes that are in a property tree.");
+    CREPORT_GC_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("gc-heap/shapes/tree/global-parented"),
+                     cStats.gcHeapShapesTreeGlobalParented,
+                     "Memory on the garbage-collected JavaScript heap that "
+                     "holds shapes that (a) are in a property tree, and (b) "
+                     "represent an object whose parent is the global object.");
+
+    CREPORT_GC_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("gc-heap/shapes/tree/non-global-parented"),
+                     cStats.gcHeapShapesTreeNonGlobalParented,
+                     "Memory on the garbage-collected JavaScript heap that "
+                     "holds shapes that (a) are in a property tree, and (b) "
+                     "represent an object whose parent is not the global object.");
 
     CREPORT_GC_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("gc-heap/shapes/dict"),
                      cStats.gcHeapShapesDict,
                      "Memory on the garbage-collected JavaScript "
                      "heap that holds shapes that are in dictionary mode.");
 
     CREPORT_GC_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("gc-heap/shapes/base"),
                      cStats.gcHeapShapesBase,