Bug 1037886 - Report Latin1 and TwoByte strings separately in about:memory. r=njn

This commit is contained in:
Jan de Mooij 2014-07-16 19:11:50 +02:00
Родитель 6d3b8ede42
Коммит 6675f63031
3 изменённых файлов: 55 добавлений и 22 удалений

Просмотреть файл

@ -212,8 +212,10 @@ struct GCSizes
struct StringInfo
{
#define FOR_EACH_SIZE(macro) \
macro(Strings, IsLiveGCThing, gcHeap) \
macro(Strings, NotLiveGCThing, mallocHeap) \
macro(Strings, IsLiveGCThing, gcHeapLatin1) \
macro(Strings, IsLiveGCThing, gcHeapTwoByte) \
macro(Strings, NotLiveGCThing, mallocHeapLatin1) \
macro(Strings, NotLiveGCThing, mallocHeapTwoByte)
StringInfo()
: FOR_EACH_SIZE(ZERO_SIZE)

Просмотреть файл

@ -380,8 +380,13 @@ StatsCellCallback(JSRuntime *rt, void *data, void *thing, JSGCTraceKind traceKin
JSString *str = static_cast<JSString *>(thing);
JS::StringInfo info;
info.gcHeap = thingSize;
info.mallocHeap = str->sizeOfExcludingThis(rtStats->mallocSizeOf_);
if (str->hasLatin1Chars()) {
info.gcHeapLatin1 = thingSize;
info.mallocHeapLatin1 = str->sizeOfExcludingThis(rtStats->mallocSizeOf_);
} else {
info.gcHeapTwoByte = thingSize;
info.mallocHeapTwoByte = str->sizeOfExcludingThis(rtStats->mallocSizeOf_);
}
info.numCopies = 1;
zStats->stringInfo.add(info);

Просмотреть файл

@ -1915,8 +1915,10 @@ ReportZoneStats(const JS::ZoneStats &zStats,
// strings which contain "string(length=" into their own bucket.
# define STRING_LENGTH "string(length="
if (FindInReadable(NS_LITERAL_CSTRING(STRING_LENGTH), notableString)) {
stringsNotableAboutMemoryGCHeap += info.gcHeap;
stringsNotableAboutMemoryMallocHeap += info.mallocHeap;
stringsNotableAboutMemoryGCHeap += info.gcHeapLatin1;
stringsNotableAboutMemoryGCHeap += info.gcHeapTwoByte;
stringsNotableAboutMemoryMallocHeap += info.mallocHeapLatin1;
stringsNotableAboutMemoryMallocHeap += info.mallocHeapTwoByte;
continue;
}
@ -1933,16 +1935,28 @@ ReportZoneStats(const JS::ZoneStats &zStats,
info.length, info.numCopies, escapedString.get(),
truncated ? " (truncated)" : "");
if (info.gcHeap > 0) {
REPORT_GC_BYTES(path + NS_LITERAL_CSTRING("gc-heap"),
info.gcHeap,
"Strings. " MAYBE_INLINE);
if (info.gcHeapLatin1 > 0) {
REPORT_GC_BYTES(path + NS_LITERAL_CSTRING("gc-heap/latin1"),
info.gcHeapLatin1,
"Latin1 strings. " MAYBE_INLINE);
}
if (info.mallocHeap > 0) {
REPORT_BYTES(path + NS_LITERAL_CSTRING("malloc-heap"),
KIND_HEAP, info.mallocHeap,
"Non-inline string characters. " MAYBE_OVERALLOCATED);
if (info.gcHeapTwoByte > 0) {
REPORT_GC_BYTES(path + NS_LITERAL_CSTRING("gc-heap/two-byte"),
info.gcHeapTwoByte,
"TwoByte strings. " MAYBE_INLINE);
}
if (info.mallocHeapLatin1 > 0) {
REPORT_BYTES(path + NS_LITERAL_CSTRING("malloc-heap/latin1"),
KIND_HEAP, info.mallocHeapLatin1,
"Non-inline Latin1 string characters. " MAYBE_OVERALLOCATED);
}
if (info.mallocHeapTwoByte > 0) {
REPORT_BYTES(path + NS_LITERAL_CSTRING("malloc-heap/two-byte"),
KIND_HEAP, info.mallocHeapTwoByte,
"Non-inline TwoByte string characters. " MAYBE_OVERALLOCATED);
}
}
@ -1951,16 +1965,28 @@ ReportZoneStats(const JS::ZoneStats &zStats,
? NS_LITERAL_CSTRING("strings/")
: NS_LITERAL_CSTRING("strings/string(<non-notable strings>)/");
if (zStats.stringInfo.gcHeap > 0) {
REPORT_GC_BYTES(nonNotablePath + NS_LITERAL_CSTRING("gc-heap"),
zStats.stringInfo.gcHeap,
"Strings. " MAYBE_INLINE);
if (zStats.stringInfo.gcHeapLatin1 > 0) {
REPORT_GC_BYTES(nonNotablePath + NS_LITERAL_CSTRING("gc-heap/latin1"),
zStats.stringInfo.gcHeapLatin1,
"Latin1 strings. " MAYBE_INLINE);
}
if (zStats.stringInfo.mallocHeap > 0) {
REPORT_BYTES(nonNotablePath + NS_LITERAL_CSTRING("malloc-heap"),
KIND_HEAP, zStats.stringInfo.mallocHeap,
"Non-inline string characters. " MAYBE_OVERALLOCATED);
if (zStats.stringInfo.gcHeapTwoByte > 0) {
REPORT_GC_BYTES(nonNotablePath + NS_LITERAL_CSTRING("gc-heap/two-byte"),
zStats.stringInfo.gcHeapTwoByte,
"TwoByte strings. " MAYBE_INLINE);
}
if (zStats.stringInfo.mallocHeapLatin1 > 0) {
REPORT_BYTES(nonNotablePath + NS_LITERAL_CSTRING("malloc-heap/latin1"),
KIND_HEAP, zStats.stringInfo.mallocHeapLatin1,
"Non-inline Latin1 string characters. " MAYBE_OVERALLOCATED);
}
if (zStats.stringInfo.mallocHeapTwoByte > 0) {
REPORT_BYTES(nonNotablePath + NS_LITERAL_CSTRING("malloc-heap/two-byte"),
KIND_HEAP, zStats.stringInfo.mallocHeapTwoByte,
"Non-inline TwoByte string characters. " MAYBE_OVERALLOCATED);
}
if (stringsNotableAboutMemoryGCHeap > 0) {