Bug 1448563 - Part 6: Add memory reporting for off-thread WASM. r=luke

MozReview-Commit-ID: 1lXRj1JUJk2
This commit is contained in:
Ted Campbell 2018-04-11 15:49:36 -04:00
Родитель ce0c6eb300
Коммит 7baaa3f753
5 изменённых файлов: 48 добавлений и 1 удалений

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

@ -509,7 +509,8 @@ struct HelperThreadStats
#define FOR_EACH_SIZE(macro) \
macro(_, MallocHeap, stateData) \
macro(_, MallocHeap, parseTask) \
macro(_, MallocHeap, ionBuilder)
macro(_, MallocHeap, ionBuilder) \
macro(_, MallocHeap, wasmCompile)
explicit HelperThreadStats()
: FOR_EACH_SIZE(ZERO_SIZE)

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

@ -23,6 +23,7 @@
#include "vm/Time.h"
#include "vm/TraceLogging.h"
#include "vm/Xdr.h"
#include "wasm/WasmGenerator.h"
#include "gc/PrivateIterators-inl.h"
#include "vm/JSCompartment-inl.h"
@ -1176,6 +1177,12 @@ GlobalHelperThreadState::addSizeOfIncludingThis(JS::GlobalStats* stats,
for (auto builder : ionFreeList_)
htStats.ionBuilder += builder->sizeOfIncludingThis(mallocSizeOf);
// Report wasm::CompileTasks on wait lists
for (auto task : wasmWorklist_tier1_)
htStats.wasmCompile += task->sizeOfIncludingThis(mallocSizeOf);
for (auto task : wasmWorklist_tier2_)
htStats.wasmCompile += task->sizeOfIncludingThis(mallocSizeOf);
// Report number of helper threads.
MOZ_ASSERT(htStats.idleThreadCount == 0);
if (threads) {

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

@ -1025,3 +1025,28 @@ ModuleGenerator::finishTier2(Module& module)
return module.finishTier2(Move(linkDataTier_), Move(tier2), env_);
}
size_t
CompiledCode::sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const
{
size_t trapSitesSize = 0;
for (const TrapSiteVector& vec : trapSites)
trapSitesSize += vec.sizeOfExcludingThis(mallocSizeOf);
return bytes.sizeOfExcludingThis(mallocSizeOf) +
codeRanges.sizeOfExcludingThis(mallocSizeOf) +
callSites.sizeOfExcludingThis(mallocSizeOf) +
callSiteTargets.sizeOfExcludingThis(mallocSizeOf) +
trapSitesSize +
callFarJumps.sizeOfExcludingThis(mallocSizeOf) +
symbolicAccesses.sizeOfExcludingThis(mallocSizeOf) +
codeLabels.sizeOfExcludingThis(mallocSizeOf);
}
size_t
CompileTask::sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const
{
return lifo.sizeOfExcludingThis(mallocSizeOf) +
inputs.sizeOfExcludingThis(mallocSizeOf) +
output.sizeOfExcludingThis(mallocSizeOf);
}

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

@ -19,6 +19,8 @@
#ifndef wasm_generator_h
#define wasm_generator_h
#include "mozilla/MemoryReporting.h"
#include "jit/MacroAssembler.h"
#include "wasm/WasmCompile.h"
#include "wasm/WasmModule.h"
@ -93,6 +95,8 @@ struct CompiledCode
symbolicAccesses.empty() &&
codeLabels.empty();
}
size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
};
// The CompileTaskState of a ModuleGenerator contains the mutable state shared
@ -128,6 +132,12 @@ struct CompileTask
state(state),
lifo(defaultChunkSize)
{}
size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const
{
return mallocSizeOf(this) + sizeOfExcludingThis(mallocSizeOf);
}
};
// A ModuleGenerator encapsulates the creation of a wasm module. During the

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

@ -2499,6 +2499,10 @@ JSReporter::CollectReports(WindowPaths* windowPaths,
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.");
REPORT_BYTES(NS_LITERAL_CSTRING("explicit/js-non-window/helper-thread/wasm-compile"),
KIND_HEAP, gStats.helperThread.parseTask,
"The memory used by Wasm compilations waiting in HelperThreadState.");
}
static nsresult