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

@ -15,6 +15,7 @@ namespace js {
class BaseShape;
class LazyScript;
class ObjectGroup;
class RegExpShared;
class Shape;
class Scope;
namespace jit {
@ -58,13 +59,15 @@ enum class TraceKind
BaseShape = 0x0F,
JitCode = 0x1F,
LazyScript = 0x2F,
Scope = 0x3F
Scope = 0x3F,
RegExpShared = 0x4F
};
const static uintptr_t OutOfLineTraceKindMask = 0x07;
static_assert(uintptr_t(JS::TraceKind::BaseShape) & OutOfLineTraceKindMask, "mask bits are set");
static_assert(uintptr_t(JS::TraceKind::JitCode) & OutOfLineTraceKindMask, "mask bits are set");
static_assert(uintptr_t(JS::TraceKind::LazyScript) & OutOfLineTraceKindMask, "mask bits are set");
static_assert(uintptr_t(JS::TraceKind::Scope) & OutOfLineTraceKindMask, "mask bits are set");
static_assert(uintptr_t(JS::TraceKind::RegExpShared) & OutOfLineTraceKindMask, "mask bits are set");
// When this header is imported inside SpiderMonkey, the class definitions are
// available and we can query those definitions to find the correct kind
@ -87,7 +90,8 @@ struct MapTypeToTraceKind {
D(Script, JSScript, true) \
D(Shape, js::Shape, true) \
D(String, JSString, false) \
D(Symbol, JS::Symbol, false)
D(Symbol, JS::Symbol, false) \
D(RegExpShared, js::RegExpShared, true)
// Map from all public types to their trace kind.
#define JS_EXPAND_DEF(name, type, _) \