Bug 1643170, part 2 - Report memory for HelperThreads::helperContexts_. r=jandem

This is 41600 bytes of unreported memory in each process.

Differential Revision: https://phabricator.services.mozilla.com/D78813
This commit is contained in:
Andrew McCreight 2020-06-09 09:07:07 +00:00
Родитель bef3096a56
Коммит 8eb502fd67
3 изменённых файлов: 20 добавлений и 2 удалений

Просмотреть файл

@ -452,7 +452,8 @@ struct HelperThreadStats {
MACRO(_, MallocHeap, stateData) \
MACRO(_, MallocHeap, parseTask) \
MACRO(_, MallocHeap, ionCompileTask) \
MACRO(_, MallocHeap, wasmCompile)
MACRO(_, MallocHeap, wasmCompile) \
MACRO(_, MallocHeap, contexts)
HelperThreadStats() = default;

Просмотреть файл

@ -1428,7 +1428,8 @@ void GlobalHelperThreadState::addSizeOfIncludingThis(
compressionPendingList_.sizeOfExcludingThis(mallocSizeOf) +
compressionWorklist_.sizeOfExcludingThis(mallocSizeOf) +
compressionFinishedList_.sizeOfExcludingThis(mallocSizeOf) +
gcParallelWorklist_.sizeOfExcludingThis(mallocSizeOf);
gcParallelWorklist_.sizeOfExcludingThis(mallocSizeOf) +
helperContexts_.sizeOfExcludingThis(mallocSizeOf);
// Report ParseTasks on wait lists
for (auto task : parseWorklist_) {
@ -1460,6 +1461,17 @@ void GlobalHelperThreadState::addSizeOfIncludingThis(
htStats.wasmCompile += task->sizeOfExcludingThis(mallocSizeOf);
}
{
// Report memory used by the JSContexts.
// We're holding the helper state lock, and the JSContext memory reporter
// won't do anything more substantial than traversing data structures and
// getting their size, so disable ProtectedData checks.
AutoNoteSingleThreadedRegion anstr;
for (auto* cx : helperContexts_) {
htStats.contexts += cx->sizeOfIncludingThis(mallocSizeOf);
}
}
// Report number of helper threads.
MOZ_ASSERT(htStats.idleThreadCount == 0);
if (threads) {

Просмотреть файл

@ -2555,6 +2555,11 @@ void JSReporter::CollectReports(WindowPaths* windowPaths,
NS_LITERAL_CSTRING("explicit/js-non-window/helper-thread/wasm-compile"),
KIND_HEAP, gStats.helperThread.wasmCompile,
"The memory used by Wasm compilations waiting in HelperThreadState.");
REPORT_BYTES(
NS_LITERAL_CSTRING("explicit/js-non-window/helper-thread/contexts"),
KIND_HEAP, gStats.helperThread.contexts,
"The memory used by the JSContexts in HelperThreadState.");
}
static nsresult JSSizeOfTab(JSObject* objArg, size_t* jsObjectsSize,