Backed out changesets e66f564d9749 and 0380d914ad39 (bug 1345177) for rooting hazards

This commit is contained in:
Jon Coppeard 2017-03-27 11:09:54 +01:00
Родитель 2a738826a6
Коммит 1376c2700e
43 изменённых файлов: 478 добавлений и 469 удалений

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

@ -129,8 +129,7 @@ class CPOWProxyHandler : public BaseProxyHandler
virtual bool isArray(JSContext* cx, HandleObject obj,
IsArrayAnswer* answer) const override;
virtual const char* className(JSContext* cx, HandleObject proxy) const override;
virtual bool regexp_toShared(JSContext* cx, HandleObject proxy,
MutableHandle<RegExpShared*> shared) const override;
virtual bool regexp_toShared(JSContext* cx, HandleObject proxy, RegExpGuard* g) const override;
virtual void finalize(JSFreeOp* fop, JSObject* proxy) const override;
virtual void objectMoved(JSObject* proxy, const JSObject* old) const override;
virtual bool isCallable(JSObject* obj) const override;
@ -855,14 +854,13 @@ WrapperOwner::getPrototypeIfOrdinary(JSContext* cx, HandleObject proxy, bool* is
}
bool
CPOWProxyHandler::regexp_toShared(JSContext* cx, HandleObject proxy,
MutableHandle<RegExpShared*> shared) const
CPOWProxyHandler::regexp_toShared(JSContext* cx, HandleObject proxy, RegExpGuard* g) const
{
FORWARD(regexp_toShared, (cx, proxy, shared));
FORWARD(regexp_toShared, (cx, proxy, g));
}
bool
WrapperOwner::regexp_toShared(JSContext* cx, HandleObject proxy, MutableHandle<RegExpShared*> shared)
WrapperOwner::regexp_toShared(JSContext* cx, HandleObject proxy, RegExpGuard* g)
{
ObjectId objId = idOf(proxy);
@ -882,7 +880,7 @@ WrapperOwner::regexp_toShared(JSContext* cx, HandleObject proxy, MutableHandle<R
if (!regexp)
return false;
return js::RegExpToSharedNonInline(cx, regexp, shared);
return js::RegExpToSharedNonInline(cx, regexp, g);
}
void

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

@ -60,8 +60,7 @@ class WrapperOwner : public virtual JavaScriptShared
bool getPrototypeIfOrdinary(JSContext* cx, JS::HandleObject proxy, bool* isOrdinary,
JS::MutableHandleObject protop);
bool regexp_toShared(JSContext* cx, JS::HandleObject proxy,
js::MutableHandle<js::RegExpShared*> shared);
bool regexp_toShared(JSContext* cx, JS::HandleObject proxy, js::RegExpGuard* g);
nsresult instanceOf(JSObject* obj, const nsID* id, bool* bp);

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

@ -578,8 +578,7 @@ struct UnusedGCThingSizes
macro(Other, GCHeapUnused, string) \
macro(Other, GCHeapUnused, symbol) \
macro(Other, GCHeapUnused, jitcode) \
macro(Other, GCHeapUnused, scope) \
macro(Other, GCHeapUnused, regExpShared)
macro(Other, GCHeapUnused, scope)
UnusedGCThingSizes()
: FOR_EACH_SIZE(ZERO_SIZE)
@ -593,17 +592,16 @@ struct UnusedGCThingSizes
void addToKind(JS::TraceKind kind, intptr_t n) {
switch (kind) {
case JS::TraceKind::Object: object += n; break;
case JS::TraceKind::String: string += n; break;
case JS::TraceKind::Symbol: symbol += n; break;
case JS::TraceKind::Script: script += n; break;
case JS::TraceKind::Shape: shape += n; break;
case JS::TraceKind::BaseShape: baseShape += n; break;
case JS::TraceKind::JitCode: jitcode += n; break;
case JS::TraceKind::LazyScript: lazyScript += n; break;
case JS::TraceKind::ObjectGroup: objectGroup += n; break;
case JS::TraceKind::Scope: scope += n; break;
case JS::TraceKind::RegExpShared: regExpShared += n; break;
case JS::TraceKind::Object: object += n; break;
case JS::TraceKind::String: string += n; break;
case JS::TraceKind::Symbol: symbol += n; break;
case JS::TraceKind::Script: script += n; break;
case JS::TraceKind::Shape: shape += n; break;
case JS::TraceKind::BaseShape: baseShape += n; break;
case JS::TraceKind::JitCode: jitcode += n; break;
case JS::TraceKind::LazyScript: lazyScript += n; break;
case JS::TraceKind::ObjectGroup: objectGroup += n; break;
case JS::TraceKind::Scope: scope += n; break;
default:
MOZ_CRASH("Bad trace kind for UnusedGCThingSizes");
}
@ -645,8 +643,6 @@ struct ZoneStats
macro(Other, MallocHeap, objectGroupsMallocHeap) \
macro(Other, GCHeapUsed, scopesGCHeap) \
macro(Other, MallocHeap, scopesMallocHeap) \
macro(Other, GCHeapUsed, regExpSharedsGCHeap) \
macro(Other, MallocHeap, regExpSharedsMallocHeap) \
macro(Other, MallocHeap, typePool) \
macro(Other, MallocHeap, baselineStubsOptimized) \
macro(Other, MallocHeap, uniqueIdMap) \

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

@ -32,8 +32,7 @@ using JS::PrivateValue;
using JS::PropertyDescriptor;
using JS::Value;
class RegExpShared;
class RegExpGuard;
class JS_FRIEND_API(Wrapper);
/*
@ -331,8 +330,7 @@ class JS_FRIEND_API(BaseProxyHandler)
virtual bool isArray(JSContext* cx, HandleObject proxy, JS::IsArrayAnswer* answer) const;
virtual const char* className(JSContext* cx, HandleObject proxy) const;
virtual JSString* fun_toString(JSContext* cx, HandleObject proxy, unsigned indent) const;
virtual bool regexp_toShared(JSContext* cx, HandleObject proxy,
MutableHandle<js::RegExpShared*> shared) const;
virtual bool regexp_toShared(JSContext* cx, HandleObject proxy, RegExpGuard* g) const;
virtual bool boxedValue_unbox(JSContext* cx, HandleObject proxy, MutableHandleValue vp) const;
virtual void trace(JSTracer* trc, JSObject* proxy) const;
virtual void finalize(JSFreeOp* fop, JSObject* proxy) const;

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

@ -16,7 +16,6 @@ namespace js {
class BaseShape;
class LazyScript;
class ObjectGroup;
class RegExpShared;
class Shape;
class Scope;
namespace jit {
@ -60,15 +59,13 @@ enum class TraceKind
BaseShape = 0x0F,
JitCode = 0x1F,
LazyScript = 0x2F,
Scope = 0x3F,
RegExpShared = 0x4F
Scope = 0x3F
};
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
@ -91,8 +88,7 @@ struct MapTypeToTraceKind {
D(Script, JSScript, true) \
D(Shape, js::Shape, true) \
D(String, JSString, false) \
D(Symbol, JS::Symbol, false) \
D(RegExpShared, js::RegExpShared, true)
D(Symbol, JS::Symbol, false)
// Map from all public types to their trace kind.
#define JS_EXPAND_DEF(name, type, _) \

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

@ -164,9 +164,6 @@ class JS_PUBLIC_API(CallbackTracer) : public JSTracer
virtual void onScopeEdge(js::Scope** scopep) {
onChild(JS::GCCellPtr(*scopep, JS::TraceKind::Scope));
}
virtual void onRegExpSharedEdge(js::RegExpShared** sharedp) {
onChild(JS::GCCellPtr(*sharedp, JS::TraceKind::RegExpShared));
}
// Override this method to receive notification when a node in the GC
// heap graph is visited.
@ -237,7 +234,6 @@ class JS_PUBLIC_API(CallbackTracer) : public JSTracer
void dispatchToOnEdge(js::jit::JitCode** codep) { onJitCodeEdge(codep); }
void dispatchToOnEdge(js::LazyScript** lazyp) { onLazyScriptEdge(lazyp); }
void dispatchToOnEdge(js::Scope** scopep) { onScopeEdge(scopep); }
void dispatchToOnEdge(js::RegExpShared** sharedp) { onRegExpSharedEdge(sharedp); }
protected:
void setTraceWeakEdges(bool value) {

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

@ -144,7 +144,7 @@ js::ExecuteRegExpLegacy(JSContext* cx, RegExpStatics* res, Handle<RegExpObject*>
HandleLinearString input, size_t* lastIndex, bool test,
MutableHandleValue rval)
{
RootedRegExpShared shared(cx);
RegExpGuard shared(cx);
if (!RegExpObject::getShared(cx, reobj, &shared))
return false;
@ -232,7 +232,7 @@ RegExpInitializeIgnoringLastIndex(JSContext* cx, Handle<RegExpObject*> obj,
if (sharedUse == UseRegExpShared) {
/* Steps 7-8. */
RootedRegExpShared re(cx);
RegExpGuard re(cx);
if (!cx->compartment()->regExps.get(cx, pattern, flags, &re))
return false;
@ -338,7 +338,7 @@ regexp_compile_impl(JSContext* cx, const CallArgs& args)
RegExpFlag flags;
{
// Step 3b.
RootedRegExpShared g(cx);
RegExpGuard g(cx);
if (!RegExpToShared(cx, patternObj, &g))
return false;
@ -433,7 +433,7 @@ js::regexp_construct(JSContext* cx, unsigned argc, Value* vp)
RegExpFlag flags;
{
// Step 4.a.
RootedRegExpShared g(cx);
RegExpGuard g(cx);
if (!RegExpToShared(cx, patternObj, &g))
return false;
sourceAtom = g->getSource();
@ -560,7 +560,7 @@ js::regexp_clone(JSContext* cx, unsigned argc, Value* vp)
RootedAtom sourceAtom(cx);
RegExpFlag flags;
{
RootedRegExpShared g(cx);
RegExpGuard g(cx);
if (!RegExpToShared(cx, from, &g))
return false;
sourceAtom = g->getSource();
@ -917,7 +917,7 @@ ExecuteRegExp(JSContext* cx, HandleObject regexp, HandleString string,
/* Steps 1-2 performed by the caller. */
Rooted<RegExpObject*> reobj(cx, &regexp->as<RegExpObject>());
RootedRegExpShared re(cx);
RegExpGuard re(cx);
if (!RegExpObject::getShared(cx, reobj, &re))
return RegExpRunStatus_Error;

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

@ -120,7 +120,6 @@ struct MovingTracer : JS::CallbackTracer
void onLazyScriptEdge(LazyScript** lazyp) override;
void onBaseShapeEdge(BaseShape** basep) override;
void onScopeEdge(Scope** basep) override;
void onRegExpSharedEdge(RegExpShared** sharedp) override;
void onChild(const JS::GCCellPtr& thing) override {
MOZ_ASSERT(!RelocationOverlay::isCellForwarded(thing.asCell()));
}
@ -128,10 +127,6 @@ struct MovingTracer : JS::CallbackTracer
#ifdef DEBUG
TracerKind getTracerKind() const override { return TracerKind::Moving; }
#endif
private:
template <typename T>
void updateEdge(T** thingp);
};
// Structure for counting how many times objects in a particular group have

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

@ -769,8 +769,6 @@ class GCRuntime
bool isCompactingGCEnabled() const;
bool isShrinkingGC() const { return invocationKind == GC_SHRINK; }
void setGrayRootsTracer(JSTraceDataOp traceOp, void* data);
MOZ_MUST_USE bool addBlackRootsTracer(JSTraceDataOp traceOp, void* data);
void removeBlackRootsTracer(JSTraceDataOp traceOp, void* data);

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

@ -109,7 +109,6 @@ enum class AllocKind {
SYMBOL,
JITCODE,
SCOPE,
REGEXP_SHARED,
LIMIT,
LAST = LIMIT - 1
};
@ -117,39 +116,38 @@ enum class AllocKind {
// Macro to enumerate the different allocation kinds supplying information about
// the trace kind, C++ type and allocation size.
#define FOR_EACH_OBJECT_ALLOCKIND(D) \
/* AllocKind TraceKind TypeName SizedType */ \
D(FUNCTION, Object, JSObject, JSFunction) \
D(FUNCTION_EXTENDED, Object, JSObject, FunctionExtended) \
D(OBJECT0, Object, JSObject, JSObject_Slots0) \
D(OBJECT0_BACKGROUND, Object, JSObject, JSObject_Slots0) \
D(OBJECT2, Object, JSObject, JSObject_Slots2) \
D(OBJECT2_BACKGROUND, Object, JSObject, JSObject_Slots2) \
D(OBJECT4, Object, JSObject, JSObject_Slots4) \
D(OBJECT4_BACKGROUND, Object, JSObject, JSObject_Slots4) \
D(OBJECT8, Object, JSObject, JSObject_Slots8) \
D(OBJECT8_BACKGROUND, Object, JSObject, JSObject_Slots8) \
D(OBJECT12, Object, JSObject, JSObject_Slots12) \
D(OBJECT12_BACKGROUND, Object, JSObject, JSObject_Slots12) \
D(OBJECT16, Object, JSObject, JSObject_Slots16) \
D(OBJECT16_BACKGROUND, Object, JSObject, JSObject_Slots16)
/* AllocKind TraceKind TypeName SizedType */ \
D(FUNCTION, Object, JSObject, JSFunction) \
D(FUNCTION_EXTENDED, Object, JSObject, FunctionExtended) \
D(OBJECT0, Object, JSObject, JSObject_Slots0) \
D(OBJECT0_BACKGROUND, Object, JSObject, JSObject_Slots0) \
D(OBJECT2, Object, JSObject, JSObject_Slots2) \
D(OBJECT2_BACKGROUND, Object, JSObject, JSObject_Slots2) \
D(OBJECT4, Object, JSObject, JSObject_Slots4) \
D(OBJECT4_BACKGROUND, Object, JSObject, JSObject_Slots4) \
D(OBJECT8, Object, JSObject, JSObject_Slots8) \
D(OBJECT8_BACKGROUND, Object, JSObject, JSObject_Slots8) \
D(OBJECT12, Object, JSObject, JSObject_Slots12) \
D(OBJECT12_BACKGROUND, Object, JSObject, JSObject_Slots12) \
D(OBJECT16, Object, JSObject, JSObject_Slots16) \
D(OBJECT16_BACKGROUND, Object, JSObject, JSObject_Slots16)
#define FOR_EACH_NONOBJECT_ALLOCKIND(D) \
/* AllocKind TraceKind TypeName SizedType */ \
D(SCRIPT, Script, JSScript, JSScript) \
D(LAZY_SCRIPT, LazyScript, js::LazyScript, js::LazyScript) \
D(SHAPE, Shape, js::Shape, js::Shape) \
D(ACCESSOR_SHAPE, Shape, js::AccessorShape, js::AccessorShape) \
D(BASE_SHAPE, BaseShape, js::BaseShape, js::BaseShape) \
D(OBJECT_GROUP, ObjectGroup, js::ObjectGroup, js::ObjectGroup) \
D(FAT_INLINE_STRING, String, JSFatInlineString, JSFatInlineString) \
D(STRING, String, JSString, JSString) \
D(EXTERNAL_STRING, String, JSExternalString, JSExternalString) \
D(FAT_INLINE_ATOM, String, js::FatInlineAtom, js::FatInlineAtom) \
D(ATOM, String, js::NormalAtom, js::NormalAtom) \
D(SYMBOL, Symbol, JS::Symbol, JS::Symbol) \
D(JITCODE, JitCode, js::jit::JitCode, js::jit::JitCode) \
D(SCOPE, Scope, js::Scope, js::Scope) \
D(REGEXP_SHARED, RegExpShared, js::RegExpShared, js::RegExpShared)
/* AllocKind TraceKind TypeName SizedType */ \
D(SCRIPT, Script, JSScript, JSScript) \
D(LAZY_SCRIPT, LazyScript, js::LazyScript, js::LazyScript) \
D(SHAPE, Shape, js::Shape, js::Shape) \
D(ACCESSOR_SHAPE, Shape, js::AccessorShape, js::AccessorShape) \
D(BASE_SHAPE, BaseShape, js::BaseShape, js::BaseShape) \
D(OBJECT_GROUP, ObjectGroup, js::ObjectGroup, js::ObjectGroup) \
D(FAT_INLINE_STRING, String, JSFatInlineString, JSFatInlineString) \
D(STRING, String, JSString, JSString) \
D(EXTERNAL_STRING, String, JSExternalString, JSExternalString) \
D(FAT_INLINE_ATOM, String, js::FatInlineAtom, js::FatInlineAtom) \
D(ATOM, String, js::NormalAtom, js::NormalAtom) \
D(SYMBOL, Symbol, JS::Symbol, JS::Symbol) \
D(JITCODE, JitCode, js::jit::JitCode, js::jit::JitCode) \
D(SCOPE, Scope, js::Scope, js::Scope)
#define FOR_EACH_ALLOCKIND(D) \
FOR_EACH_OBJECT_ALLOCKIND(D) \
@ -315,9 +313,6 @@ class TenuredCell : public Cell
static MOZ_ALWAYS_INLINE void writeBarrierPost(void* cellp, TenuredCell* prior,
TenuredCell* next);
// Default implementation for kinds that don't require finalization.
void finalize(FreeOp* fop) {}
// Default implementation for kinds that don't require fixup.
void fixupAfterMovingGC() {}

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

@ -442,14 +442,6 @@ js::TraceNullableEdge(JSTracer* trc, WriteBarrieredBase<T>* thingp, const char*
DispatchToTracer(trc, ConvertToBase(thingp->unsafeUnbarrieredForTracing()), name);
}
template <typename T>
void
js::TraceNullableEdge(JSTracer* trc, ReadBarriered<T>* thingp, const char* name)
{
if (InternalBarrierMethods<T>::isMarkable(thingp->unbarrieredGet()))
DispatchToTracer(trc, ConvertToBase(thingp->unsafeGet()), name);
}
template <typename T>
JS_PUBLIC_API(void)
JS::TraceEdge(JSTracer* trc, JS::Heap<T>* thingp, const char* name)
@ -567,7 +559,6 @@ js::TraceRootRange(JSTracer* trc, size_t len, T* vec, const char* name)
template void js::TraceEdge<type>(JSTracer*, WriteBarrieredBase<type>*, const char*); \
template void js::TraceEdge<type>(JSTracer*, ReadBarriered<type>*, const char*); \
template void js::TraceNullableEdge<type>(JSTracer*, WriteBarrieredBase<type>*, const char*); \
template void js::TraceNullableEdge<type>(JSTracer*, ReadBarriered<type>*, const char*); \
template void js::TraceManuallyBarrieredEdge<type>(JSTracer*, type*, const char*); \
template void js::TraceWeakEdge<type>(JSTracer*, WeakRef<type>*, const char*); \
template void js::TraceRoot<type>(JSTracer*, type*, const char*); \
@ -884,7 +875,6 @@ js::GCMarker::markAndTraceChildren(T* thing)
namespace js {
template <> void GCMarker::traverse(BaseShape* thing) { markAndTraceChildren(thing); }
template <> void GCMarker::traverse(JS::Symbol* thing) { markAndTraceChildren(thing); }
template <> void GCMarker::traverse(RegExpShared* thing) { markAndTraceChildren(thing); }
} // namespace js
// Strings, LazyScripts, Shapes, and Scopes are extremely common, but have

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

@ -86,7 +86,6 @@ class JitCode;
D(js::PlainObject*) \
D(js::PropertyName*) \
D(js::RegExpObject*) \
D(js::RegExpShared*) \
D(js::SavedFrame*) \
D(js::Scope*) \
D(js::ScriptSourceObject*) \

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

@ -184,7 +184,6 @@ static const PhaseInfo phases[] = {
{ PHASE_SWEEP_STRING, "Sweep String", PHASE_SWEEP, 34 },
{ PHASE_SWEEP_SCRIPT, "Sweep Script", PHASE_SWEEP, 35 },
{ PHASE_SWEEP_SCOPE, "Sweep Scope", PHASE_SWEEP, 59 },
{ PHASE_SWEEP_REGEXP_SHARED, "Sweep RegExpShared", PHASE_SWEEP, 61 },
{ PHASE_SWEEP_SHAPE, "Sweep Shape", PHASE_SWEEP, 36 },
{ PHASE_SWEEP_JITCODE, "Sweep JIT code", PHASE_SWEEP, 37 },
{ PHASE_FINALIZE_END, "Finalize End Callback", PHASE_SWEEP, 38 },
@ -212,9 +211,9 @@ static const PhaseInfo phases[] = {
{ PHASE_MARK_COMPARTMENTS, "Mark Compartments", PHASE_MARK_ROOTS, 54 },
{ PHASE_PURGE_SHAPE_TABLES, "Purge ShapeTables", PHASE_NO_PARENT, 60 },
{ PHASE_LIMIT, nullptr, PHASE_NO_PARENT, 61 }
{ PHASE_LIMIT, nullptr, PHASE_NO_PARENT, 60 }
// Current number of telemetryBuckets is 61. If you insert new phases
// Current number of telemetryBuckets is 60. If you insert new phases
// somewhere, start at that number and count up. Do not change any existing
// numbers.
};

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

@ -69,7 +69,6 @@ enum Phase : uint8_t {
PHASE_SWEEP_STRING,
PHASE_SWEEP_SCRIPT,
PHASE_SWEEP_SCOPE,
PHASE_SWEEP_REGEXP_SHARED,
PHASE_SWEEP_SHAPE,
PHASE_SWEEP_JITCODE,
PHASE_FINALIZE_END,

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

@ -65,10 +65,6 @@ template <typename T>
void
TraceNullableEdge(JSTracer* trc, WriteBarrieredBase<T>* thingp, const char* name);
template <typename T>
void
TraceNullableEdge(JSTracer* trc, ReadBarriered<T>* thingp, const char* name);
// Trace through a "root" edge. These edges are the initial edges in the object
// graph traversal. Root edges are asserted to only be traversed in the initial
// phase of a GC.

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

@ -6098,10 +6098,10 @@ JS_GetRegExpFlags(JSContext* cx, HandleObject obj)
AssertHeapIsIdle();
CHECK_REQUEST(cx);
RootedRegExpShared shared(cx);
RegExpGuard shared(cx);
if (!RegExpToShared(cx, obj, &shared))
return false;
return shared->getFlags();
return shared.re()->getFlags();
}
JS_PUBLIC_API(JSString*)
@ -6110,10 +6110,10 @@ JS_GetRegExpSource(JSContext* cx, HandleObject obj)
AssertHeapIsIdle();
CHECK_REQUEST(cx);
RootedRegExpShared shared(cx);
RegExpGuard shared(cx);
if (!RegExpToShared(cx, obj, &shared))
return nullptr;
return shared->getSource();
return shared.re()->getSource();
}
/************************************************************************/

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

@ -67,7 +67,7 @@ JSCompartment::JSCompartment(Zone* zone, const JS::CompartmentOptions& options =
data(nullptr),
allocationMetadataBuilder(nullptr),
lastAnimationTime(0),
regExps(zone),
regExps(runtime_),
globalWriteBarriered(0),
detachedTypedObjects(0),
objectMetadataState(ImmediateMetadata()),
@ -228,13 +228,6 @@ JSCompartment::ensureJitCompartmentExists(JSContext* cx)
}
#ifdef JSGC_HASH_TABLE_CHECKS
void
js::DtoaCache::checkCacheAfterMovingGC()
{
MOZ_ASSERT(!s || !IsForwarded(s));
}
namespace {
struct CheckGCThingAfterMovingGCFunctor {
template <class T> void operator()(T* t) { CheckGCThingAfterMovingGC(*t); }
@ -257,8 +250,7 @@ JSCompartment::checkWrapperMapAfterMovingGC()
MOZ_RELEASE_ASSERT(ptr.found() && &*ptr == &e.front());
}
}
#endif // JSGC_HASH_TABLE_CHECKS
#endif
bool
JSCompartment::putWrapper(JSContext* cx, const CrossCompartmentKey& wrapped,

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

@ -66,7 +66,7 @@ class DtoaCache {
}
#ifdef JSGC_HASH_TABLE_CHECKS
void checkCacheAfterMovingGC();
void checkCacheAfterMovingGC() { MOZ_ASSERT(!s || !IsForwarded(s)); }
#endif
};

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

@ -1163,9 +1163,9 @@ extern JS_FRIEND_API(unsigned)
GetEnterCompartmentDepth(JSContext* cx);
#endif
class RegExpGuard;
extern JS_FRIEND_API(bool)
RegExpToSharedNonInline(JSContext* cx, JS::HandleObject regexp,
JS::MutableHandle<RegExpShared*> shared);
RegExpToSharedNonInline(JSContext* cx, JS::HandleObject regexp, RegExpGuard* shared);
/* Implemented in CrossCompartmentWrapper.cpp. */
typedef enum NukeReferencesToWindow {

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

@ -367,12 +367,7 @@ static const FinalizePhase BackgroundFinalizePhases[] = {
},
{
gcstats::PHASE_SWEEP_SCOPE, {
AllocKind::SCOPE,
}
},
{
gcstats::PHASE_SWEEP_REGEXP_SHARED, {
AllocKind::REGEXP_SHARED,
AllocKind::SCOPE
}
},
{
@ -1727,6 +1722,7 @@ static const AllocKind AllocKindsToRelocate[] = {
AllocKind::OBJECT16_BACKGROUND,
AllocKind::SCRIPT,
AllocKind::LAZY_SCRIPT,
AllocKind::SCOPE,
AllocKind::SHAPE,
AllocKind::ACCESSOR_SHAPE,
AllocKind::BASE_SHAPE,
@ -1734,9 +1730,7 @@ static const AllocKind AllocKindsToRelocate[] = {
AllocKind::STRING,
AllocKind::EXTERNAL_STRING,
AllocKind::FAT_INLINE_ATOM,
AllocKind::ATOM,
AllocKind::SCOPE,
AllocKind::REGEXP_SHARED
AllocKind::ATOM
};
Arena*
@ -2060,23 +2054,61 @@ GCRuntime::relocateArenas(Zone* zone, JS::gcreason::Reason reason, Arena*& reloc
return true;
}
template <typename T>
inline void
MovingTracer::updateEdge(T** thingp)
void
MovingTracer::onObjectEdge(JSObject** objp)
{
auto thing = *thingp;
if (thing->runtimeFromAnyThread() == runtime() && IsForwarded(thing))
*thingp = Forwarded(thing);
JSObject* obj = *objp;
if (obj->runtimeFromAnyThread() == runtime() && IsForwarded(obj))
*objp = Forwarded(obj);
}
void MovingTracer::onObjectEdge(JSObject** objp) { updateEdge(objp); }
void MovingTracer::onShapeEdge(Shape** shapep) { updateEdge(shapep); }
void MovingTracer::onStringEdge(JSString** stringp) { updateEdge(stringp); }
void MovingTracer::onScriptEdge(JSScript** scriptp) { updateEdge(scriptp); }
void MovingTracer::onLazyScriptEdge(LazyScript** lazyp) { updateEdge(lazyp); }
void MovingTracer::onBaseShapeEdge(BaseShape** basep) { updateEdge(basep); }
void MovingTracer::onScopeEdge(Scope** scopep) { updateEdge(scopep); }
void MovingTracer::onRegExpSharedEdge(RegExpShared** sharedp) { updateEdge(sharedp); }
void
MovingTracer::onShapeEdge(Shape** shapep)
{
Shape* shape = *shapep;
if (shape->runtimeFromAnyThread() == runtime() && IsForwarded(shape))
*shapep = Forwarded(shape);
}
void
MovingTracer::onStringEdge(JSString** stringp)
{
JSString* string = *stringp;
if (string->runtimeFromAnyThread() == runtime() && IsForwarded(string))
*stringp = Forwarded(string);
}
void
MovingTracer::onScriptEdge(JSScript** scriptp)
{
JSScript* script = *scriptp;
if (script->runtimeFromAnyThread() == runtime() && IsForwarded(script))
*scriptp = Forwarded(script);
}
void
MovingTracer::onLazyScriptEdge(LazyScript** lazyp)
{
LazyScript* lazy = *lazyp;
if (lazy->runtimeFromAnyThread() == runtime() && IsForwarded(lazy))
*lazyp = Forwarded(lazy);
}
void
MovingTracer::onBaseShapeEdge(BaseShape** basep)
{
BaseShape* base = *basep;
if (base->runtimeFromAnyThread() == runtime() && IsForwarded(base))
*basep = Forwarded(base);
}
void
MovingTracer::onScopeEdge(Scope** scopep)
{
Scope* scope = *scopep;
if (scope->runtimeFromAnyThread() == runtime() && IsForwarded(scope))
*scopep = Forwarded(scope);
}
void
Zone::prepareForCompacting()

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

@ -121,7 +121,6 @@ IsNurseryAllocable(AllocKind kind)
false, /* AllocKind::SYMBOL */
false, /* AllocKind::JITCODE */
false, /* AllocKind::SCOPE */
false, /* AllocKind::REGEXP_SHARED */
};
JS_STATIC_ASSERT(JS_ARRAY_LENGTH(map) == size_t(AllocKind::LIMIT));
return map[size_t(kind)];
@ -160,7 +159,6 @@ IsBackgroundFinalized(AllocKind kind)
true, /* AllocKind::SYMBOL */
false, /* AllocKind::JITCODE */
true, /* AllocKind::SCOPE */
true, /* AllocKind::REGEXP_SHARED */
};
JS_STATIC_ASSERT(JS_ARRAY_LENGTH(map) == size_t(AllocKind::LIMIT));
return map[size_t(kind)];
@ -1138,29 +1136,109 @@ class RelocationOverlay
// to allow slots to be accessed.
template <typename T>
inline bool IsForwarded(T* t);
inline bool IsForwarded(const JS::Value& value);
struct MightBeForwarded
{
static_assert(mozilla::IsBaseOf<Cell, T>::value,
"T must derive from Cell");
static_assert(!mozilla::IsSame<Cell, T>::value && !mozilla::IsSame<TenuredCell, T>::value,
"T must not be Cell or TenuredCell");
static const bool value = mozilla::IsBaseOf<JSObject, T>::value ||
mozilla::IsBaseOf<Shape, T>::value ||
mozilla::IsBaseOf<BaseShape, T>::value ||
mozilla::IsBaseOf<JSString, T>::value ||
mozilla::IsBaseOf<JSScript, T>::value ||
mozilla::IsBaseOf<js::LazyScript, T>::value ||
mozilla::IsBaseOf<js::Scope, T>::value;
};
template <typename T>
inline T* Forwarded(T* t);
inline bool
IsForwarded(T* t)
{
RelocationOverlay* overlay = RelocationOverlay::fromCell(t);
if (!MightBeForwarded<T>::value) {
MOZ_ASSERT(!overlay->isForwarded());
return false;
}
inline Value Forwarded(const JS::Value& value);
return overlay->isForwarded();
}
struct IsForwardedFunctor : public BoolDefaultAdaptor<Value, false> {
template <typename T> bool operator()(T* t) { return IsForwarded(t); }
};
inline bool
IsForwarded(const JS::Value& value)
{
return DispatchTyped(IsForwardedFunctor(), value);
}
template <typename T>
inline T MaybeForwarded(T t);
inline T*
Forwarded(T* t)
{
RelocationOverlay* overlay = RelocationOverlay::fromCell(t);
MOZ_ASSERT(overlay->isForwarded());
return reinterpret_cast<T*>(overlay->forwardingAddress());
}
struct ForwardedFunctor : public IdentityDefaultAdaptor<Value> {
template <typename T> inline Value operator()(T* t) {
return js::gc::RewrapTaggedPointer<Value, T>::wrap(Forwarded(t));
}
};
inline Value
Forwarded(const JS::Value& value)
{
return DispatchTyped(ForwardedFunctor(), value);
}
template <typename T>
inline T
MaybeForwarded(T t)
{
if (IsForwarded(t))
t = Forwarded(t);
MakeAccessibleAfterMovingGC(t);
return t;
}
#ifdef JSGC_HASH_TABLE_CHECKS
template <typename T>
inline bool IsGCThingValidAfterMovingGC(T* t);
inline bool
IsGCThingValidAfterMovingGC(T* t)
{
return !IsInsideNursery(t) && !RelocationOverlay::isCellForwarded(t);
}
template <typename T>
inline void CheckGCThingAfterMovingGC(T* t);
inline void
CheckGCThingAfterMovingGC(T* t)
{
if (t)
MOZ_RELEASE_ASSERT(IsGCThingValidAfterMovingGC(t));
}
template <typename T>
inline void CheckGCThingAfterMovingGC(const ReadBarriered<T*>& t);
inline void
CheckGCThingAfterMovingGC(const ReadBarriered<T*>& t)
{
CheckGCThingAfterMovingGC(t.unbarrieredGet());
}
inline void CheckValueAfterMovingGC(const JS::Value& value);
struct CheckValueAfterMovingGCFunctor : public VoidDefaultAdaptor<Value> {
template <typename T> void operator()(T* t) { CheckGCThingAfterMovingGC(t); }
};
inline void
CheckValueAfterMovingGC(const JS::Value& value)
{
DispatchTyped(CheckValueAfterMovingGCFunctor(), value);
}
#endif // JSGC_HASH_TABLE_CHECKS

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

@ -488,114 +488,6 @@ RelocationOverlay::forwardTo(Cell* cell)
newLocation_ = cell;
}
template <typename T>
struct MightBeForwarded
{
static_assert(mozilla::IsBaseOf<Cell, T>::value,
"T must derive from Cell");
static_assert(!mozilla::IsSame<Cell, T>::value && !mozilla::IsSame<TenuredCell, T>::value,
"T must not be Cell or TenuredCell");
static const bool value = mozilla::IsBaseOf<JSObject, T>::value ||
mozilla::IsBaseOf<Shape, T>::value ||
mozilla::IsBaseOf<BaseShape, T>::value ||
mozilla::IsBaseOf<JSString, T>::value ||
mozilla::IsBaseOf<JSScript, T>::value ||
mozilla::IsBaseOf<js::LazyScript, T>::value ||
mozilla::IsBaseOf<js::Scope, T>::value ||
mozilla::IsBaseOf<js::RegExpShared, T>::value;
};
template <typename T>
inline bool
IsForwarded(T* t)
{
RelocationOverlay* overlay = RelocationOverlay::fromCell(t);
if (!MightBeForwarded<T>::value) {
MOZ_ASSERT(!overlay->isForwarded());
return false;
}
return overlay->isForwarded();
}
struct IsForwardedFunctor : public BoolDefaultAdaptor<Value, false> {
template <typename T> bool operator()(T* t) { return IsForwarded(t); }
};
inline bool
IsForwarded(const JS::Value& value)
{
return DispatchTyped(IsForwardedFunctor(), value);
}
template <typename T>
inline T*
Forwarded(T* t)
{
RelocationOverlay* overlay = RelocationOverlay::fromCell(t);
MOZ_ASSERT(overlay->isForwarded());
return reinterpret_cast<T*>(overlay->forwardingAddress());
}
struct ForwardedFunctor : public IdentityDefaultAdaptor<Value> {
template <typename T> inline Value operator()(T* t) {
return js::gc::RewrapTaggedPointer<Value, T>::wrap(Forwarded(t));
}
};
inline Value
Forwarded(const JS::Value& value)
{
return DispatchTyped(ForwardedFunctor(), value);
}
template <typename T>
inline T
MaybeForwarded(T t)
{
if (IsForwarded(t))
t = Forwarded(t);
MakeAccessibleAfterMovingGC(t);
return t;
}
#ifdef JSGC_HASH_TABLE_CHECKS
template <typename T>
inline bool
IsGCThingValidAfterMovingGC(T* t)
{
return !IsInsideNursery(t) && !RelocationOverlay::isCellForwarded(t);
}
template <typename T>
inline void
CheckGCThingAfterMovingGC(T* t)
{
if (t)
MOZ_RELEASE_ASSERT(IsGCThingValidAfterMovingGC(t));
}
template <typename T>
inline void
CheckGCThingAfterMovingGC(const ReadBarriered<T*>& t)
{
CheckGCThingAfterMovingGC(t.unbarrieredGet());
}
struct CheckValueAfterMovingGCFunctor : public VoidDefaultAdaptor<Value> {
template <typename T> void operator()(T* t) { CheckGCThingAfterMovingGC(t); }
};
inline void
CheckValueAfterMovingGC(const JS::Value& value)
{
DispatchTyped(CheckValueAfterMovingGCFunctor(), value);
}
#endif // JSGC_HASH_TABLE_CHECKS
} /* namespace gc */
} /* namespace js */

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

@ -118,7 +118,7 @@ class JS_FRIEND_API(Wrapper) : public BaseProxyHandler
virtual JSString* fun_toString(JSContext* cx, HandleObject proxy,
unsigned indent) const override;
virtual bool regexp_toShared(JSContext* cx, HandleObject proxy,
MutableHandle<RegExpShared*> shared) const override;
RegExpGuard* g) const override;
virtual bool boxedValue_unbox(JSContext* cx, HandleObject proxy,
MutableHandleValue vp) const override;
virtual bool isCallable(JSObject* obj) const override;
@ -213,8 +213,7 @@ class JS_FRIEND_API(CrossCompartmentWrapper) : public Wrapper
virtual const char* className(JSContext* cx, HandleObject proxy) const override;
virtual JSString* fun_toString(JSContext* cx, HandleObject wrapper,
unsigned indent) const override;
virtual bool regexp_toShared(JSContext* cx, HandleObject proxy,
MutableHandle<RegExpShared*> shared) const override;
virtual bool regexp_toShared(JSContext* cx, HandleObject proxy, RegExpGuard* g) const override;
virtual bool boxedValue_unbox(JSContext* cx, HandleObject proxy, MutableHandleValue vp) const override;
// Allocate CrossCompartmentWrappers in the nursery.
@ -312,8 +311,7 @@ class JS_FRIEND_API(SecurityWrapper) : public Base
const CallArgs& args) const override;
virtual bool getBuiltinClass(JSContext* cx, HandleObject wrapper, ESClass* cls) const override;
virtual bool isArray(JSContext* cx, HandleObject wrapper, JS::IsArrayAnswer* answer) const override;
virtual bool regexp_toShared(JSContext* cx, HandleObject proxy,
MutableHandle<RegExpShared*> shared) const override;
virtual bool regexp_toShared(JSContext* cx, HandleObject proxy, RegExpGuard* g) const override;
virtual bool boxedValue_unbox(JSContext* cx, HandleObject proxy, MutableHandleValue vp) const override;
// Allow isCallable and isConstructor. They used to be class-level, and so could not be guarded

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

@ -327,7 +327,7 @@ BaseProxyHandler::fun_toString(JSContext* cx, HandleObject proxy, unsigned inden
bool
BaseProxyHandler::regexp_toShared(JSContext* cx, HandleObject proxy,
MutableHandleRegExpShared shared) const
RegExpGuard* g) const
{
MOZ_CRASH("This should have been a wrapped regexp");
}

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

@ -458,19 +458,19 @@ CrossCompartmentWrapper::fun_toString(JSContext* cx, HandleObject wrapper, unsig
}
bool
CrossCompartmentWrapper::regexp_toShared(JSContext* cx, HandleObject wrapper,
MutableHandleRegExpShared shared) const
CrossCompartmentWrapper::regexp_toShared(JSContext* cx, HandleObject wrapper, RegExpGuard* g) const
{
RootedRegExpShared re(cx);
RegExpGuard wrapperGuard(cx);
{
AutoCompartment call(cx, wrappedObject(wrapper));
if (!Wrapper::regexp_toShared(cx, wrapper, &re))
if (!Wrapper::regexp_toShared(cx, wrapper, &wrapperGuard))
return false;
}
// Get an equivalent RegExpShared associated with the current compartment.
RegExpShared* re = wrapperGuard.re();
cx->markAtom(re->getSource());
return cx->compartment()->regExps.get(cx, re->getSource(), re->getFlags(), shared);
return cx->compartment()->regExps.get(cx, re->getSource(), re->getFlags(), g);
}
bool

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

@ -142,8 +142,7 @@ DeadObjectProxy::fun_toString(JSContext* cx, HandleObject proxy, unsigned indent
}
bool
DeadObjectProxy::regexp_toShared(JSContext* cx, HandleObject proxy,
MutableHandle<RegExpShared*> shared) const
DeadObjectProxy::regexp_toShared(JSContext* cx, HandleObject proxy, RegExpGuard* g) const
{
ReportDead(cx);
return false;

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

@ -49,8 +49,7 @@ class DeadObjectProxy : public BaseProxyHandler
virtual bool isArray(JSContext* cx, HandleObject proxy, JS::IsArrayAnswer* answer) const override;
virtual const char* className(JSContext* cx, HandleObject proxy) const override;
virtual JSString* fun_toString(JSContext* cx, HandleObject proxy, unsigned indent) const override;
virtual bool regexp_toShared(JSContext* cx, HandleObject proxy,
MutableHandle<RegExpShared*> shared) const override;
virtual bool regexp_toShared(JSContext* cx, HandleObject proxy, RegExpGuard* g) const override;
static const char family;
static const DeadObjectProxy singleton;

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

@ -559,11 +559,11 @@ Proxy::fun_toString(JSContext* cx, HandleObject proxy, unsigned indent)
}
bool
Proxy::regexp_toShared(JSContext* cx, HandleObject proxy, MutableHandleRegExpShared shared)
Proxy::regexp_toShared(JSContext* cx, HandleObject proxy, RegExpGuard* g)
{
if (!CheckRecursionLimit(cx))
return false;
return proxy->as<ProxyObject>().handler()->regexp_toShared(cx, proxy, shared);
return proxy->as<ProxyObject>().handler()->regexp_toShared(cx, proxy, g);
}
bool

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

@ -13,6 +13,8 @@
namespace js {
class RegExpGuard;
/*
* Dispatch point for handlers that executes the appropriate C++ or scripted traps.
*
@ -60,8 +62,7 @@ class Proxy
static bool isArray(JSContext* cx, HandleObject proxy, JS::IsArrayAnswer* answer);
static const char* className(JSContext* cx, HandleObject proxy);
static JSString* fun_toString(JSContext* cx, HandleObject proxy, unsigned indent);
static bool regexp_toShared(JSContext* cx, HandleObject proxy,
MutableHandle<RegExpShared*> shared);
static bool regexp_toShared(JSContext* cx, HandleObject proxy, RegExpGuard* g);
static bool boxedValue_unbox(JSContext* cx, HandleObject proxy, MutableHandleValue vp);
static bool watch(JSContext* cx, HandleObject proxy, HandleId id, HandleObject callable);

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

@ -1268,8 +1268,7 @@ ScriptedProxyHandler::fun_toString(JSContext* cx, HandleObject proxy, unsigned i
}
bool
ScriptedProxyHandler::regexp_toShared(JSContext* cx, HandleObject proxy,
MutableHandleRegExpShared shared) const
ScriptedProxyHandler::regexp_toShared(JSContext* cx, HandleObject proxy, RegExpGuard* g) const
{
MOZ_CRASH("Should not end up in ScriptedProxyHandler::regexp_toShared");
return false;

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

@ -70,7 +70,7 @@ class ScriptedProxyHandler : public BaseProxyHandler
virtual JSString* fun_toString(JSContext* cx, HandleObject proxy,
unsigned indent) const override;
virtual bool regexp_toShared(JSContext* cx, HandleObject proxy,
MutableHandle<RegExpShared*> shared) const override;
RegExpGuard* g) const override;
virtual bool boxedValue_unbox(JSContext* cx, HandleObject proxy,
MutableHandleValue vp) const override;

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

@ -88,10 +88,9 @@ SecurityWrapper<Base>::isArray(JSContext* cx, HandleObject obj, JS::IsArrayAnswe
template <class Base>
bool
SecurityWrapper<Base>::regexp_toShared(JSContext* cx, HandleObject obj,
MutableHandle<RegExpShared*> shared) const
SecurityWrapper<Base>::regexp_toShared(JSContext* cx, HandleObject obj, RegExpGuard* g) const
{
return Base::regexp_toShared(cx, obj, shared);
return Base::regexp_toShared(cx, obj, g);
}
template <class Base>

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

@ -268,10 +268,10 @@ Wrapper::fun_toString(JSContext* cx, HandleObject proxy, unsigned indent) const
}
bool
Wrapper::regexp_toShared(JSContext* cx, HandleObject proxy, MutableHandleRegExpShared shared) const
Wrapper::regexp_toShared(JSContext* cx, HandleObject proxy, RegExpGuard* g) const
{
RootedObject target(cx, proxy->as<ProxyObject>().target());
return RegExpToShared(cx, target, shared);
return RegExpToShared(cx, target, g);
}
bool

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

@ -19,8 +19,6 @@
#include "jit/JitFrames.h"
#include "vm/StringBuffer.h"
#include "jsgcinlines.h"
using namespace js;
using mozilla::DebugOnly;

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

@ -598,13 +598,6 @@ StatsCellCallback(JSRuntime* rt, void* data, void* thing, JS::TraceKind traceKin
break;
}
case JS::TraceKind::RegExpShared: {
auto regexp = static_cast<RegExpShared*>(thing);
zStats->regExpSharedsGCHeap += thingSize;
zStats->regExpSharedsMallocHeap += regexp->sizeOfExcludingThis(rtStats->mallocSizeOf_);
break;
}
default:
MOZ_CRASH("invalid traceKind in StatsCellCallback");
}

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

@ -9,7 +9,6 @@
#include "mozilla/MemoryReporting.h"
#include "mozilla/PodOperations.h"
#include "jshashutil.h"
#include "jsstr.h"
#ifdef DEBUG
#include "jsutil.h"
@ -120,16 +119,29 @@ VectorMatchPairs::allocOrExpandArray(size_t pairCount)
/* RegExpObject */
/* static */ bool
RegExpObject::getShared(JSContext* cx, Handle<RegExpObject*> regexp,
MutableHandleRegExpShared shared)
static inline void
RegExpSharedReadBarrier(JSContext* cx, RegExpShared* shared)
{
if (regexp->hasShared()) {
shared.set(regexp->sharedRef());
Zone* zone = cx->zone();
if (zone->needsIncrementalBarrier())
shared->trace(zone->barrierTracer());
if (shared->isMarkedGray())
shared->unmarkGray();
}
/* static */ bool
RegExpObject::getShared(JSContext* cx, Handle<RegExpObject*> regexp, RegExpGuard* g)
{
if (RegExpShared* shared = regexp->maybeShared()) {
// Fetching a RegExpShared from an object requires a read
// barrier, as the shared pointer might be weak.
RegExpSharedReadBarrier(cx, shared);
g->init(*shared);
return true;
}
return createShared(cx, regexp, shared);
return createShared(cx, regexp, g);
}
/* static */ bool
@ -162,32 +174,26 @@ RegExpObject::isOriginalFlagGetter(JSNative native, RegExpFlag* mask)
/* static */ void
RegExpObject::trace(JSTracer* trc, JSObject* obj)
{
obj->as<RegExpObject>().trace(trc);
}
RegExpShared* shared = obj->as<RegExpObject>().maybeShared();
if (!shared)
return;
static inline bool
IsMarkingTrace(JSTracer* trc)
{
// Determine whether tracing is happening during normal marking. We need to
// test all the following conditions, since:
//
// When tracing through the object normally, we have the option of
// unlinking the object from its RegExpShared so that the RegExpShared may
// be collected. To detect this we need to test all the following
// conditions, since:
// 1. During TraceRuntime, CurrentThreadIsHeapBusy() is true, but the
// tracer might not be a marking tracer.
// 2. When a write barrier executes, IsMarkingTracer is true, but
// CurrentThreadIsHeapBusy() will be false.
return JS::CurrentThreadIsHeapCollecting() && trc->isMarkingTracer();
}
void
RegExpObject::trace(JSTracer* trc)
{
// When marking the object normally we have the option of unlinking the
// object from its RegExpShared so that the RegExpShared may be collected.
if (IsMarkingTrace(trc) && !zone()->isPreservingCode())
sharedRef() = nullptr;
TraceNullableEdge(trc, &sharedRef(), "RegExpObject shared");
if (JS::CurrentThreadIsHeapCollecting() &&
trc->isMarkingTracer() &&
!obj->asTenured().zone()->isPreservingCode())
{
obj->as<RegExpObject>().NativeObject::setPrivate(nullptr);
} else {
shared->trace(trc);
}
}
static JSObject*
@ -274,14 +280,13 @@ RegExpObject::create(JSContext* cx, HandleAtom source, RegExpFlag flags,
}
/* static */ bool
RegExpObject::createShared(JSContext* cx, Handle<RegExpObject*> regexp,
MutableHandleRegExpShared shared)
RegExpObject::createShared(JSContext* cx, Handle<RegExpObject*> regexp, RegExpGuard* g)
{
MOZ_ASSERT(!regexp->hasShared());
if (!cx->compartment()->regExps.get(cx, regexp->getSource(), regexp->getFlags(), shared))
MOZ_ASSERT(!regexp->maybeShared());
if (!cx->compartment()->regExps.get(cx, regexp->getSource(), regexp->getFlags(), g))
return false;
regexp->setShared(*shared);
regexp->setShared(**g);
return true;
}
@ -889,11 +894,11 @@ RegExpShared::dumpBytecode(JSContext* cx, bool match_only, HandleLinearString in
RegExpObject::dumpBytecode(JSContext* cx, Handle<RegExpObject*> regexp,
bool match_only, HandleLinearString input)
{
RootedRegExpShared shared(cx);
if (!getShared(cx, regexp, &shared))
RegExpGuard g(cx);
if (!getShared(cx, regexp, &g))
return false;
return shared->dumpBytecode(cx, match_only, input);
return g.re()->dumpBytecode(cx, match_only, input);
}
#endif
@ -942,7 +947,7 @@ js::StringHasRegExpMetaChars(JSLinearString* str)
/* RegExpShared */
RegExpShared::RegExpShared(JSAtom* source, RegExpFlag flags)
: source(source), flags(flags), canStringMatch(false), parenCount(0)
: source(source), flags(flags), parenCount(0), canStringMatch(false), marked_(false)
{}
RegExpShared::~RegExpShared()
@ -952,22 +957,37 @@ RegExpShared::~RegExpShared()
}
void
RegExpShared::traceChildren(JSTracer* trc)
RegExpShared::trace(JSTracer* trc)
{
// Discard code to avoid holding onto ExecutablePools.
if (IsMarkingTrace(trc) && trc->runtime()->gc.isShrinkingGC())
discardJitCode();
if (trc->isMarkingTracer())
marked_ = true;
TraceNullableEdge(trc, &source, "RegExpShared source");
for (auto& comp : compilationArray)
TraceNullableEdge(trc, &comp.jitCode, "RegExpShared code");
}
void
RegExpShared::discardJitCode()
bool
RegExpShared::isMarkedGray() const
{
for (auto& comp : compilationArray)
comp.jitCode = nullptr;
if (source && source->isMarked(gc::GRAY))
return true;
for (const auto& comp : compilationArray) {
if (comp.jitCode && comp.jitCode->isMarked(gc::GRAY))
return true;
}
return false;
}
void
RegExpShared::unmarkGray()
{
if (source)
JS::UnmarkGrayGCThingRecursively(JS::GCCellPtr(source));
for (const auto& comp : compilationArray) {
if (comp.jitCode)
JS::UnmarkGrayGCThingRecursively(JS::GCCellPtr(comp.jitCode.get()));
}
}
bool
@ -1164,9 +1184,9 @@ RegExpShared::execute(JSContext* cx, HandleLinearString input, size_t start,
}
size_t
RegExpShared::sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf)
RegExpShared::sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf)
{
size_t n = 0;
size_t n = mallocSizeOf(this);
for (size_t i = 0; i < ArrayLength(compilationArray); i++) {
const RegExpCompilation& compilation = compilationArray[i];
@ -1183,8 +1203,8 @@ RegExpShared::sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf)
/* RegExpCompartment */
RegExpCompartment::RegExpCompartment(Zone* zone)
: set_(zone, Set(zone->runtimeFromActiveCooperatingThread())),
RegExpCompartment::RegExpCompartment(JSRuntime* rt)
: set_(rt),
matchResultTemplateObject_(nullptr),
optimizableRegExpPrototypeShape_(nullptr),
optimizableRegExpInstanceShape_(nullptr)
@ -1192,7 +1212,14 @@ RegExpCompartment::RegExpCompartment(Zone* zone)
RegExpCompartment::~RegExpCompartment()
{
MOZ_ASSERT_IF(set_.initialized(), set_.empty());
// Because of stray mark bits being set (see RegExpCompartment::sweep)
// there might still be RegExpShared instances which haven't been deleted.
if (set_.initialized()) {
for (Set::Enum e(set_); !e.empty(); e.popFront()) {
RegExpShared* shared = e.front();
js_delete(shared);
}
}
}
ArrayObject*
@ -1202,7 +1229,7 @@ RegExpCompartment::createMatchResultTemplateObject(JSContext* cx)
/* Create template array object */
RootedArrayObject templateObject(cx, NewDenseUnallocatedArray(cx, RegExpObject::MaxPairCount,
nullptr, TenuredObject));
nullptr, TenuredObject));
if (!templateObject)
return matchResultTemplateObject_; // = nullptr
@ -1258,9 +1285,59 @@ RegExpCompartment::init(JSContext* cx)
return true;
}
bool
RegExpShared::needsSweep(JSRuntime* rt)
{
// Sometimes RegExpShared instances are marked without the compartment
// being subsequently cleared. This can happen if a GC is restarted while
// in progress (i.e. performing a full GC in the middle of an incremental
// GC) or if a RegExpShared referenced via the stack is traced but is not
// in a zone being collected.
//
// Because of this we only treat the marked_ bit as a hint, and destroy the
// RegExpShared if it was accidentally marked earlier but wasn't marked by
// the current trace.
bool keep = marked() && IsMarked(rt, &source);
for (size_t i = 0; i < ArrayLength(compilationArray); i++) {
RegExpShared::RegExpCompilation& compilation = compilationArray[i];
if (compilation.jitCode && gc::IsAboutToBeFinalized(&compilation.jitCode))
keep = false;
}
MOZ_ASSERT(JS::CurrentThreadIsHeapMajorCollecting());
if (keep || rt->gc.isHeapCompacting()) {
clearMarked();
return false;
}
return true;
}
void
RegExpShared::discardJitCode()
{
for (size_t i = 0; i < ArrayLength(compilationArray); i++)
compilationArray[i].jitCode = nullptr;
}
void
RegExpCompartment::sweep(JSRuntime* rt)
{
if (!set_.initialized())
return;
for (Set::Enum e(set_); !e.empty(); e.popFront()) {
RegExpShared* shared = e.front();
if (shared->needsSweep(rt)) {
js_delete(shared);
e.removeFront();
} else {
// Discard code to avoid holding onto ExecutablePools.
if (rt->gc.isHeapCompacting())
shared->discardJitCode();
}
}
if (matchResultTemplateObject_ &&
IsAboutToBeFinalized(&matchResultTemplateObject_))
{
@ -1281,45 +1358,55 @@ RegExpCompartment::sweep(JSRuntime* rt)
}
bool
RegExpCompartment::get(JSContext* cx, JSAtom* source, RegExpFlag flags,
MutableHandleRegExpShared result)
RegExpCompartment::get(JSContext* cx, JSAtom* source, RegExpFlag flags, RegExpGuard* g)
{
DependentAddPtr<Set> p(cx, set_.get(), Key(source, flags));
Key key(source, flags);
Set::AddPtr p = set_.lookupForAdd(key);
if (p) {
result.set(*p);
// Trigger a read barrier on existing RegExpShared instances fetched
// from the table (which only holds weak references).
RegExpSharedReadBarrier(cx, *p);
g->init(**p);
return true;
}
auto shared = Allocate<RegExpShared>(cx);
ScopedJSDeletePtr<RegExpShared> shared(cx->new_<RegExpShared>(source, flags));
if (!shared)
return false;
new (shared) RegExpShared(source, flags);
if (!p.add(cx, set_.get(), Key(source, flags), shared)) {
if (!set_.add(p, shared)) {
ReportOutOfMemory(cx);
return false;
}
result.set(shared);
// Trace RegExpShared instances created during an incremental GC.
RegExpSharedReadBarrier(cx, shared);
g->init(*shared.forget());
return true;
}
bool
RegExpCompartment::get(JSContext* cx, HandleAtom atom, JSString* opt,
MutableHandleRegExpShared shared)
RegExpCompartment::get(JSContext* cx, HandleAtom atom, JSString* opt, RegExpGuard* g)
{
RegExpFlag flags = RegExpFlag(0);
if (opt && !ParseRegExpFlags(cx, opt, &flags))
return false;
return get(cx, atom, flags, shared);
return get(cx, atom, flags, g);
}
size_t
RegExpCompartment::sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf)
{
return set_.sizeOfExcludingThis(mallocSizeOf);
size_t n = 0;
n += set_.sizeOfExcludingThis(mallocSizeOf);
for (Set::Enum e(set_); !e.empty(); e.popFront()) {
RegExpShared* shared = e.front();
n += shared->sizeOfIncludingThis(mallocSizeOf);
}
return n;
}
/* Functions */
@ -1342,12 +1429,12 @@ js::CloneRegExpObject(JSContext* cx, JSObject* obj_)
Rooted<JSAtom*> source(cx, regex->getSource());
RootedRegExpShared shared(cx);
if (!RegExpObject::getShared(cx, regex, &shared))
RegExpGuard g(cx);
if (!RegExpObject::getShared(cx, regex, &g))
return nullptr;
clone->initAndZeroLastIndex(source, shared->getFlags(), cx);
clone->setShared(*shared);
clone->initAndZeroLastIndex(source, g->getFlags(), cx);
clone->setShared(*g.re());
return clone;
}
@ -1477,14 +1564,7 @@ js::CloneScriptRegExpObject(JSContext* cx, RegExpObject& reobj)
}
JS_FRIEND_API(bool)
js::RegExpToSharedNonInline(JSContext* cx, HandleObject obj, MutableHandleRegExpShared shared)
js::RegExpToSharedNonInline(JSContext* cx, HandleObject obj, js::RegExpGuard* g)
{
return RegExpToShared(cx, obj, shared);
}
JS::ubi::Node::Size
JS::ubi::Concrete<RegExpShared>::size(mozilla::MallocSizeOf mallocSizeOf) const
{
return js::gc::Arena::thingSize(gc::AllocKind::REGEXP_SHARED) +
get().sizeOfExcludingThis(mallocSizeOf);
return RegExpToShared(cx, obj, g);
}

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

