Skip to content
Snippets Groups Projects
Commit 4848d882 authored by Ted Campbell's avatar Ted Campbell
Browse files

Bug 1704570 - Report WellKnownParserAtoms memory correctly. r=nbp

This moves some memory accounting from heap-unclassified to being part of the
runtime-atoms accounting like `commonNames`.

Differential Revision: https://phabricator.services.mozilla.com/D111752
parent a247ea4b
No related branches found
No related tags found
No related merge requests found
......@@ -7,11 +7,12 @@
#ifndef frontend_ParserAtom_h
#define frontend_ParserAtom_h
#include "mozilla/DebugOnly.h" // mozilla::DebugOnly
#include "mozilla/HashFunctions.h" // mozilla::HashString
#include "mozilla/Range.h" // mozilla::Range
#include "mozilla/Span.h" // mozilla::Span
#include "mozilla/Variant.h" // mozilla::Variant
#include "mozilla/DebugOnly.h" // mozilla::DebugOnly
#include "mozilla/HashFunctions.h" // mozilla::HashString
#include "mozilla/MemoryReporting.h" // mozilla::MallocSizeOf
#include "mozilla/Range.h" // mozilla::Range
#include "mozilla/Span.h" // mozilla::Span
#include "mozilla/Variant.h" // mozilla::Variant
#include "ds/LifoAlloc.h" // LifoAlloc
#include "frontend/TypedIndex.h" // TypedIndex
......@@ -545,6 +546,11 @@ class WellKnownParserAtoms {
// No match on tiny Atoms
return TaggedParserAtomIndex::null();
}
size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const {
return mallocSizeOf(this) +
wellKnownMap_.shallowSizeOfExcludingThis(mallocSizeOf);
}
};
bool InstantiateMarkedAtoms(JSContext* cx, const ParserAtomSpan& entries,
......
......@@ -357,6 +357,8 @@ void JSRuntime::addSizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf,
rtSizes->atomsTable += mallocSizeOf(staticStrings);
rtSizes->atomsTable += mallocSizeOf(commonNames);
rtSizes->atomsTable += permanentAtoms()->sizeOfIncludingThis(mallocSizeOf);
rtSizes->atomsTable +=
commonParserNames.ref()->sizeOfIncludingThis(mallocSizeOf);
}
JSContext* cx = mainContextFromAnyThread();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment