Bug 1448563 - Part 5: Add memory reporting for Ion offthread. r=jandem
authorTed Campbell <tcampbell@mozilla.com>
Wed, 11 Apr 2018 15:02:33 -0400
changeset 415139 aad3967f2c7bab02bf5ecbda1ef15af08aadbbfa
parent 415138 d873c3d7b7bfebb7fb4590ce0e9010e606c69ef9
child 415140 97dbd15798f96a95021bc0a66c9b1dfc22414025
push id33889
push useraciure@mozilla.com
push dateTue, 24 Apr 2018 01:14:50 +0000
treeherdermozilla-central@b35a1f66c452 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1448563
milestone61.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 1448563 - Part 5: Add memory reporting for Ion offthread. r=jandem MozReview-Commit-ID: KnuaP5HwNnm
js/public/MemoryMetrics.h
js/src/vm/HelperThreads.cpp
js/xpconnect/src/XPCJSRuntime.cpp
--- a/js/public/MemoryMetrics.h
+++ b/js/public/MemoryMetrics.h
@@ -503,17 +503,18 @@ struct NotableScriptSourceInfo : public 
   private:
     NotableScriptSourceInfo(const NotableScriptSourceInfo& info) = delete;
 };
 
 struct HelperThreadStats
 {
 #define FOR_EACH_SIZE(macro) \
     macro(_, MallocHeap, stateData) \
-    macro(_, MallocHeap, parseTask)
+    macro(_, MallocHeap, parseTask) \
+    macro(_, MallocHeap, ionBuilder)
 
     explicit HelperThreadStats()
       : FOR_EACH_SIZE(ZERO_SIZE)
         idleThreadCount(0),
         activeThreadCount(0)
     { }
 
     FOR_EACH_SIZE(DECL_SIZE)
--- a/js/src/vm/HelperThreads.cpp
+++ b/js/src/vm/HelperThreads.cpp
@@ -1163,16 +1163,24 @@ GlobalHelperThreadState::addSizeOfInclud
     // Report ParseTasks on wait lists
     for (auto task : parseWorklist_)
         htStats.parseTask += task->sizeOfIncludingThis(mallocSizeOf);
     for (auto task : parseFinishedList_)
         htStats.parseTask += task->sizeOfIncludingThis(mallocSizeOf);
     for (auto task : parseWaitingOnGC_)
         htStats.parseTask += task->sizeOfIncludingThis(mallocSizeOf);
 
+    // Report IonBuilders on wait lists
+    for (auto builder : ionWorklist_)
+        htStats.ionBuilder += builder->sizeOfIncludingThis(mallocSizeOf);
+    for (auto builder : ionFinishedList_)
+        htStats.ionBuilder += builder->sizeOfIncludingThis(mallocSizeOf);
+    for (auto builder : ionFreeList_)
+        htStats.ionBuilder += builder->sizeOfIncludingThis(mallocSizeOf);
+
     // Report number of helper threads.
     MOZ_ASSERT(htStats.idleThreadCount == 0);
     if (threads) {
         for (auto& thread : *threads) {
             if (thread.idle())
                 htStats.idleThreadCount++;
             else
                 htStats.activeThreadCount++;
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -2490,16 +2490,20 @@ JSReporter::CollectReports(WindowPaths* 
 
     REPORT_BYTES(NS_LITERAL_CSTRING("explicit/js-non-window/helper-thread/heap-other"),
         KIND_HEAP, gStats.helperThread.stateData,
         "Memory used by HelperThreadState.");
 
     REPORT_BYTES(NS_LITERAL_CSTRING("explicit/js-non-window/helper-thread/parse-task"),
         KIND_HEAP, gStats.helperThread.parseTask,
         "The memory used by ParseTasks waiting in HelperThreadState.");
+
+    REPORT_BYTES(NS_LITERAL_CSTRING("explicit/js-non-window/helper-thread/ion-builder"),
+        KIND_HEAP, gStats.helperThread.ionBuilder,
+        "The memory used by IonBuilders waiting in HelperThreadState.");
 }
 
 static nsresult
 JSSizeOfTab(JSObject* objArg, size_t* jsObjectsSize, size_t* jsStringsSize,
             size_t* jsPrivateSize, size_t* jsOtherSize)
 {
     JSContext* cx = XPCJSContext::Get()->Context();
     JS::RootedObject obj(cx, objArg);