Bug 919889 (part 3) - Move the private_ field out of ObjectsExtraSizes. r=luke.

This commit is contained in:
Nicholas Nethercote 2013-09-24 23:24:28 -07:00
parent 1c1aea55ac
commit 20426ed4ad
3 changed files with 7 additions and 6 deletions

View File

@ -108,8 +108,6 @@ struct ObjectsExtraSizes
size_t regExpStatics;
size_t propertyIteratorData;
size_t ctypesData;
size_t private_; // The '_' suffix is required because |private| is a keyword.
// Note that this field is measured separately from the others.
ObjectsExtraSizes() { memset(this, 0, sizeof(ObjectsExtraSizes)); }
@ -124,7 +122,6 @@ struct ObjectsExtraSizes
this->regExpStatics += sizes.regExpStatics;
this->propertyIteratorData += sizes.propertyIteratorData;
this->ctypesData += sizes.ctypesData;
this->private_ += sizes.private_;
}
};
@ -330,6 +327,7 @@ struct CompartmentStats
gcHeapShapesDict(0),
gcHeapShapesBase(0),
gcHeapScripts(0),
objectsPrivate(0),
objectsExtra(),
shapesExtraTreeTables(0),
shapesExtraDictTables(0),
@ -359,6 +357,7 @@ struct CompartmentStats
gcHeapShapesDict(other.gcHeapShapesDict),
gcHeapShapesBase(other.gcHeapShapesBase),
gcHeapScripts(other.gcHeapScripts),
objectsPrivate(other.objectsPrivate),
objectsExtra(other.objectsExtra),
shapesExtraTreeTables(other.shapesExtraTreeTables),
shapesExtraDictTables(other.shapesExtraDictTables),
@ -392,6 +391,7 @@ struct CompartmentStats
size_t gcHeapShapesDict;
size_t gcHeapShapesBase;
size_t gcHeapScripts;
size_t objectsPrivate; // measured via ObjectPrivateVisitor
ObjectsExtraSizes objectsExtra;
size_t shapesExtraTreeTables;
@ -424,6 +424,7 @@ struct CompartmentStats
ADD(gcHeapShapesDict);
ADD(gcHeapShapesBase);
ADD(gcHeapScripts);
ADD(objectsPrivate);
objectsExtra.add(cStats.objectsExtra);
ADD(shapesExtraTreeTables);

View File

@ -301,12 +301,12 @@ StatsCellCallback(JSRuntime *rt, void *data, void *thing, JSGCTraceKind traceKin
obj->sizeOfExcludingThis(rtStats->mallocSizeOf_, &objectsExtra);
cStats->objectsExtra.add(objectsExtra);
// JSObject::sizeOfExcludingThis() doesn't measure objectsExtraPrivate,
// JSObject::sizeOfExcludingThis() doesn't measure objectsPrivate,
// so we do it here.
if (ObjectPrivateVisitor *opv = closure->opv) {
nsISupports *iface;
if (opv->getISupports_(obj, &iface) && iface) {
cStats->objectsExtra.private_ += opv->sizeOfIncludingThis(iface);
cStats->objectsPrivate += opv->sizeOfIncludingThis(iface);
}
}
break;

View File

@ -2067,7 +2067,7 @@ ReportCompartmentStats(const JS::CompartmentStats &cStats,
// DOM nodes in the JS reporter, but we want to report them in a "dom"
// sub-tree rather than a "js" sub-tree.
ZCREPORT_BYTES(cDOMPathPrefix + NS_LITERAL_CSTRING("orphan-nodes"),
cStats.objectsExtra.private_,
cStats.objectsPrivate,
"Memory used by orphan DOM nodes that are only reachable "
"from JavaScript objects.");