@ -32,8 +32,10 @@
*
* To save memory, a RegExpShared is not created for a RegExpObject until it is
* needed for execution. When a RegExpShared needs to be created, it is looked
* up in a per-compartment table to allow reuse between objects. Lastly, on GC,
* every RegExpShared that is not in active use is discarded.
* up in a per-compartment table to allow reuse between objects. Lastly, on
* GC, every RegExpShared (that is not active on the callstack) is discarded.
* Because of the last point, any code using a RegExpShared (viz., by executing
* a regexp) must indicate the RegExpShared is active via RegExpGuard.
*/
namespace js {
@ -44,7 +46,7 @@ class RegExpStatics;
namespace frontend { class TokenStream; }
enum RegExpFlag : uint8_t
enum RegExpFlag
{
IgnoreCaseFlag = 0x01,
GlobalFlag = 0x02,
@ -90,7 +92,7 @@ CloneRegExpObject(JSContext* cx, JSObject* regexp);
* objects when we are preserving jitcode in their zone, to avoid the same
* recompilation inefficiencies as normal Ion and baseline compilation.
*/
class RegExpShared : public gc::TenuredCell
class RegExpShared
{
public:
enum CompilationMode {
@ -111,7 +113,7 @@ class RegExpShared : public gc::TenuredCell
struct RegExpCompilation
{
ReadBarriered<jit::JitCode*> jitCode;
HeapPtr<jit::JitCode*> jitCode;
uint8_t* byteCode;
RegExpCompilation() : byteCode(nullptr) {}
@ -123,11 +125,12 @@ class RegExpShared : public gc::TenuredCell
};
/* Source to the RegExp, for lazy compilation. */
HeapPtr<JSAtom*> source;
HeapPtr<JSAtom*> source;
RegExpFlag flags;
bool canStringMatch;
size_t parenCount;
bool canStringMatch;
bool marked_;
RegExpCompilation compilationArray[4];
@ -143,8 +146,6 @@ class RegExpShared : public gc::TenuredCell
Vector<uint8_t*, 0, SystemAllocPolicy> tables;
/* Internal functions. */
RegExpShared(JSAtom* source, RegExpFlag flags);
bool compile(JSContext* cx, HandleLinearString input,
CompilationMode mode, ForceByteCodeEnum force);
bool compile(JSContext* cx, HandleAtom pattern, HandleLinearString input,
@ -162,6 +163,7 @@ class RegExpShared : public gc::TenuredCell
}
public:
RegExpShared(JSAtom* source, RegExpFlag flags);
~RegExpShared();
// Execute this RegExp on input starting from searchIndex, filling in
@ -201,9 +203,16 @@ class RegExpShared : public gc::TenuredCell
|| isCompiled(MatchOnly, true) || isCompiled(MatchOnly, false);
}
void traceChildren(JSTracer* trc);
void trace(JSTracer* trc);
bool needsSweep(JSRuntime* rt);
void discardJitCode();
bool marked() const { return marked_; }
void clearMarked() { marked_ = false; }
bool isMarkedGray() const;
void unmarkGray();
static size_t offsetOfSource() {
return offsetof(RegExpShared, source);
}
@ -227,16 +236,59 @@ class RegExpShared : public gc::TenuredCell
+ offsetof(RegExpCompilation, jitCode);
}
size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf);
size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf);
#ifdef DEBUG
bool dumpBytecode(JSContext* cx, bool match_only, HandleLinearString input);
#endif
};
using RootedRegExpShared = JS::Rooted<RegExpShared*>;
using HandleRegExpShared = JS::Handle<RegExpShared*>;
using MutableHandleRegExpShared = JS::MutableHandle<RegExpShared*>;
/*
* Extend the lifetime of a given RegExpShared to at least the lifetime of
* the guard object. See Regular Expression comment at the top.
*/
class RegExpGuard : public JS::CustomAutoRooter
{
RegExpShared* re_;
RegExpGuard(const RegExpGuard&) = delete;
void operator=(const RegExpGuard&) = delete;
public:
explicit RegExpGuard(JSContext* cx)
: CustomAutoRooter(cx), re_(nullptr)
{}
RegExpGuard(JSContext* cx, RegExpShared& re)
: CustomAutoRooter(cx), re_(nullptr)
{
init(re);
}
~RegExpGuard() {
release();
}
public:
void init(RegExpShared& re) {
MOZ_ASSERT(!initialized());
re_ = &re;
}
void release() {
re_ = nullptr;
}
virtual void trace(JSTracer* trc) {
if (re_)
re_->trace(trc);
}
bool initialized() const { return !!re_; }
RegExpShared* re() const { MOZ_ASSERT(initialized()); return re_; }
RegExpShared* operator->() { return re(); }
RegExpShared& operator*() { return *re(); }
};
class RegExpCompartment
{
@ -248,9 +300,8 @@ class RegExpCompartment
Key(JSAtom* atom, RegExpFlag flag)
: atom(atom), flag(flag)
{ }
MOZ_IMPLICIT Key(const ReadBarriered<RegExpShared*>& shared)
: atom(shared.unbarrieredGet()->getSource()),
flag(shared.unbarrieredGet()->getFlags())
MOZ_IMPLICIT Key(RegExpShared* shared)
: atom(shared->getSource()), flag(shared->getFlags())
{ }
typedef Key Lookup;
@ -266,8 +317,8 @@ class RegExpCompartment
* The set of all RegExpShareds in the compartment. On every GC, every
* RegExpShared that was not marked is deleted and removed from the set.
*/
using Set = GCHashSet<ReadBarriered<RegExpShared*>, Key, RuntimeAllocPolicy>;
JS::WeakCache<Set> set_;
typedef HashSet<RegExpShared*, Key, RuntimeAllocPolicy> Set;
Set set_;
/*
* This is the template object where the result of re.exec() is based on,
@ -300,7 +351,7 @@ class RegExpCompartment
ArrayObject* createMatchResultTemplateObject(JSContext* cx);
public:
explicit RegExpCompartment(Zone* zone);
explicit RegExpCompartment(JSRuntime* rt);
~RegExpCompartment();
bool init(JSContext* cx);
@ -308,11 +359,10 @@ class RegExpCompartment
bool empty() { return set_.empty(); }
bool get(JSContext* cx, JSAtom* source, RegExpFlag flags, MutableHandleRegExpShared shared);
bool get(JSContext* cx, JSAtom* source, RegExpFlag flags, RegExpGuard* g);
/* Like 'get', but compile 'maybeOpt' (if non-null). */
bool get(JSContext* cx, HandleAtom source, JSString* maybeOpt,
MutableHandleRegExpShared shared);
bool get(JSContext* cx, HandleAtom source, JSString* maybeOpt, RegExpGuard* g);
/* Get or create template object used to base the result of .exec() on. */
ArrayObject* getOrCreateMatchResultTemplateObject(JSContext* cx) {
@ -434,19 +484,14 @@ class RegExpObject : public NativeObject
static bool isOriginalFlagGetter(JSNative native, RegExpFlag* mask);
static MOZ_MUST_USE bool getShared(JSContext* cx, Handle<RegExpObject*> regexp,
MutableHandleRegExpShared shared);
bool hasShared() {
return !!sharedRef();
}
RegExpGuard* g);
void setShared(RegExpShared& shared) {
MOZ_ASSERT(!hasShared());
sharedRef() = &shared;
MOZ_ASSERT(!maybeShared());
NativeObject::setPrivate(&shared);
}
static void trace(JSTracer* trc, JSObject* obj);
void trace(JSTracer* trc);
void initIgnoringLastIndex(HandleAtom source, RegExpFlag flags);
@ -466,11 +511,9 @@ class RegExpObject : public NativeObject
* Side effect: sets the private field.
*/
static MOZ_MUST_USE bool createShared(JSContext* cx, Handle<RegExpObject*> regexp,
MutableHandleRegExpShared shared);
ReadBarriered<RegExpShared*>& sharedRef() {
auto& ref = NativeObject::privateRef(PRIVATE_SLOT);
return reinterpret_cast<ReadBarriered<RegExpShared*>&>(ref);
RegExpGuard* g);
RegExpShared* maybeShared() const {
return static_cast<RegExpShared*>(NativeObject::getPrivate(PRIVATE_SLOT));
}
/* Call setShared in preference to setPrivate. */
@ -488,12 +531,12 @@ ParseRegExpFlags(JSContext* cx, JSString* flagStr, RegExpFlag* flagsOut);
/* Assuming GetBuiltinClass(obj) is ESClass::RegExp, return a RegExpShared for obj. */
inline bool
RegExpToShared(JSContext* cx, HandleObject obj, MutableHandleRegExpShared shared)
RegExpToShared(JSContext* cx, HandleObject obj, RegExpGuard* g)
{
if (obj->is<RegExpObject>())
return RegExpObject::getShared(cx, obj.as<RegExpObject>(), shared);
return RegExpObject::getShared(cx, obj.as<RegExpObject>(), g);
return Proxy::regexp_toShared(cx, obj, shared);
return Proxy::regexp_toShared(cx, obj, g);
}
template<XDRMode mode>
@ -516,29 +559,4 @@ StringHasRegExpMetaChars(JSLinearString* str);
} /* namespace js */
namespace JS {
namespace ubi {
template <>
class Concrete<js::RegExpShared> : TracerConcrete<js::RegExpShared>
{
protected:
explicit Concrete(js::RegExpShared* ptr) : TracerConcrete<js::RegExpShared>(ptr) { }
public:
static void construct(void* storage, js::RegExpShared* ptr) {
new (storage) Concrete(ptr);
}
CoarseType coarseType() const final { return CoarseType::Other; }
Size size(mozilla::MallocSizeOf mallocSizeOf) const override;
const char16_t* typeName() const override { return concreteTypeName; }
static const char16_t concreteTypeName[];
};
} // namespace ubi
} // namespace JS
#endif /* vm_RegExpObject_h */

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

