Issue #2083 - Part 1: Make RegExpShared a GC thing.

Based on Mozilla bug 1345177.
Changes from the original bug's patch:

- We don't have JS::CurrentThreadIsHeapCollecting, so let's use
  trc->runtime()->isHeapCollecting() instead.
- Mozilla bug 1337117 renamed runtimeFromMainThread to
  runtimeFromActiveCooperatingThread for Firefox 54, so let's use the former
This commit is contained in:
Job Bautista 2023-01-26 15:02:09 +08:00 committed by roytam1
commit 3796c7c1e1
29 changed files with 384 additions and 412 deletions

View file

@ -1837,6 +1837,14 @@ ReportZoneStats(const JS::ZoneStats& zStats,
zStats.scopesMallocHeap,
"Arrays of binding names and other binding-related data.");
ZCREPORT_GC_BYTES(pathPrefix + NS_LITERAL_CSTRING("regexp-shareds/gc-heap"),
zStats.regExpSharedsGCHeap,
"Shared compiled regexp data.");
ZCREPORT_BYTES(pathPrefix + NS_LITERAL_CSTRING("regexp-shareds/malloc-heap"),
zStats.regExpSharedsMallocHeap,
"Shared compiled regexp data.");
ZCREPORT_BYTES(pathPrefix + NS_LITERAL_CSTRING("type-pool"),
zStats.typePool,
"Type sets and related data.");
@ -2855,6 +2863,10 @@ JSReporter::CollectReports(WindowPaths* windowPaths,
KIND_OTHER, rtStats.zTotals.unusedGCThings.jitcode,
"Unused jitcode cells within non-empty arenas.");
REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-committed/unused/gc-things/regexp-shareds"),
KIND_OTHER, rtStats.zTotals.unusedGCThings.regExpShared,
"Unused regexpshared cells within non-empty arenas.");
REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-committed/used/chunk-admin"),
KIND_OTHER, rtStats.gcHeapChunkAdmin,
"The same as 'explicit/js-non-window/gc-heap/chunk-admin'.");
@ -2906,6 +2918,10 @@ JSReporter::CollectReports(WindowPaths* windowPaths,
KIND_OTHER, rtStats.zTotals.jitCodesGCHeap,
"Used jitcode cells.");
MREPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-committed/used/gc-things/regexp-shareds"),
KIND_OTHER, rtStats.zTotals.regExpSharedsGCHeap,
"Used regexpshared cells.");
MOZ_ASSERT(gcThingTotal == rtStats.gcHeapGCThings);
// Report xpconnect.