mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
Bug 961883 (part 1) - Measure and report the SourceDataCache. r=benjamin.
--HG-- extra : rebase_source : b599e19fb681e972b1f6e184c44f5a726a61009f
This commit is contained in:
parent
b60b20f34b
commit
5de1ab52da
@ -296,6 +296,7 @@ struct RuntimeSizes
|
||||
macro(_, _, interpreterStack) \
|
||||
macro(_, _, gcMarker) \
|
||||
macro(_, _, mathCache) \
|
||||
macro(_, _, sourceDataCache) \
|
||||
macro(_, _, scriptData) \
|
||||
macro(_, _, scriptSources)
|
||||
|
||||
|
@ -1207,6 +1207,20 @@ SourceDataCache::purge()
|
||||
map_ = nullptr;
|
||||
}
|
||||
|
||||
size_t
|
||||
SourceDataCache::sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf)
|
||||
{
|
||||
size_t n = 0;
|
||||
if (map_ && !map_->empty()) {
|
||||
n += map_->sizeOfIncludingThis(mallocSizeOf);
|
||||
for (Map::Range r = map_->all(); !r.empty(); r.popFront()) {
|
||||
const jschar *v = r.front().value();
|
||||
n += mallocSizeOf(v);
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
const jschar *
|
||||
ScriptSource::chars(JSContext *cx, const SourceDataCache::AutoSuppressPurge &asp)
|
||||
{
|
||||
|
@ -353,6 +353,8 @@ class SourceDataCache
|
||||
bool put(ScriptSource *ss, const jschar *chars, const AutoSuppressPurge &asp);
|
||||
|
||||
void purge();
|
||||
|
||||
size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf);
|
||||
};
|
||||
|
||||
class ScriptSource
|
||||
|
@ -619,6 +619,8 @@ JSRuntime::addSizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf, JS::Runtim
|
||||
|
||||
rtSizes->mathCache += mathCache_ ? mathCache_->sizeOfIncludingThis(mallocSizeOf) : 0;
|
||||
|
||||
rtSizes->sourceDataCache += sourceDataCache.sizeOfExcludingThis(mallocSizeOf);
|
||||
|
||||
rtSizes->scriptData += scriptDataTable().sizeOfExcludingThis(mallocSizeOf);
|
||||
for (ScriptDataTable::Range r = scriptDataTable().all(); !r.empty(); r.popFront())
|
||||
rtSizes->scriptData += mallocSizeOf(r.front());
|
||||
|
@ -2272,6 +2272,11 @@ ReportJSRuntimeExplicitTreeStats(const JS::RuntimeStats &rtStats,
|
||||
KIND_HEAP, rtStats.runtime.mathCache,
|
||||
"Memory used for the math cache.");
|
||||
|
||||
RREPORT_BYTES(rtPath + NS_LITERAL_CSTRING("runtime/source-data-cache"),
|
||||
KIND_HEAP, rtStats.runtime.sourceDataCache,
|
||||
"Memory used for the source data cache, which holds "
|
||||
"decompressed script source code.");
|
||||
|
||||
RREPORT_BYTES(rtPath + NS_LITERAL_CSTRING("runtime/script-data"),
|
||||
KIND_HEAP, rtStats.runtime.scriptData,
|
||||
"Memory used for the table holding script data shared in "
|
||||
|
Loading…
Reference in New Issue
Block a user