@ -81,8 +81,8 @@ RegExpStatics::executeLazy(JSContext* cx)
MOZ_ASSERT(lazyIndex != size_t(-1));
/* Retrieve or create the RegExpShared in this compartment. */
RootedRegExpShared shared(cx);
if (!cx->compartment()->regExps.get(cx, lazySource, lazyFlags, &shared))
RegExpGuard g(cx);
if (!cx->compartment()->regExps.get(cx, lazySource, lazyFlags, &g))
return false;
/*
@ -92,7 +92,7 @@ RegExpStatics::executeLazy(JSContext* cx)
/* Execute the full regular expression. */
RootedLinearString input(cx, matchesInput);
RegExpRunStatus status = shared->execute(cx, input, lazyIndex, &this->matches, nullptr);
RegExpRunStatus status = g->execute(cx, input, lazyIndex, &this->matches, nullptr);
if (status == RegExpRunStatus_Error)
return false;

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

@ -19,7 +19,6 @@
#include "jsatominlines.h"
#include "jscntxtinlines.h"
#include "jsgcinlines.h"
namespace js {

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

@ -1413,7 +1413,7 @@ JSStructuredCloneWriter::startWrite(HandleValue v)
return false;
if (cls == ESClass::RegExp) {
RootedRegExpShared re(context());
RegExpGuard re(context());
if (!RegExpToShared(context(), obj, &re))
return false;
return out.writePair(SCTAG_REGEXP_OBJECT, re->getFlags()) &&

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

@ -312,7 +312,6 @@ template JS::Zone* TracerConcrete<js::LazyScript>::zone() const;
template JS::Zone* TracerConcrete<js::Shape>::zone() const;
template JS::Zone* TracerConcrete<js::BaseShape>::zone() const;
template JS::Zone* TracerConcrete<js::ObjectGroup>::zone() const;
template JS::Zone* TracerConcrete<js::RegExpShared>::zone() const;
template JS::Zone* TracerConcrete<js::Scope>::zone() const;
template JS::Zone* TracerConcrete<JS::Symbol>::zone() const;
template JS::Zone* TracerConcrete<JSString>::zone() const;
@ -335,7 +334,6 @@ template UniquePtr<EdgeRange> TracerConcrete<js::LazyScript>::edges(JSContext* c
template UniquePtr<EdgeRange> TracerConcrete<js::Shape>::edges(JSContext* cx, bool wantNames) const;
template UniquePtr<EdgeRange> TracerConcrete<js::BaseShape>::edges(JSContext* cx, bool wantNames) const;
template UniquePtr<EdgeRange> TracerConcrete<js::ObjectGroup>::edges(JSContext* cx, bool wantNames) const;
template UniquePtr<EdgeRange> TracerConcrete<js::RegExpShared>::edges(JSContext* cx, bool wantNames) const;
template UniquePtr<EdgeRange> TracerConcrete<js::Scope>::edges(JSContext* cx, bool wantNames) const;
template UniquePtr<EdgeRange> TracerConcrete<JS::Symbol>::edges(JSContext* cx, bool wantNames) const;
template UniquePtr<EdgeRange> TracerConcrete<JSString>::edges(JSContext* cx, bool wantNames) const;
@ -400,7 +398,6 @@ const char16_t Concrete<js::Shape>::concreteTypeName[] = u"js::Shape";
const char16_t Concrete<js::BaseShape>::concreteTypeName[] = u"js::BaseShape";
const char16_t Concrete<js::ObjectGroup>::concreteTypeName[] = u"js::ObjectGroup";
const char16_t Concrete<js::Scope>::concreteTypeName[] = u"js::Scope";
const char16_t Concrete<js::RegExpShared>::concreteTypeName[] = u"js::RegExpShared";
namespace JS {
namespace ubi {

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

@ -1944,14 +1944,6 @@ 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.");
@ -2986,10 +2978,6 @@ 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'.");
@ -3041,10 +3029,6 @@ 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.

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

@ -483,10 +483,7 @@ void TraceScriptHolder(nsISupports* aHolder, JSTracer* aTracer);
// Returns true if the JS::TraceKind is one the cycle collector cares about.
inline bool AddToCCKind(JS::TraceKind aKind)
{
return aKind == JS::TraceKind::Object ||
aKind == JS::TraceKind::Script ||
aKind == JS::TraceKind::Scope ||
aKind == JS::TraceKind::RegExpShared;
return aKind == JS::TraceKind::Object || aKind == JS::TraceKind::Script || aKind == JS::TraceKind::Scope;
}
bool