Changeset View
Changeset View
Standalone View
Standalone View
libraries/source/spidermonkey/include-win32-debug/js/MemoryMetrics.h
Show First 20 Lines • Show All 160 Lines • ▼ Show 20 Lines | |||||
namespace JS { | namespace JS { | ||||
struct ClassInfo | struct ClassInfo | ||||
{ | { | ||||
#define FOR_EACH_SIZE(macro) \ | #define FOR_EACH_SIZE(macro) \ | ||||
macro(Objects, GCHeapUsed, objectsGCHeap) \ | macro(Objects, GCHeapUsed, objectsGCHeap) \ | ||||
macro(Objects, MallocHeap, objectsMallocHeapSlots) \ | macro(Objects, MallocHeap, objectsMallocHeapSlots) \ | ||||
macro(Objects, MallocHeap, objectsMallocHeapElementsNonAsmJS) \ | macro(Objects, MallocHeap, objectsMallocHeapElementsNormal) \ | ||||
macro(Objects, MallocHeap, objectsMallocHeapElementsAsmJS) \ | macro(Objects, MallocHeap, objectsMallocHeapElementsAsmJS) \ | ||||
macro(Objects, NonHeap, objectsNonHeapElementsAsmJS) \ | |||||
macro(Objects, NonHeap, objectsNonHeapElementsMapped) \ | |||||
macro(Objects, NonHeap, objectsNonHeapCodeAsmJS) \ | |||||
macro(Objects, MallocHeap, objectsMallocHeapMisc) \ | macro(Objects, MallocHeap, objectsMallocHeapMisc) \ | ||||
\ | macro(Objects, NonHeap, objectsNonHeapElementsNormal) \ | ||||
macro(Other, GCHeapUsed, shapesGCHeapTree) \ | macro(Objects, NonHeap, objectsNonHeapElementsShared) \ | ||||
macro(Other, GCHeapUsed, shapesGCHeapDict) \ | macro(Objects, NonHeap, objectsNonHeapElementsWasm) \ | ||||
macro(Other, GCHeapUsed, shapesGCHeapBase) \ | macro(Objects, NonHeap, objectsNonHeapCodeWasm) | ||||
macro(Other, MallocHeap, shapesMallocHeapTreeTables) \ | |||||
macro(Other, MallocHeap, shapesMallocHeapDictTables) \ | |||||
macro(Other, MallocHeap, shapesMallocHeapTreeKids) | |||||
ClassInfo() | ClassInfo() | ||||
: FOR_EACH_SIZE(ZERO_SIZE) | : FOR_EACH_SIZE(ZERO_SIZE) | ||||
dummy() | wasmGuardPages(0) | ||||
{} | {} | ||||
void add(const ClassInfo& other) { | void add(const ClassInfo& other) { | ||||
FOR_EACH_SIZE(ADD_OTHER_SIZE) | FOR_EACH_SIZE(ADD_OTHER_SIZE) | ||||
} | } | ||||
void subtract(const ClassInfo& other) { | void subtract(const ClassInfo& other) { | ||||
FOR_EACH_SIZE(SUB_OTHER_SIZE) | FOR_EACH_SIZE(SUB_OTHER_SIZE) | ||||
Show All 20 Lines | void addToTabSizes(TabSizes* sizes) const { | ||||
FOR_EACH_SIZE(ADD_TO_TAB_SIZES) | FOR_EACH_SIZE(ADD_TO_TAB_SIZES) | ||||
} | } | ||||
void addToServoSizes(ServoSizes *sizes) const { | void addToServoSizes(ServoSizes *sizes) const { | ||||
FOR_EACH_SIZE(ADD_TO_SERVO_SIZES) | FOR_EACH_SIZE(ADD_TO_SERVO_SIZES) | ||||
} | } | ||||
FOR_EACH_SIZE(DECL_SIZE) | FOR_EACH_SIZE(DECL_SIZE) | ||||
size_t wasmGuardPages; | |||||
#undef FOR_EACH_SIZE | |||||
}; | |||||
struct ShapeInfo | |||||
{ | |||||
#define FOR_EACH_SIZE(macro) \ | |||||
macro(Other, GCHeapUsed, shapesGCHeapTree) \ | |||||
macro(Other, GCHeapUsed, shapesGCHeapDict) \ | |||||
macro(Other, GCHeapUsed, shapesGCHeapBase) \ | |||||
macro(Other, MallocHeap, shapesMallocHeapTreeTables) \ | |||||
macro(Other, MallocHeap, shapesMallocHeapDictTables) \ | |||||
macro(Other, MallocHeap, shapesMallocHeapTreeKids) | |||||
ShapeInfo() | |||||
: FOR_EACH_SIZE(ZERO_SIZE) | |||||
dummy() | |||||
{} | |||||
void add(const ShapeInfo& other) { | |||||
FOR_EACH_SIZE(ADD_OTHER_SIZE) | |||||
} | |||||
void subtract(const ShapeInfo& other) { | |||||
FOR_EACH_SIZE(SUB_OTHER_SIZE) | |||||
} | |||||
size_t sizeOfAllThings() const { | |||||
size_t n = 0; | |||||
FOR_EACH_SIZE(ADD_SIZE_TO_N) | |||||
return n; | |||||
} | |||||
size_t sizeOfLiveGCThings() const { | |||||
size_t n = 0; | |||||
FOR_EACH_SIZE(ADD_SIZE_TO_N_IF_LIVE_GC_THING) | |||||
return n; | |||||
} | |||||
void addToTabSizes(TabSizes* sizes) const { | |||||
FOR_EACH_SIZE(ADD_TO_TAB_SIZES) | |||||
} | |||||
void addToServoSizes(ServoSizes *sizes) const { | |||||
FOR_EACH_SIZE(ADD_TO_SERVO_SIZES) | |||||
} | |||||
FOR_EACH_SIZE(DECL_SIZE) | |||||
int dummy; // present just to absorb the trailing comma from FOR_EACH_SIZE(ZERO_SIZE) | int dummy; // present just to absorb the trailing comma from FOR_EACH_SIZE(ZERO_SIZE) | ||||
#undef FOR_EACH_SIZE | #undef FOR_EACH_SIZE | ||||
}; | }; | ||||
/** | /** | ||||
* Holds data about a notable class (one whose combined object and shape | * Holds data about a notable class (one whose combined object and shape | ||||
* instances use more than a certain amount of memory) so we can report it | * instances use more than a certain amount of memory) so we can report it | ||||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | |||||
/** Data for tracking GC memory usage. */ | /** Data for tracking GC memory usage. */ | ||||
struct GCSizes | struct GCSizes | ||||
{ | { | ||||
// |nurseryDecommitted| is marked as NonHeap rather than GCHeapDecommitted | // |nurseryDecommitted| is marked as NonHeap rather than GCHeapDecommitted | ||||
// because we don't consider the nursery to be part of the GC heap. | // because we don't consider the nursery to be part of the GC heap. | ||||
#define FOR_EACH_SIZE(macro) \ | #define FOR_EACH_SIZE(macro) \ | ||||
macro(_, MallocHeap, marker) \ | macro(_, MallocHeap, marker) \ | ||||
macro(_, NonHeap, nurseryCommitted) \ | macro(_, NonHeap, nurseryCommitted) \ | ||||
macro(_, NonHeap, nurseryDecommitted) \ | |||||
macro(_, MallocHeap, nurseryMallocedBuffers) \ | macro(_, MallocHeap, nurseryMallocedBuffers) \ | ||||
macro(_, MallocHeap, storeBufferVals) \ | macro(_, MallocHeap, storeBufferVals) \ | ||||
macro(_, MallocHeap, storeBufferCells) \ | macro(_, MallocHeap, storeBufferCells) \ | ||||
macro(_, MallocHeap, storeBufferSlots) \ | macro(_, MallocHeap, storeBufferSlots) \ | ||||
macro(_, MallocHeap, storeBufferWholeCells) \ | macro(_, MallocHeap, storeBufferWholeCells) \ | ||||
macro(_, MallocHeap, storeBufferGenerics) | macro(_, MallocHeap, storeBufferGenerics) | ||||
GCSizes() | GCSizes() | ||||
▲ Show 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | |||||
/** | /** | ||||
* This class holds information about the memory taken up by script sources | * This class holds information about the memory taken up by script sources | ||||
* from a particular file. | * from a particular file. | ||||
*/ | */ | ||||
struct ScriptSourceInfo | struct ScriptSourceInfo | ||||
{ | { | ||||
#define FOR_EACH_SIZE(macro) \ | #define FOR_EACH_SIZE(macro) \ | ||||
macro(_, MallocHeap, compressed) \ | |||||
macro(_, MallocHeap, uncompressed) \ | |||||
macro(_, MallocHeap, misc) | macro(_, MallocHeap, misc) | ||||
ScriptSourceInfo() | ScriptSourceInfo() | ||||
: FOR_EACH_SIZE(ZERO_SIZE) | : FOR_EACH_SIZE(ZERO_SIZE) | ||||
numScripts(0) | numScripts(0) | ||||
{} | {} | ||||
void add(const ScriptSourceInfo& other) { | void add(const ScriptSourceInfo& other) { | ||||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | |||||
* compartments within it. | * compartments within it. | ||||
*/ | */ | ||||
struct RuntimeSizes | struct RuntimeSizes | ||||
{ | { | ||||
#define FOR_EACH_SIZE(macro) \ | #define FOR_EACH_SIZE(macro) \ | ||||
macro(_, MallocHeap, object) \ | macro(_, MallocHeap, object) \ | ||||
macro(_, MallocHeap, atomsTable) \ | macro(_, MallocHeap, atomsTable) \ | ||||
macro(_, MallocHeap, contexts) \ | macro(_, MallocHeap, contexts) \ | ||||
macro(_, MallocHeap, dtoa) \ | |||||
macro(_, MallocHeap, temporary) \ | macro(_, MallocHeap, temporary) \ | ||||
macro(_, MallocHeap, interpreterStack) \ | macro(_, MallocHeap, interpreterStack) \ | ||||
macro(_, MallocHeap, mathCache) \ | macro(_, MallocHeap, mathCache) \ | ||||
macro(_, MallocHeap, sharedImmutableStringsCache) \ | |||||
macro(_, MallocHeap, sharedIntlData) \ | |||||
macro(_, MallocHeap, uncompressedSourceCache) \ | macro(_, MallocHeap, uncompressedSourceCache) \ | ||||
macro(_, MallocHeap, compressedSourceSet) \ | |||||
macro(_, MallocHeap, scriptData) | macro(_, MallocHeap, scriptData) | ||||
RuntimeSizes() | RuntimeSizes() | ||||
: FOR_EACH_SIZE(ZERO_SIZE) | : FOR_EACH_SIZE(ZERO_SIZE) | ||||
scriptSourceInfo(), | scriptSourceInfo(), | ||||
code(), | code(), | ||||
gc(), | gc(), | ||||
notableScriptSources() | notableScriptSources() | ||||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | #define FOR_EACH_SIZE(macro) \ | ||||
macro(Other, GCHeapUnused, script) \ | macro(Other, GCHeapUnused, script) \ | ||||
macro(Other, GCHeapUnused, lazyScript) \ | macro(Other, GCHeapUnused, lazyScript) \ | ||||
macro(Other, GCHeapUnused, shape) \ | macro(Other, GCHeapUnused, shape) \ | ||||
macro(Other, GCHeapUnused, baseShape) \ | macro(Other, GCHeapUnused, baseShape) \ | ||||
macro(Other, GCHeapUnused, objectGroup) \ | macro(Other, GCHeapUnused, objectGroup) \ | ||||
macro(Other, GCHeapUnused, string) \ | macro(Other, GCHeapUnused, string) \ | ||||
macro(Other, GCHeapUnused, symbol) \ | macro(Other, GCHeapUnused, symbol) \ | ||||
macro(Other, GCHeapUnused, jitcode) \ | macro(Other, GCHeapUnused, jitcode) \ | ||||
macro(Other, GCHeapUnused, scope) | |||||
UnusedGCThingSizes() | UnusedGCThingSizes() | ||||
: FOR_EACH_SIZE(ZERO_SIZE) | : FOR_EACH_SIZE(ZERO_SIZE) | ||||
dummy() | dummy() | ||||
{} | {} | ||||
UnusedGCThingSizes(UnusedGCThingSizes&& other) | UnusedGCThingSizes(UnusedGCThingSizes&& other) | ||||
: FOR_EACH_SIZE(COPY_OTHER_SIZE) | : FOR_EACH_SIZE(COPY_OTHER_SIZE) | ||||
dummy() | dummy() | ||||
{} | {} | ||||
void addToKind(JS::TraceKind kind, intptr_t n) { | void addToKind(JS::TraceKind kind, intptr_t n) { | ||||
switch (kind) { | switch (kind) { | ||||
case JS::TraceKind::Object: object += n; break; | case JS::TraceKind::Object: object += n; break; | ||||
case JS::TraceKind::String: string += n; break; | case JS::TraceKind::String: string += n; break; | ||||
case JS::TraceKind::Symbol: symbol += n; break; | case JS::TraceKind::Symbol: symbol += n; break; | ||||
case JS::TraceKind::Script: script += n; break; | case JS::TraceKind::Script: script += n; break; | ||||
case JS::TraceKind::Shape: shape += n; break; | case JS::TraceKind::Shape: shape += n; break; | ||||
case JS::TraceKind::BaseShape: baseShape += n; break; | case JS::TraceKind::BaseShape: baseShape += n; break; | ||||
case JS::TraceKind::JitCode: jitcode += n; break; | case JS::TraceKind::JitCode: jitcode += n; break; | ||||
case JS::TraceKind::LazyScript: lazyScript += n; break; | case JS::TraceKind::LazyScript: lazyScript += n; break; | ||||
case JS::TraceKind::ObjectGroup: objectGroup += n; break; | case JS::TraceKind::ObjectGroup: objectGroup += n; break; | ||||
case JS::TraceKind::Scope: scope += n; break; | |||||
default: | default: | ||||
MOZ_CRASH("Bad trace kind for UnusedGCThingSizes"); | MOZ_CRASH("Bad trace kind for UnusedGCThingSizes"); | ||||
} | } | ||||
} | } | ||||
void addSizes(const UnusedGCThingSizes& other) { | void addSizes(const UnusedGCThingSizes& other) { | ||||
FOR_EACH_SIZE(ADD_OTHER_SIZE) | FOR_EACH_SIZE(ADD_OTHER_SIZE) | ||||
} | } | ||||
Show All 23 Lines | |||||
#define FOR_EACH_SIZE(macro) \ | #define FOR_EACH_SIZE(macro) \ | ||||
macro(Other, GCHeapUsed, symbolsGCHeap) \ | macro(Other, GCHeapUsed, symbolsGCHeap) \ | ||||
macro(Other, GCHeapAdmin, gcHeapArenaAdmin) \ | macro(Other, GCHeapAdmin, gcHeapArenaAdmin) \ | ||||
macro(Other, GCHeapUsed, lazyScriptsGCHeap) \ | macro(Other, GCHeapUsed, lazyScriptsGCHeap) \ | ||||
macro(Other, MallocHeap, lazyScriptsMallocHeap) \ | macro(Other, MallocHeap, lazyScriptsMallocHeap) \ | ||||
macro(Other, GCHeapUsed, jitCodesGCHeap) \ | macro(Other, GCHeapUsed, jitCodesGCHeap) \ | ||||
macro(Other, GCHeapUsed, objectGroupsGCHeap) \ | macro(Other, GCHeapUsed, objectGroupsGCHeap) \ | ||||
macro(Other, MallocHeap, objectGroupsMallocHeap) \ | macro(Other, MallocHeap, objectGroupsMallocHeap) \ | ||||
macro(Other, GCHeapUsed, scopesGCHeap) \ | |||||
macro(Other, MallocHeap, scopesMallocHeap) \ | |||||
macro(Other, MallocHeap, typePool) \ | macro(Other, MallocHeap, typePool) \ | ||||
macro(Other, MallocHeap, baselineStubsOptimized) \ | macro(Other, MallocHeap, baselineStubsOptimized) \ | ||||
macro(Other, MallocHeap, uniqueIdMap) | macro(Other, MallocHeap, uniqueIdMap) \ | ||||
macro(Other, MallocHeap, shapeTables) | |||||
ZoneStats() | ZoneStats() | ||||
: FOR_EACH_SIZE(ZERO_SIZE) | : FOR_EACH_SIZE(ZERO_SIZE) | ||||
unusedGCThings(), | unusedGCThings(), | ||||
stringInfo(), | stringInfo(), | ||||
shapeInfo(), | |||||
extra(), | extra(), | ||||
allStrings(nullptr), | allStrings(nullptr), | ||||
notableStrings(), | notableStrings(), | ||||
isTotals(true) | isTotals(true) | ||||
{} | {} | ||||
ZoneStats(ZoneStats&& other) | ZoneStats(ZoneStats&& other) | ||||
: FOR_EACH_SIZE(COPY_OTHER_SIZE) | : FOR_EACH_SIZE(COPY_OTHER_SIZE) | ||||
unusedGCThings(mozilla::Move(other.unusedGCThings)), | unusedGCThings(mozilla::Move(other.unusedGCThings)), | ||||
stringInfo(mozilla::Move(other.stringInfo)), | stringInfo(mozilla::Move(other.stringInfo)), | ||||
shapeInfo(mozilla::Move(other.shapeInfo)), | |||||
extra(other.extra), | extra(other.extra), | ||||
allStrings(other.allStrings), | allStrings(other.allStrings), | ||||
notableStrings(mozilla::Move(other.notableStrings)), | notableStrings(mozilla::Move(other.notableStrings)), | ||||
isTotals(other.isTotals) | isTotals(other.isTotals) | ||||
{ | { | ||||
other.allStrings = nullptr; | other.allStrings = nullptr; | ||||
MOZ_ASSERT(!other.isTotals); | MOZ_ASSERT(!other.isTotals); | ||||
} | } | ||||
~ZoneStats() { | ~ZoneStats() { | ||||
// |allStrings| is usually deleted and set to nullptr before this | // |allStrings| is usually deleted and set to nullptr before this | ||||
// destructor runs. But there are failure cases due to OOMs that may | // destructor runs. But there are failure cases due to OOMs that may | ||||
// prevent that, so it doesn't hurt to try again here. | // prevent that, so it doesn't hurt to try again here. | ||||
js_delete(allStrings); | js_delete(allStrings); | ||||
} | } | ||||
bool initStrings(JSRuntime* rt); | bool initStrings(JSRuntime* rt); | ||||
void addSizes(const ZoneStats& other) { | void addSizes(const ZoneStats& other) { | ||||
MOZ_ASSERT(isTotals); | MOZ_ASSERT(isTotals); | ||||
FOR_EACH_SIZE(ADD_OTHER_SIZE) | FOR_EACH_SIZE(ADD_OTHER_SIZE) | ||||
unusedGCThings.addSizes(other.unusedGCThings); | unusedGCThings.addSizes(other.unusedGCThings); | ||||
stringInfo.add(other.stringInfo); | stringInfo.add(other.stringInfo); | ||||
shapeInfo.add(other.shapeInfo); | |||||
} | } | ||||
size_t sizeOfLiveGCThings() const { | size_t sizeOfLiveGCThings() const { | ||||
MOZ_ASSERT(isTotals); | MOZ_ASSERT(isTotals); | ||||
size_t n = 0; | size_t n = 0; | ||||
FOR_EACH_SIZE(ADD_SIZE_TO_N_IF_LIVE_GC_THING) | FOR_EACH_SIZE(ADD_SIZE_TO_N_IF_LIVE_GC_THING) | ||||
n += stringInfo.sizeOfLiveGCThings(); | n += stringInfo.sizeOfLiveGCThings(); | ||||
n += shapeInfo.sizeOfLiveGCThings(); | |||||
return n; | return n; | ||||
} | } | ||||
void addToTabSizes(JS::TabSizes* sizes) const { | void addToTabSizes(JS::TabSizes* sizes) const { | ||||
MOZ_ASSERT(isTotals); | MOZ_ASSERT(isTotals); | ||||
FOR_EACH_SIZE(ADD_TO_TAB_SIZES) | FOR_EACH_SIZE(ADD_TO_TAB_SIZES) | ||||
unusedGCThings.addToTabSizes(sizes); | unusedGCThings.addToTabSizes(sizes); | ||||
stringInfo.addToTabSizes(sizes); | stringInfo.addToTabSizes(sizes); | ||||
shapeInfo.addToTabSizes(sizes); | |||||
} | } | ||||
void addToServoSizes(JS::ServoSizes *sizes) const { | void addToServoSizes(JS::ServoSizes *sizes) const { | ||||
MOZ_ASSERT(isTotals); | MOZ_ASSERT(isTotals); | ||||
FOR_EACH_SIZE(ADD_TO_SERVO_SIZES) | FOR_EACH_SIZE(ADD_TO_SERVO_SIZES) | ||||
unusedGCThings.addToServoSizes(sizes); | unusedGCThings.addToServoSizes(sizes); | ||||
stringInfo.addToServoSizes(sizes); | stringInfo.addToServoSizes(sizes); | ||||
shapeInfo.addToServoSizes(sizes); | |||||
} | } | ||||
// These string measurements are initially for all strings. At the end, | // These string measurements are initially for all strings. At the end, | ||||
// if the measurement granularity is FineGrained, we subtract the | // if the measurement granularity is FineGrained, we subtract the | ||||
// measurements of the notable script sources and move them into | // measurements of the notable script sources and move them into | ||||
// |notableStrings|. | // |notableStrings|. | ||||
FOR_EACH_SIZE(DECL_SIZE) | FOR_EACH_SIZE(DECL_SIZE) | ||||
UnusedGCThingSizes unusedGCThings; | UnusedGCThingSizes unusedGCThings; | ||||
StringInfo stringInfo; | StringInfo stringInfo; | ||||
ShapeInfo shapeInfo; | |||||
void* extra; // This field can be used by embedders. | void* extra; // This field can be used by embedders. | ||||
typedef js::HashMap<JSString*, StringInfo, | typedef js::HashMap<JSString*, StringInfo, | ||||
js::InefficientNonFlatteningStringHashPolicy, | js::InefficientNonFlatteningStringHashPolicy, | ||||
js::SystemAllocPolicy> StringsHashMap; | js::SystemAllocPolicy> StringsHashMap; | ||||
// |allStrings| is only used transiently. During the zone traversal it is | // |allStrings| is only used transiently. During the zone traversal it is | ||||
// filled with info about every string in the zone. It's then used to fill | // filled with info about every string in the zone. It's then used to fill | ||||
Show All 26 Lines | #define FOR_EACH_SIZE(macro) \ | ||||
macro(Other, MallocHeap, compartmentObject) \ | macro(Other, MallocHeap, compartmentObject) \ | ||||
macro(Other, MallocHeap, compartmentTables) \ | macro(Other, MallocHeap, compartmentTables) \ | ||||
macro(Other, MallocHeap, innerViewsTable) \ | macro(Other, MallocHeap, innerViewsTable) \ | ||||
macro(Other, MallocHeap, lazyArrayBuffersTable) \ | macro(Other, MallocHeap, lazyArrayBuffersTable) \ | ||||
macro(Other, MallocHeap, objectMetadataTable) \ | macro(Other, MallocHeap, objectMetadataTable) \ | ||||
macro(Other, MallocHeap, crossCompartmentWrappersTable) \ | macro(Other, MallocHeap, crossCompartmentWrappersTable) \ | ||||
macro(Other, MallocHeap, regexpCompartment) \ | macro(Other, MallocHeap, regexpCompartment) \ | ||||
macro(Other, MallocHeap, savedStacksSet) \ | macro(Other, MallocHeap, savedStacksSet) \ | ||||
macro(Other, MallocHeap, nonSyntacticLexicalScopesTable) | macro(Other, MallocHeap, varNamesSet) \ | ||||
macro(Other, MallocHeap, nonSyntacticLexicalScopesTable) \ | |||||
macro(Other, MallocHeap, jitCompartment) \ | |||||
macro(Other, MallocHeap, privateData) | |||||
CompartmentStats() | CompartmentStats() | ||||
: FOR_EACH_SIZE(ZERO_SIZE) | : FOR_EACH_SIZE(ZERO_SIZE) | ||||
classInfo(), | classInfo(), | ||||
extra(), | extra(), | ||||
allClasses(nullptr), | allClasses(nullptr), | ||||
notableClasses(), | notableClasses(), | ||||
isTotals(true) | isTotals(true) | ||||
{} | {} | ||||
CompartmentStats(CompartmentStats&& other) | CompartmentStats(CompartmentStats&& other) | ||||
: FOR_EACH_SIZE(COPY_OTHER_SIZE) | : FOR_EACH_SIZE(COPY_OTHER_SIZE) | ||||
classInfo(mozilla::Move(other.classInfo)), | classInfo(mozilla::Move(other.classInfo)), | ||||
extra(other.extra), | extra(other.extra), | ||||
allClasses(other.allClasses), | allClasses(other.allClasses), | ||||
notableClasses(mozilla::Move(other.notableClasses)), | notableClasses(mozilla::Move(other.notableClasses)), | ||||
isTotals(other.isTotals) | isTotals(other.isTotals) | ||||
{ | { | ||||
other.allClasses = nullptr; | other.allClasses = nullptr; | ||||
MOZ_ASSERT(!other.isTotals); | MOZ_ASSERT(!other.isTotals); | ||||
} | } | ||||
CompartmentStats(const CompartmentStats&) = delete; // disallow copying | |||||
~CompartmentStats() { | ~CompartmentStats() { | ||||
// |allClasses| is usually deleted and set to nullptr before this | // |allClasses| is usually deleted and set to nullptr before this | ||||
// destructor runs. But there are failure cases due to OOMs that may | // destructor runs. But there are failure cases due to OOMs that may | ||||
// prevent that, so it doesn't hurt to try again here. | // prevent that, so it doesn't hurt to try again here. | ||||
js_delete(allClasses); | js_delete(allClasses); | ||||
} | } | ||||
bool initClasses(JSRuntime* rt); | bool initClasses(JSRuntime* rt); | ||||
▲ Show 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | public: | ||||
GetISupportsFun getISupports_; | GetISupportsFun getISupports_; | ||||
explicit ObjectPrivateVisitor(GetISupportsFun getISupports) | explicit ObjectPrivateVisitor(GetISupportsFun getISupports) | ||||
: getISupports_(getISupports) | : getISupports_(getISupports) | ||||
{} | {} | ||||
}; | }; | ||||
extern JS_PUBLIC_API(bool) | extern JS_PUBLIC_API(bool) | ||||
CollectRuntimeStats(JSRuntime* rt, RuntimeStats* rtStats, ObjectPrivateVisitor* opv, bool anonymize); | CollectRuntimeStats(JSContext* cx, RuntimeStats* rtStats, ObjectPrivateVisitor* opv, bool anonymize); | ||||
extern JS_PUBLIC_API(size_t) | extern JS_PUBLIC_API(size_t) | ||||
SystemCompartmentCount(JSRuntime* rt); | SystemCompartmentCount(JSContext* cx); | ||||
extern JS_PUBLIC_API(size_t) | extern JS_PUBLIC_API(size_t) | ||||
UserCompartmentCount(JSRuntime* rt); | UserCompartmentCount(JSContext* cx); | ||||
extern JS_PUBLIC_API(size_t) | extern JS_PUBLIC_API(size_t) | ||||
PeakSizeOfTemporary(const JSRuntime* rt); | PeakSizeOfTemporary(const JSContext* cx); | ||||
extern JS_PUBLIC_API(bool) | extern JS_PUBLIC_API(bool) | ||||
AddSizeOfTab(JSRuntime* rt, JS::HandleObject obj, mozilla::MallocSizeOf mallocSizeOf, | AddSizeOfTab(JSContext* cx, JS::HandleObject obj, mozilla::MallocSizeOf mallocSizeOf, | ||||
ObjectPrivateVisitor* opv, TabSizes* sizes); | ObjectPrivateVisitor* opv, TabSizes* sizes); | ||||
extern JS_PUBLIC_API(bool) | extern JS_PUBLIC_API(bool) | ||||
AddServoSizeOf(JSRuntime *rt, mozilla::MallocSizeOf mallocSizeOf, | AddServoSizeOf(JSContext* cx, mozilla::MallocSizeOf mallocSizeOf, | ||||
ObjectPrivateVisitor *opv, ServoSizes *sizes); | ObjectPrivateVisitor *opv, ServoSizes *sizes); | ||||
} // namespace JS | } // namespace JS | ||||
#undef DECL_SIZE | #undef DECL_SIZE | ||||
#undef ZERO_SIZE | #undef ZERO_SIZE | ||||
#undef COPY_OTHER_SIZE | #undef COPY_OTHER_SIZE | ||||
#undef ADD_OTHER_SIZE | #undef ADD_OTHER_SIZE | ||||
#undef SUB_OTHER_SIZE | #undef SUB_OTHER_SIZE | ||||
#undef ADD_SIZE_TO_N | #undef ADD_SIZE_TO_N | ||||
#undef ADD_SIZE_TO_N_IF_LIVE_GC_THING | #undef ADD_SIZE_TO_N_IF_LIVE_GC_THING | ||||
#undef ADD_TO_TAB_SIZES | #undef ADD_TO_TAB_SIZES | ||||
#endif /* js_MemoryMetrics_h */ | #endif /* js_MemoryMetrics_h */ |
Wildfire Games · Phabricator