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
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@

#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
@@ -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,
+2 −0
Original line number Diff line number Diff line
@@ -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();