зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1437978 - Add memory reporting for scriptCountsMap. r=nbp
MozReview-Commit-ID: 1AJHhJDJerr --HG-- extra : rebase_source : f867bd00f1c41052fc6eadc23cd2dd1e41a2c354
This commit is contained in:
Родитель
61019396c7
Коммит
df1f7c00c3
|
@ -776,7 +776,8 @@ struct CompartmentStats
|
|||
macro(Other, MallocHeap, nonSyntacticLexicalScopesTable) \
|
||||
macro(Other, MallocHeap, templateLiteralMap) \
|
||||
macro(Other, MallocHeap, jitCompartment) \
|
||||
macro(Other, MallocHeap, privateData)
|
||||
macro(Other, MallocHeap, privateData) \
|
||||
macro(Other, MallocHeap, scriptCountsMap)
|
||||
|
||||
CompartmentStats()
|
||||
: FOR_EACH_SIZE(ZERO_SIZE)
|
||||
|
|
|
@ -683,6 +683,11 @@ struct IonBlockCounts
|
|||
const char* code() const {
|
||||
return code_;
|
||||
}
|
||||
|
||||
size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const {
|
||||
return mallocSizeOf(description_) + mallocSizeOf(successors_) +
|
||||
mallocSizeOf(code_);
|
||||
}
|
||||
};
|
||||
|
||||
// Execution information for a compiled script which may persist after the
|
||||
|
@ -743,6 +748,25 @@ struct IonScriptCounts
|
|||
IonScriptCounts* previous() const {
|
||||
return previous_;
|
||||
}
|
||||
|
||||
size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const {
|
||||
size_t size = 0;
|
||||
auto currCounts = this;
|
||||
while (currCounts) {
|
||||
const IonScriptCounts* currCount = currCounts;
|
||||
currCounts = currCount->previous_;
|
||||
size += currCount->sizeOfOneIncludingThis(mallocSizeOf);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
size_t sizeOfOneIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const {
|
||||
size_t size = mallocSizeOf(this) + mallocSizeOf(blocks_);
|
||||
for (size_t i = 0; i < numBlocks_; i++)
|
||||
blocks_[i].sizeOfExcludingThis(mallocSizeOf);
|
||||
return size;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
struct VMFunction;
|
||||
|
|
|
@ -1383,7 +1383,8 @@ JSCompartment::addSizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf,
|
|||
size_t* nonSyntacticLexicalEnvironmentsArg,
|
||||
size_t* templateLiteralMap,
|
||||
size_t* jitCompartment,
|
||||
size_t* privateData)
|
||||
size_t* privateData,
|
||||
size_t* scriptCountsMapArg)
|
||||
{
|
||||
*compartmentObject += mallocSizeOf(this);
|
||||
objectGroups.addSizeOfExcludingThis(mallocSizeOf, tiAllocationSiteTables,
|
||||
|
@ -1391,6 +1392,7 @@ JSCompartment::addSizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf,
|
|||
compartmentTables);
|
||||
wasm.addSizeOfExcludingThis(mallocSizeOf, compartmentTables);
|
||||
*innerViewsArg += innerViews.sizeOfExcludingThis(mallocSizeOf);
|
||||
|
||||
if (lazyArrayBuffers)
|
||||
*lazyArrayBuffersArg += lazyArrayBuffers->sizeOfIncludingThis(mallocSizeOf);
|
||||
if (objectMetadataTable)
|
||||
|
@ -1408,6 +1410,13 @@ JSCompartment::addSizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf,
|
|||
auto callback = runtime_->sizeOfIncludingThisCompartmentCallback;
|
||||
if (callback)
|
||||
*privateData += callback(mallocSizeOf, this);
|
||||
|
||||
if (scriptCountsMap) {
|
||||
*scriptCountsMapArg += scriptCountsMap->sizeOfIncludingThis(mallocSizeOf);
|
||||
for (auto r = scriptCountsMap->all(); !r.empty(); r.popFront()) {
|
||||
*scriptCountsMapArg += r.front().value()->sizeOfIncludingThis(mallocSizeOf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -781,7 +781,8 @@ struct JSCompartment
|
|||
size_t* nonSyntacticLexicalScopes,
|
||||
size_t* templateLiteralMap,
|
||||
size_t* jitCompartment,
|
||||
size_t* privateData);
|
||||
size_t* privateData,
|
||||
size_t* scriptCountsMapArg);
|
||||
|
||||
// Object group tables and other state in the compartment.
|
||||
js::ObjectGroupCompartment objectGroups;
|
||||
|
|
|
@ -1262,6 +1262,14 @@ ScriptCounts::getThrowCounts(size_t offset) {
|
|||
return elem;
|
||||
}
|
||||
|
||||
size_t
|
||||
ScriptCounts::sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) {
|
||||
return mallocSizeOf(this) +
|
||||
pcCounts_.sizeOfExcludingThis(mallocSizeOf) +
|
||||
throwCounts_.sizeOfExcludingThis(mallocSizeOf) +
|
||||
ionCounts_->sizeOfIncludingThis(mallocSizeOf);
|
||||
}
|
||||
|
||||
void
|
||||
JSScript::setIonScript(JSRuntime* rt, js::jit::IonScript* ionScript)
|
||||
{
|
||||
|
|
|
@ -215,6 +215,8 @@ class ScriptCounts
|
|||
// none exists yet. Returns null if the allocation failed.
|
||||
PCCounts* getThrowCounts(size_t offset);
|
||||
|
||||
size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf);
|
||||
|
||||
private:
|
||||
friend class ::JSScript;
|
||||
friend struct ScriptAndCounts;
|
||||
|
|
|
@ -362,7 +362,8 @@ StatsCompartmentCallback(JSContext* cx, void* data, JSCompartment* compartment)
|
|||
&cStats.nonSyntacticLexicalScopesTable,
|
||||
&cStats.templateLiteralMap,
|
||||
&cStats.jitCompartment,
|
||||
&cStats.privateData);
|
||||
&cStats.privateData,
|
||||
&cStats.scriptCountsMap);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -1843,6 +1843,10 @@ ReportCompartmentStats(const JS::CompartmentStats& cStats,
|
|||
"Extra data attached to the compartment by XPConnect, including "
|
||||
"its wrapped-js.");
|
||||
|
||||
ZCREPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("script-counts-map"),
|
||||
cStats.scriptCountsMap,
|
||||
"Profiling-related information for scripts.");
|
||||
|
||||
if (sundriesGCHeap > 0) {
|
||||
// We deliberately don't use ZCREPORT_GC_BYTES here.
|
||||
REPORT_GC_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("sundries/gc-heap"),
|
||||
|
|
Загрузка…
Ссылка в новой задаче