зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1263355 - Report memory metrics for Scopes. (r=njn)
This commit is contained in:
Родитель
e2b6833e0a
Коммит
03569f36dd
|
@ -576,6 +576,7 @@ struct UnusedGCThingSizes
|
|||
macro(Other, GCHeapUnused, string) \
|
||||
macro(Other, GCHeapUnused, symbol) \
|
||||
macro(Other, GCHeapUnused, jitcode) \
|
||||
macro(Other, GCHeapUnused, scope)
|
||||
|
||||
UnusedGCThingSizes()
|
||||
: FOR_EACH_SIZE(ZERO_SIZE)
|
||||
|
@ -598,6 +599,7 @@ struct UnusedGCThingSizes
|
|||
case JS::TraceKind::JitCode: jitcode += n; break;
|
||||
case JS::TraceKind::LazyScript: lazyScript += n; break;
|
||||
case JS::TraceKind::ObjectGroup: objectGroup += n; break;
|
||||
case JS::TraceKind::Scope: scope += n; break;
|
||||
default:
|
||||
MOZ_CRASH("Bad trace kind for UnusedGCThingSizes");
|
||||
}
|
||||
|
@ -637,6 +639,8 @@ struct ZoneStats
|
|||
macro(Other, GCHeapUsed, jitCodesGCHeap) \
|
||||
macro(Other, GCHeapUsed, objectGroupsGCHeap) \
|
||||
macro(Other, MallocHeap, objectGroupsMallocHeap) \
|
||||
macro(Other, GCHeapUsed, scopesGCHeap) \
|
||||
macro(Other, MallocHeap, scopesMallocHeap) \
|
||||
macro(Other, MallocHeap, typePool) \
|
||||
macro(Other, MallocHeap, baselineStubsOptimized) \
|
||||
macro(Other, MallocHeap, uniqueIdMap) \
|
||||
|
|
|
@ -589,6 +589,13 @@ StatsCellCallback(JSRuntime* rt, void* data, void* thing, JS::TraceKind traceKin
|
|||
break;
|
||||
}
|
||||
|
||||
case JS::TraceKind::Scope: {
|
||||
Scope* scope = static_cast<Scope*>(thing);
|
||||
zStats->scopesGCHeap += thingSize;
|
||||
zStats->scopesMallocHeap += scope->sizeOfExcludingThis(rtStats->mallocSizeOf_);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
MOZ_CRASH("invalid traceKind in StatsCellCallback");
|
||||
}
|
||||
|
|
|
@ -384,6 +384,14 @@ Scope::finalize(FreeOp* fop)
|
|||
}
|
||||
}
|
||||
|
||||
size_t
|
||||
Scope::sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const
|
||||
{
|
||||
if (data_)
|
||||
return mallocSizeOf(reinterpret_cast<void*>(data_));
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
Scope::dump()
|
||||
{
|
||||
|
|
|
@ -286,6 +286,8 @@ class Scope : public js::gc::TenuredCell
|
|||
void traceChildren(JSTracer* trc);
|
||||
void finalize(FreeOp* fop);
|
||||
|
||||
size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
|
||||
|
||||
void dump();
|
||||
};
|
||||
|
||||
|
|
|
@ -1944,7 +1944,7 @@ ReportZoneStats(const JS::ZoneStats& zStats,
|
|||
|
||||
ZCREPORT_BYTES(pathPrefix + NS_LITERAL_CSTRING("lazy-scripts/malloc-heap"),
|
||||
zStats.lazyScriptsMallocHeap,
|
||||
"Lazy script tables containing free variables or inner functions.");
|
||||
"Lazy script tables containing closed-over bindings or inner functions.");
|
||||
|
||||
ZCREPORT_GC_BYTES(pathPrefix + NS_LITERAL_CSTRING("jit-codes-gc-heap"),
|
||||
zStats.jitCodesGCHeap,
|
||||
|
@ -1958,6 +1958,14 @@ ReportZoneStats(const JS::ZoneStats& zStats,
|
|||
zStats.objectGroupsMallocHeap,
|
||||
"Object group addenda.");
|
||||
|
||||
ZCREPORT_GC_BYTES(pathPrefix + NS_LITERAL_CSTRING("scopes/gc-heap"),
|
||||
zStats.scopesGCHeap,
|
||||
"Scope information for scripts.");
|
||||
|
||||
ZCREPORT_BYTES(pathPrefix + NS_LITERAL_CSTRING("scopes/malloc-heap"),
|
||||
zStats.scopesMallocHeap,
|
||||
"Arrays of binding names and other binding-related data.");
|
||||
|
||||
ZCREPORT_BYTES(pathPrefix + NS_LITERAL_CSTRING("type-pool"),
|
||||
zStats.typePool,
|
||||
"Type sets and related data.");
|
||||
|
@ -2957,6 +2965,10 @@ JSReporter::CollectReports(WindowPaths* windowPaths,
|
|||
KIND_OTHER, rtStats.zTotals.unusedGCThings.objectGroup,
|
||||
"Unused object group cells within non-empty arenas.");
|
||||
|
||||
REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-committed/unused/gc-things/scopes"),
|
||||
KIND_OTHER, rtStats.zTotals.unusedGCThings.scope,
|
||||
"Unused scope cells within non-empty arenas.");
|
||||
|
||||
REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-committed/unused/gc-things/scripts"),
|
||||
KIND_OTHER, rtStats.zTotals.unusedGCThings.script,
|
||||
"Unused script cells within non-empty arenas.");
|
||||
|
@ -3004,6 +3016,10 @@ JSReporter::CollectReports(WindowPaths* windowPaths,
|
|||
KIND_OTHER, rtStats.zTotals.objectGroupsGCHeap,
|
||||
"Used object group cells.");
|
||||
|
||||
MREPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-committed/used/gc-things/scopes"),
|
||||
KIND_OTHER, rtStats.zTotals.scopesGCHeap,
|
||||
"Used scope cells.");
|
||||
|
||||
MREPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-committed/used/gc-things/scripts"),
|
||||
KIND_OTHER, rtStats.cTotals.scriptsGCHeap,
|
||||
"Used script cells.");
|
||||
|
|
Загрузка…
Ссылка в новой задаче