mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 799019 - Tweak per-compartment memory reporting. r=Ms2ger.
--HG-- extra : rebase_source : 66bab372c7b3a7f4cebfd059b4c64a7562ba1f5d
This commit is contained in:
parent
ec2a55e12e
commit
d87477d4a5
@ -58,7 +58,6 @@ struct RuntimeSizes
|
||||
, mathCache(0)
|
||||
, scriptFilenames(0)
|
||||
, scriptSources(0)
|
||||
, compartmentObjects(0)
|
||||
{}
|
||||
|
||||
size_t object;
|
||||
@ -75,12 +74,6 @@ struct RuntimeSizes
|
||||
size_t mathCache;
|
||||
size_t scriptFilenames;
|
||||
size_t scriptSources;
|
||||
|
||||
// This is the exception to the "RuntimeSizes doesn't measure things within
|
||||
// compartments" rule. We combine the sizes of all the JSCompartment
|
||||
// objects into a single measurement because each one is fairly small, and
|
||||
// they're all the same size.
|
||||
size_t compartmentObjects;
|
||||
};
|
||||
|
||||
struct CompartmentStats
|
||||
@ -123,7 +116,10 @@ struct CompartmentStats
|
||||
size_t scriptData;
|
||||
size_t jaegerData;
|
||||
size_t ionData;
|
||||
size_t compartmentObject;
|
||||
size_t crossCompartmentWrappers;
|
||||
size_t regexpCompartment;
|
||||
size_t debuggeesSet;
|
||||
|
||||
TypeInferenceSizes typeInferenceSizes;
|
||||
|
||||
@ -159,7 +155,10 @@ struct CompartmentStats
|
||||
ADD(scriptData);
|
||||
ADD(jaegerData);
|
||||
ADD(ionData);
|
||||
ADD(compartmentObject);
|
||||
ADD(crossCompartmentWrappers);
|
||||
ADD(regexpCompartment);
|
||||
ADD(debuggeesSet);
|
||||
|
||||
#undef ADD
|
||||
|
||||
|
@ -100,19 +100,6 @@ js::TraceCycleDetectionSet(JSTracer *trc, js::ObjectSet &set)
|
||||
}
|
||||
}
|
||||
|
||||
struct CallbackData
|
||||
{
|
||||
CallbackData(JSMallocSizeOfFun f) : mallocSizeOf(f), n(0) {}
|
||||
JSMallocSizeOfFun mallocSizeOf;
|
||||
size_t n;
|
||||
};
|
||||
|
||||
void CompartmentCallback(JSRuntime *rt, void *vdata, JSCompartment *compartment)
|
||||
{
|
||||
CallbackData *data = (CallbackData *) vdata;
|
||||
data->n += data->mallocSizeOf(compartment);
|
||||
}
|
||||
|
||||
void
|
||||
JSRuntime::sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf, RuntimeSizes *rtSizes)
|
||||
{
|
||||
@ -147,11 +134,6 @@ JSRuntime::sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf, RuntimeSizes *rtS
|
||||
rtSizes->scriptFilenames = scriptFilenameTable.sizeOfExcludingThis(mallocSizeOf);
|
||||
for (ScriptFilenameTable::Range r = scriptFilenameTable.all(); !r.empty(); r.popFront())
|
||||
rtSizes->scriptFilenames += mallocSizeOf(r.front());
|
||||
|
||||
rtSizes->compartmentObjects = 0;
|
||||
CallbackData data(mallocSizeOf);
|
||||
JS_IterateCompartments(this, &data, CompartmentCallback);
|
||||
rtSizes->compartmentObjects = data.n;
|
||||
}
|
||||
|
||||
size_t
|
||||
|
@ -847,11 +847,19 @@ JSCompartment::sweepBreakpoints(FreeOp *fop)
|
||||
}
|
||||
}
|
||||
|
||||
size_t
|
||||
JSCompartment::sizeOfShapeTable(JSMallocSizeOfFun mallocSizeOf)
|
||||
void
|
||||
JSCompartment::sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf, size_t *compartmentObject,
|
||||
TypeInferenceSizes *tiSizes, size_t *shapesCompartmentTables,
|
||||
size_t *crossCompartmentWrappersArg, size_t *regexpCompartment,
|
||||
size_t *debuggeesSet)
|
||||
{
|
||||
return baseShapes.sizeOfExcludingThis(mallocSizeOf)
|
||||
+ initialShapes.sizeOfExcludingThis(mallocSizeOf)
|
||||
+ newTypeObjects.sizeOfExcludingThis(mallocSizeOf)
|
||||
+ lazyTypeObjects.sizeOfExcludingThis(mallocSizeOf);
|
||||
*compartmentObject = mallocSizeOf(this);
|
||||
sizeOfTypeInferenceData(tiSizes, mallocSizeOf);
|
||||
*shapesCompartmentTables = baseShapes.sizeOfExcludingThis(mallocSizeOf)
|
||||
+ initialShapes.sizeOfExcludingThis(mallocSizeOf)
|
||||
+ newTypeObjects.sizeOfExcludingThis(mallocSizeOf)
|
||||
+ lazyTypeObjects.sizeOfExcludingThis(mallocSizeOf);
|
||||
*crossCompartmentWrappersArg = crossCompartmentWrappers.sizeOfExcludingThis(mallocSizeOf);
|
||||
*regexpCompartment = regExps.sizeOfExcludingThis(mallocSizeOf);
|
||||
*debuggeesSet = debuggees.sizeOfExcludingThis(mallocSizeOf);
|
||||
}
|
||||
|
@ -278,9 +278,15 @@ struct JSCompartment
|
||||
|
||||
js::RegExpCompartment regExps;
|
||||
|
||||
size_t sizeOfShapeTable(JSMallocSizeOfFun mallocSizeOf);
|
||||
private:
|
||||
void sizeOfTypeInferenceData(JS::TypeInferenceSizes *stats, JSMallocSizeOfFun mallocSizeOf);
|
||||
|
||||
public:
|
||||
void sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf, size_t *compartmentObject,
|
||||
JS::TypeInferenceSizes *tiSizes,
|
||||
size_t *shapesCompartmentTables, size_t *crossCompartmentWrappers,
|
||||
size_t *regexpCompartment, size_t *debuggeesSet);
|
||||
|
||||
/*
|
||||
* Shared scope property tree, and arena-pool for allocating its nodes.
|
||||
*/
|
||||
|
@ -81,11 +81,14 @@ StatsCompartmentCallback(JSRuntime *rt, void *data, JSCompartment *compartment)
|
||||
rtStats->initExtraCompartmentStats(compartment, &cStats);
|
||||
rtStats->currCompartmentStats = &cStats;
|
||||
|
||||
// Get the compartment-level numbers.
|
||||
compartment->sizeOfTypeInferenceData(&cStats.typeInferenceSizes, rtStats->mallocSizeOf);
|
||||
cStats.shapesCompartmentTables = compartment->sizeOfShapeTable(rtStats->mallocSizeOf);
|
||||
cStats.crossCompartmentWrappers =
|
||||
compartment->crossCompartmentWrappers.sizeOfExcludingThis(rtStats->mallocSizeOf);
|
||||
// Measure the compartment object itself, and things hanging off it.
|
||||
compartment->sizeOfIncludingThis(rtStats->mallocSizeOf,
|
||||
&cStats.compartmentObject,
|
||||
&cStats.typeInferenceSizes,
|
||||
&cStats.shapesCompartmentTables,
|
||||
&cStats.crossCompartmentWrappers,
|
||||
&cStats.regexpCompartment,
|
||||
&cStats.debuggeesSet);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -617,6 +617,12 @@ RegExpCompartment::get(JSContext *cx, JSAtom *atom, JSString *opt, RegExpGuard *
|
||||
return get(cx, atom, flags, g);
|
||||
}
|
||||
|
||||
size_t
|
||||
RegExpCompartment::sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf)
|
||||
{
|
||||
return map_.sizeOfExcludingThis(mallocSizeOf);
|
||||
}
|
||||
|
||||
/* Functions */
|
||||
|
||||
JSObject *
|
||||
|
@ -290,6 +290,8 @@ class RegExpCompartment
|
||||
* mapping property, 'hackedSource' is unambiguous.
|
||||
*/
|
||||
bool lookupHack(JSAtom *source, RegExpFlag flags, JSContext *cx, RegExpGuard *g);
|
||||
|
||||
size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf);
|
||||
};
|
||||
|
||||
class RegExpObject : public JSObject
|
||||
|
@ -1615,10 +1615,22 @@ ReportCompartmentStats(const JS::CompartmentStats &cStats,
|
||||
"Memory used by the IonMonkey JIT for compilation data: "
|
||||
"IonScripts.");
|
||||
|
||||
CREPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("compartment-object"),
|
||||
cStats.compartmentObject,
|
||||
"Memory used for the JSCompartment object itself.");
|
||||
|
||||
CREPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("cross-compartment-wrappers"),
|
||||
cStats.crossCompartmentWrappers,
|
||||
"Memory used by cross-compartment wrappers.");
|
||||
|
||||
CREPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("regexp-compartment"),
|
||||
cStats.regexpCompartment,
|
||||
"Memory used by the regexp compartment.");
|
||||
|
||||
CREPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("debuggees-set"),
|
||||
cStats.debuggeesSet,
|
||||
"Memory used by the debuggees set.");
|
||||
|
||||
CREPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("type-inference/script-main"),
|
||||
cStats.typeInferenceSizes.scripts,
|
||||
"Memory used during type inference to store type sets of "
|
||||
@ -1753,12 +1765,6 @@ ReportJSRuntimeExplicitTreeStats(const JS::RuntimeStats &rtStats,
|
||||
nsIMemoryReporter::KIND_HEAP, rtStats.runtime.scriptSources,
|
||||
"Memory use for storing JavaScript source code.");
|
||||
|
||||
RREPORT_BYTES(rtPath + NS_LITERAL_CSTRING("runtime/compartment-objects"),
|
||||
nsIMemoryReporter::KIND_HEAP, rtStats.runtime.compartmentObjects,
|
||||
"Memory used for JSCompartment objects. These are fairly "
|
||||
"small and all the same size, so they're not worth reporting "
|
||||
"on a per-compartment basis.");
|
||||
|
||||
if (rtTotalOut) {
|
||||
*rtTotalOut = rtTotal;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user