mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1167453 - Rename JSGCTraceKind and make it a C++11 enum class; r=jonco
This commit is contained in:
parent
ebcaaf0cb2
commit
7b1f37d23c
@ -2411,7 +2411,7 @@ IsInCertifiedApp(JSContext* aCx, JSObject* aObj)
|
||||
#ifdef DEBUG
|
||||
void
|
||||
VerifyTraceProtoAndIfaceCacheCalled(JS::CallbackTracer *trc, void **thingp,
|
||||
JSGCTraceKind kind)
|
||||
JS::TraceKind kind)
|
||||
{
|
||||
// We don't do anything here, we only want to verify that
|
||||
// TraceProtoAndIfaceCache was called.
|
||||
|
@ -528,7 +528,7 @@ AllocateProtoAndIfaceCache(JSObject* obj, ProtoAndIfaceCache::Kind aKind)
|
||||
#ifdef DEBUG
|
||||
void
|
||||
VerifyTraceProtoAndIfaceCacheCalled(JS::CallbackTracer *trc, void **thingp,
|
||||
JSGCTraceKind kind);
|
||||
JS::TraceKind kind);
|
||||
|
||||
struct VerifyTraceProtoAndIfaceCacheCalledTracer : public JS::CallbackTracer
|
||||
{
|
||||
|
@ -553,7 +553,7 @@ class JS_PUBLIC_API(AutoCheckCannotGC) : public AutoAssertOnGC
|
||||
|
||||
/*
|
||||
* Unsets the gray bit for anything reachable from |thing|. |kind| should not be
|
||||
* JSTRACE_SHAPE. |thing| should be non-null.
|
||||
* JS::TraceKind::Shape. |thing| should be non-null.
|
||||
*/
|
||||
extern JS_FRIEND_API(bool)
|
||||
UnmarkGrayGCThingRecursively(GCCellPtr thing);
|
||||
@ -566,7 +566,7 @@ namespace gc {
|
||||
static MOZ_ALWAYS_INLINE void
|
||||
ExposeGCThingToActiveJS(JS::GCCellPtr thing)
|
||||
{
|
||||
MOZ_ASSERT(thing.kind() != JSTRACE_SHAPE);
|
||||
MOZ_ASSERT(thing.kind() != JS::TraceKind::Shape);
|
||||
|
||||
/*
|
||||
* GC things residing in the nursery cannot be gray: they have no mark bits.
|
||||
|
@ -81,10 +81,10 @@ const uintptr_t ChunkLocationAnyNursery = ChunkLocationBitNursery;
|
||||
#ifdef JS_DEBUG
|
||||
/* When downcasting, ensure we are actually the right type. */
|
||||
extern JS_FRIEND_API(void)
|
||||
AssertGCThingHasType(js::gc::Cell* cell, JSGCTraceKind kind);
|
||||
AssertGCThingHasType(js::gc::Cell* cell, JS::TraceKind kind);
|
||||
#else
|
||||
inline void
|
||||
AssertGCThingHasType(js::gc::Cell* cell, JSGCTraceKind kind) {}
|
||||
AssertGCThingHasType(js::gc::Cell* cell, JS::TraceKind kind) {}
|
||||
#endif
|
||||
|
||||
MOZ_ALWAYS_INLINE bool IsInsideNursery(const js::gc::Cell* cell);
|
||||
@ -155,60 +155,60 @@ class JS_FRIEND_API(GCCellPtr)
|
||||
{
|
||||
public:
|
||||
// Construction from a void* and trace kind.
|
||||
GCCellPtr(void* gcthing, JSGCTraceKind traceKind) : ptr(checkedCast(gcthing, traceKind)) {}
|
||||
GCCellPtr(void* gcthing, JS::TraceKind traceKind) : ptr(checkedCast(gcthing, traceKind)) {}
|
||||
|
||||
// Automatically construct a null GCCellPtr from nullptr.
|
||||
MOZ_IMPLICIT GCCellPtr(decltype(nullptr)) : ptr(checkedCast(nullptr, JSTRACE_NULL)) {}
|
||||
MOZ_IMPLICIT GCCellPtr(decltype(nullptr)) : ptr(checkedCast(nullptr, JS::TraceKind::Null)) {}
|
||||
|
||||
// Construction from an explicit type.
|
||||
explicit GCCellPtr(JSObject* obj) : ptr(checkedCast(obj, JSTRACE_OBJECT)) { }
|
||||
explicit GCCellPtr(JSFunction* fun) : ptr(checkedCast(fun, JSTRACE_OBJECT)) { }
|
||||
explicit GCCellPtr(JSString* str) : ptr(checkedCast(str, JSTRACE_STRING)) { }
|
||||
explicit GCCellPtr(JSFlatString* str) : ptr(checkedCast(str, JSTRACE_STRING)) { }
|
||||
explicit GCCellPtr(JSScript* script) : ptr(checkedCast(script, JSTRACE_SCRIPT)) { }
|
||||
explicit GCCellPtr(JSObject* obj) : ptr(checkedCast(obj, JS::TraceKind::Object)) { }
|
||||
explicit GCCellPtr(JSFunction* fun) : ptr(checkedCast(fun, JS::TraceKind::Object)) { }
|
||||
explicit GCCellPtr(JSString* str) : ptr(checkedCast(str, JS::TraceKind::String)) { }
|
||||
explicit GCCellPtr(JSFlatString* str) : ptr(checkedCast(str, JS::TraceKind::String)) { }
|
||||
explicit GCCellPtr(JSScript* script) : ptr(checkedCast(script, JS::TraceKind::Script)) { }
|
||||
explicit GCCellPtr(const Value& v);
|
||||
|
||||
JSGCTraceKind kind() const {
|
||||
JSGCTraceKind traceKind = JSGCTraceKind(ptr & JSTRACE_OUTOFLINE);
|
||||
if (traceKind != JSTRACE_OUTOFLINE)
|
||||
JS::TraceKind kind() const {
|
||||
JS::TraceKind traceKind = JS::TraceKind(ptr & OutOfLineTraceKindMask);
|
||||
if (uintptr_t(traceKind) != OutOfLineTraceKindMask)
|
||||
return traceKind;
|
||||
return outOfLineKind();
|
||||
}
|
||||
|
||||
// Allow GCCellPtr to be used in a boolean context.
|
||||
explicit operator bool() const {
|
||||
MOZ_ASSERT(bool(asCell()) == (kind() != JSTRACE_NULL));
|
||||
MOZ_ASSERT(bool(asCell()) == (kind() != JS::TraceKind::Null));
|
||||
return asCell();
|
||||
}
|
||||
|
||||
// Simplify checks to the kind.
|
||||
bool isObject() const { return kind() == JSTRACE_OBJECT; }
|
||||
bool isScript() const { return kind() == JSTRACE_SCRIPT; }
|
||||
bool isString() const { return kind() == JSTRACE_STRING; }
|
||||
bool isSymbol() const { return kind() == JSTRACE_SYMBOL; }
|
||||
bool isShape() const { return kind() == JSTRACE_SHAPE; }
|
||||
bool isObjectGroup() const { return kind() == JSTRACE_OBJECT_GROUP; }
|
||||
bool isObject() const { return kind() == JS::TraceKind::Object; }
|
||||
bool isScript() const { return kind() == JS::TraceKind::Script; }
|
||||
bool isString() const { return kind() == JS::TraceKind::String; }
|
||||
bool isSymbol() const { return kind() == JS::TraceKind::Symbol; }
|
||||
bool isShape() const { return kind() == JS::TraceKind::Shape; }
|
||||
bool isObjectGroup() const { return kind() == JS::TraceKind::ObjectGroup; }
|
||||
|
||||
// Conversions to more specific types must match the kind. Access to
|
||||
// further refined types is not allowed directly from a GCCellPtr.
|
||||
JSObject* toObject() const {
|
||||
MOZ_ASSERT(kind() == JSTRACE_OBJECT);
|
||||
MOZ_ASSERT(kind() == JS::TraceKind::Object);
|
||||
return reinterpret_cast<JSObject*>(asCell());
|
||||
}
|
||||
JSString* toString() const {
|
||||
MOZ_ASSERT(kind() == JSTRACE_STRING);
|
||||
MOZ_ASSERT(kind() == JS::TraceKind::String);
|
||||
return reinterpret_cast<JSString*>(asCell());
|
||||
}
|
||||
JSScript* toScript() const {
|
||||
MOZ_ASSERT(kind() == JSTRACE_SCRIPT);
|
||||
MOZ_ASSERT(kind() == JS::TraceKind::Script);
|
||||
return reinterpret_cast<JSScript*>(asCell());
|
||||
}
|
||||
Symbol* toSymbol() const {
|
||||
MOZ_ASSERT(kind() == JSTRACE_SYMBOL);
|
||||
MOZ_ASSERT(kind() == JS::TraceKind::Symbol);
|
||||
return reinterpret_cast<Symbol*>(asCell());
|
||||
}
|
||||
js::gc::Cell* asCell() const {
|
||||
return reinterpret_cast<js::gc::Cell*>(ptr & ~JSTRACE_OUTOFLINE);
|
||||
return reinterpret_cast<js::gc::Cell*>(ptr & ~OutOfLineTraceKindMask);
|
||||
}
|
||||
|
||||
// The CC's trace logger needs an identity that is XPIDL serializable.
|
||||
@ -225,18 +225,18 @@ class JS_FRIEND_API(GCCellPtr)
|
||||
bool mayBeOwnedByOtherRuntime() const;
|
||||
|
||||
private:
|
||||
uintptr_t checkedCast(void* p, JSGCTraceKind traceKind) {
|
||||
static uintptr_t checkedCast(void* p, JS::TraceKind traceKind) {
|
||||
js::gc::Cell* cell = static_cast<js::gc::Cell*>(p);
|
||||
MOZ_ASSERT((uintptr_t(p) & JSTRACE_OUTOFLINE) == 0);
|
||||
MOZ_ASSERT((uintptr_t(p) & OutOfLineTraceKindMask) == 0);
|
||||
AssertGCThingHasType(cell, traceKind);
|
||||
// Note: the JSTRACE_OUTOFLINE bits are set on all out-of-line kinds
|
||||
// Note: the OutOfLineTraceKindMask bits are set on all out-of-line kinds
|
||||
// so that we can mask instead of branching.
|
||||
MOZ_ASSERT_IF(traceKind >= JSTRACE_OUTOFLINE,
|
||||
(traceKind & JSTRACE_OUTOFLINE) == JSTRACE_OUTOFLINE);
|
||||
return uintptr_t(p) | (traceKind & JSTRACE_OUTOFLINE);
|
||||
MOZ_ASSERT_IF(uintptr_t(traceKind) >= OutOfLineTraceKindMask,
|
||||
(uintptr_t(traceKind) & OutOfLineTraceKindMask) == OutOfLineTraceKindMask);
|
||||
return uintptr_t(p) | (uintptr_t(traceKind) & OutOfLineTraceKindMask);
|
||||
}
|
||||
|
||||
JSGCTraceKind outOfLineKind() const;
|
||||
JS::TraceKind outOfLineKind() const;
|
||||
|
||||
uintptr_t ptr;
|
||||
};
|
||||
|
@ -141,9 +141,9 @@ JSID_TO_GCTHING(jsid id)
|
||||
{
|
||||
void* thing = (void*)(JSID_BITS(id) & ~(size_t)JSID_TYPE_MASK);
|
||||
if (JSID_IS_STRING(id))
|
||||
return JS::GCCellPtr(thing, JSTRACE_STRING);
|
||||
return JS::GCCellPtr(thing, JS::TraceKind::String);
|
||||
MOZ_ASSERT(JSID_IS_SYMBOL(id));
|
||||
return JS::GCCellPtr(thing, JSTRACE_SYMBOL);
|
||||
return JS::GCCellPtr(thing, JS::TraceKind::Symbol);
|
||||
}
|
||||
|
||||
static MOZ_ALWAYS_INLINE bool
|
||||
|
@ -463,17 +463,17 @@ struct GCThingSizes
|
||||
dummy()
|
||||
{}
|
||||
|
||||
void addToKind(JSGCTraceKind kind, intptr_t n) {
|
||||
void addToKind(JS::TraceKind kind, intptr_t n) {
|
||||
switch (kind) {
|
||||
case JSTRACE_OBJECT: object += n; break;
|
||||
case JSTRACE_STRING: string += n; break;
|
||||
case JSTRACE_SYMBOL: symbol += n; break;
|
||||
case JSTRACE_SCRIPT: script += n; break;
|
||||
case JSTRACE_SHAPE: shape += n; break;
|
||||
case JSTRACE_BASE_SHAPE: baseShape += n; break;
|
||||
case JSTRACE_JITCODE: jitcode += n; break;
|
||||
case JSTRACE_LAZY_SCRIPT: lazyScript += n; break;
|
||||
case JSTRACE_OBJECT_GROUP: objectGroup += 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;
|
||||
default:
|
||||
MOZ_CRASH("Bad trace kind for GCThingSizes");
|
||||
}
|
||||
|
@ -18,7 +18,6 @@ namespace JS {
|
||||
class JS_PUBLIC_API(CallbackTracer);
|
||||
template <typename T> class Heap;
|
||||
template <typename T> class TenuredHeap;
|
||||
}
|
||||
|
||||
// When tracing a thing, the GC needs to know about the layout of the object it
|
||||
// is looking at. There are a fixed number of different layouts that the GC
|
||||
@ -29,41 +28,40 @@ template <typename T> class TenuredHeap;
|
||||
// the matching C++ types are exposed, and those that are, are opaque.
|
||||
//
|
||||
// See Value::gcKind() and JSTraceCallback in Tracer.h for more details.
|
||||
enum JSGCTraceKind
|
||||
enum class TraceKind
|
||||
{
|
||||
// These trace kinds have a publicly exposed, although opaque, C++ type.
|
||||
// Note: The order here is determined by our Value packing. Other users
|
||||
// should sort alphabetically, for consistency.
|
||||
JSTRACE_OBJECT = 0x00,
|
||||
JSTRACE_STRING = 0x01,
|
||||
JSTRACE_SYMBOL = 0x02,
|
||||
JSTRACE_SCRIPT = 0x03,
|
||||
Object = 0x00,
|
||||
String = 0x01,
|
||||
Symbol = 0x02,
|
||||
Script = 0x03,
|
||||
|
||||
// Shape details are exposed through JS_TraceShapeCycleCollectorChildren.
|
||||
JSTRACE_SHAPE = 0x04,
|
||||
Shape = 0x04,
|
||||
|
||||
// ObjectGroup details are exposed through JS_TraceObjectGroupCycleCollectorChildren.
|
||||
JSTRACE_OBJECT_GROUP = 0x05,
|
||||
ObjectGroup = 0x05,
|
||||
|
||||
// The kind associated with a nullptr.
|
||||
JSTRACE_NULL = 0x06,
|
||||
|
||||
// A kind that indicates the real kind should be looked up in the arena.
|
||||
JSTRACE_OUTOFLINE = 0x07,
|
||||
Null = 0x06,
|
||||
|
||||
// The following kinds do not have an exposed C++ idiom.
|
||||
JSTRACE_BASE_SHAPE = 0x0F,
|
||||
JSTRACE_JITCODE = 0x1F,
|
||||
JSTRACE_LAZY_SCRIPT = 0x2F,
|
||||
|
||||
JSTRACE_LAST = JSTRACE_OBJECT_GROUP
|
||||
BaseShape = 0x0F,
|
||||
JitCode = 0x1F,
|
||||
LazyScript = 0x2F
|
||||
};
|
||||
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");
|
||||
|
||||
namespace JS {
|
||||
// Returns a static string equivalent of |kind|.
|
||||
JS_FRIEND_API(const char*)
|
||||
GCTraceKindToAscii(JSGCTraceKind kind);
|
||||
}
|
||||
GCTraceKindToAscii(JS::TraceKind kind);
|
||||
|
||||
} // namespace JS
|
||||
|
||||
// Tracer callback, called for each traceable thing directly referenced by a
|
||||
// particular object or runtime structure. It is the callback responsibility
|
||||
@ -71,16 +69,16 @@ GCTraceKindToAscii(JSGCTraceKind kind);
|
||||
// JS_TraceChildren on the passed thing. In this case the callback must be
|
||||
// prepared to deal with cycles in the traversal graph.
|
||||
//
|
||||
// kind argument is one of JSTRACE_OBJECT, JSTRACE_STRING or a tag denoting
|
||||
// internal implementation-specific traversal kind. In the latter case the only
|
||||
// operations on thing that the callback can do is to call JS_TraceChildren or
|
||||
// JS_GetTraceThingInfo.
|
||||
// kind argument is one of JS::TraceKind::Object, JS::TraceKind::String or a
|
||||
// tag denoting internal implementation-specific traversal kind. In the latter
|
||||
// case the only operations on thing that the callback can do is to call
|
||||
// JS_TraceChildren or JS_GetTraceThingInfo.
|
||||
//
|
||||
// If eagerlyTraceWeakMaps is true, when we trace a WeakMap visit all
|
||||
// of its mappings. This should be used in cases where the tracer
|
||||
// wants to use the existing liveness of entries.
|
||||
typedef void
|
||||
(* JSTraceCallback)(JS::CallbackTracer* trc, void** thingp, JSGCTraceKind kind);
|
||||
(* JSTraceCallback)(JS::CallbackTracer* trc, void** thingp, JS::TraceKind kind);
|
||||
|
||||
enum WeakMapTraceKind {
|
||||
DoNotTraceWeakMaps = 0,
|
||||
@ -146,7 +144,7 @@ class JS_PUBLIC_API(CallbackTracer) : public JSTracer
|
||||
}
|
||||
|
||||
// Call the callback.
|
||||
void invoke(void** thing, JSGCTraceKind kind) {
|
||||
void invoke(void** thing, JS::TraceKind kind) {
|
||||
callback(this, thing, kind);
|
||||
}
|
||||
|
||||
@ -350,7 +348,7 @@ extern JS_PUBLIC_API(void)
|
||||
JS_CallTenuredObjectTracer(JSTracer* trc, JS::TenuredHeap<JSObject*>* objp, const char* name);
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_TraceChildren(JSTracer* trc, void* thing, JSGCTraceKind kind);
|
||||
JS_TraceChildren(JSTracer* trc, void* thing, JS::TraceKind kind);
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_TraceRuntime(JSTracer* trc);
|
||||
@ -366,6 +364,6 @@ JS_TraceIncomingCCWs(JSTracer* trc, const JS::ZoneSet& zones);
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_GetTraceThingInfo(char* buf, size_t bufsize, JSTracer* trc,
|
||||
void* thing, JSGCTraceKind kind, bool includeDetails);
|
||||
void* thing, JS::TraceKind kind, bool includeDetails);
|
||||
|
||||
#endif /* js_TracingAPI_h */
|
||||
|
@ -302,7 +302,7 @@ class Node {
|
||||
// JS::ubi::Node are both essentially tagged references to other sorts of
|
||||
// objects, so letting conversions happen automatically is appropriate.
|
||||
MOZ_IMPLICIT Node(JS::HandleValue value);
|
||||
Node(JSGCTraceKind kind, void* ptr);
|
||||
Node(JS::TraceKind kind, void* ptr);
|
||||
|
||||
// copy construction and copy assignment just use memcpy, since we know
|
||||
// instances contain nothing but a vtable pointer and a data pointer.
|
||||
|
@ -613,12 +613,12 @@ JSVAL_TO_GCTHING_IMPL(jsval_layout l)
|
||||
static inline uint32_t
|
||||
JSVAL_TRACE_KIND_IMPL(jsval_layout l)
|
||||
{
|
||||
static_assert((JSVAL_TAG_STRING & 0x03) == JSTRACE_STRING,
|
||||
"Value type tags must correspond with JSGCTraceKinds.");
|
||||
static_assert((JSVAL_TAG_SYMBOL & 0x03) == JSTRACE_SYMBOL,
|
||||
"Value type tags must correspond with JSGCTraceKinds.");
|
||||
static_assert((JSVAL_TAG_OBJECT & 0x03) == JSTRACE_OBJECT,
|
||||
"Value type tags must correspond with JSGCTraceKinds.");
|
||||
static_assert((JSVAL_TAG_STRING & 0x03) == size_t(JS::TraceKind::String),
|
||||
"Value type tags must correspond with JS::TraceKinds.");
|
||||
static_assert((JSVAL_TAG_SYMBOL & 0x03) == size_t(JS::TraceKind::Symbol),
|
||||
"Value type tags must correspond with JS::TraceKinds.");
|
||||
static_assert((JSVAL_TAG_OBJECT & 0x03) == size_t(JS::TraceKind::Object),
|
||||
"Value type tags must correspond with JS::TraceKinds.");
|
||||
return l.s.tag & 0x03;
|
||||
}
|
||||
|
||||
@ -854,12 +854,12 @@ JSVAL_TO_GCTHING_IMPL(jsval_layout l)
|
||||
static inline uint32_t
|
||||
JSVAL_TRACE_KIND_IMPL(jsval_layout l)
|
||||
{
|
||||
static_assert((JSVAL_TAG_STRING & 0x03) == JSTRACE_STRING,
|
||||
"Value type tags must correspond with JSGCTraceKinds.");
|
||||
static_assert((JSVAL_TAG_SYMBOL & 0x03) == JSTRACE_SYMBOL,
|
||||
"Value type tags must correspond with JSGCTraceKinds.");
|
||||
static_assert((JSVAL_TAG_OBJECT & 0x03) == JSTRACE_OBJECT,
|
||||
"Value type tags must correspond with JSGCTraceKinds.");
|
||||
static_assert((JSVAL_TAG_STRING & 0x03) == size_t(JS::TraceKind::String),
|
||||
"Value type tags must correspond with JS::TraceKinds.");
|
||||
static_assert((JSVAL_TAG_SYMBOL & 0x03) == size_t(JS::TraceKind::Symbol),
|
||||
"Value type tags must correspond with JS::TraceKinds.");
|
||||
static_assert((JSVAL_TAG_OBJECT & 0x03) == size_t(JS::TraceKind::Object),
|
||||
"Value type tags must correspond with JS::TraceKinds.");
|
||||
return (uint32_t)(l.asBits >> JSVAL_TAG_SHIFT) & 0x03;
|
||||
}
|
||||
|
||||
@ -1179,9 +1179,9 @@ class Value
|
||||
return JSVAL_IS_TRACEABLE_IMPL(data);
|
||||
}
|
||||
|
||||
JSGCTraceKind gcKind() const {
|
||||
JS::TraceKind traceKind() const {
|
||||
MOZ_ASSERT(isMarkable());
|
||||
return JSGCTraceKind(JSVAL_TRACE_KIND_IMPL(data));
|
||||
return JS::TraceKind(JSVAL_TRACE_KIND_IMPL(data));
|
||||
}
|
||||
|
||||
JSWhyMagic whyMagic() const {
|
||||
@ -1249,7 +1249,7 @@ class Value
|
||||
}
|
||||
|
||||
GCCellPtr toGCCellPtr() const {
|
||||
return GCCellPtr(toGCThing(), gcKind());
|
||||
return GCCellPtr(toGCThing(), traceKind());
|
||||
}
|
||||
|
||||
bool toBoolean() const {
|
||||
|
@ -804,7 +804,7 @@ NondeterministicGetWeakMapKeys(JSContext* cx, unsigned argc, jsval* vp)
|
||||
|
||||
struct JSCountHeapNode {
|
||||
void* thing;
|
||||
JSGCTraceKind kind;
|
||||
JS::TraceKind kind;
|
||||
JSCountHeapNode* next;
|
||||
};
|
||||
|
||||
@ -822,7 +822,7 @@ class CountHeapTracer : public JS::CallbackTracer
|
||||
};
|
||||
|
||||
static void
|
||||
CountHeapNotify(JS::CallbackTracer* trc, void** thingp, JSGCTraceKind kind)
|
||||
CountHeapNotify(JS::CallbackTracer* trc, void** thingp, JS::TraceKind kind)
|
||||
{
|
||||
CountHeapTracer* countTracer = (CountHeapTracer*)trc;
|
||||
void* thing = *thingp;
|
||||
@ -857,12 +857,12 @@ CountHeapNotify(JS::CallbackTracer* trc, void** thingp, JSGCTraceKind kind)
|
||||
|
||||
static const struct TraceKindPair {
|
||||
const char* name;
|
||||
int32_t kind;
|
||||
int32_t kind;
|
||||
} traceKindNames[] = {
|
||||
{ "all", -1 },
|
||||
{ "object", JSTRACE_OBJECT },
|
||||
{ "string", JSTRACE_STRING },
|
||||
{ "symbol", JSTRACE_SYMBOL },
|
||||
{ "all", -1 },
|
||||
{ "object", int32_t(JS::TraceKind::Object) },
|
||||
{ "string", int32_t(JS::TraceKind::String) },
|
||||
{ "symbol", int32_t(JS::TraceKind::Symbol) },
|
||||
};
|
||||
|
||||
static bool
|
||||
@ -941,7 +941,7 @@ CountHeap(JSContext* cx, unsigned argc, jsval* vp)
|
||||
while ((node = countTracer.traceList) != nullptr) {
|
||||
if (traceThing == nullptr) {
|
||||
// We are looking for all nodes with a specific kind
|
||||
if (traceKind == -1 || node->kind == traceKind)
|
||||
if (traceKind == -1 || int32_t(node->kind) == traceKind)
|
||||
counter++;
|
||||
} else {
|
||||
// We are looking for some specific thing
|
||||
|
@ -219,38 +219,6 @@ CurrentThreadIsHandlingInitFailure();
|
||||
|
||||
namespace gc {
|
||||
|
||||
template <typename T> struct MapTypeToTraceKind {};
|
||||
template <> struct MapTypeToTraceKind<NativeObject> { static const JSGCTraceKind kind = JSTRACE_OBJECT; };
|
||||
template <> struct MapTypeToTraceKind<ArrayObject> { static const JSGCTraceKind kind = JSTRACE_OBJECT; };
|
||||
template <> struct MapTypeToTraceKind<ArgumentsObject> { static const JSGCTraceKind kind = JSTRACE_OBJECT; };
|
||||
template <> struct MapTypeToTraceKind<ArrayBufferObject>{ static const JSGCTraceKind kind = JSTRACE_OBJECT; };
|
||||
template <> struct MapTypeToTraceKind<ArrayBufferObjectMaybeShared>{ static const JSGCTraceKind kind = JSTRACE_OBJECT; };
|
||||
template <> struct MapTypeToTraceKind<ArrayBufferViewObject>{ static const JSGCTraceKind kind = JSTRACE_OBJECT; };
|
||||
template <> struct MapTypeToTraceKind<BaseShape> { static const JSGCTraceKind kind = JSTRACE_BASE_SHAPE; };
|
||||
template <> struct MapTypeToTraceKind<DebugScopeObject> { static const JSGCTraceKind kind = JSTRACE_OBJECT; };
|
||||
template <> struct MapTypeToTraceKind<GlobalObject> { static const JSGCTraceKind kind = JSTRACE_OBJECT; };
|
||||
template <> struct MapTypeToTraceKind<JS::Symbol> { static const JSGCTraceKind kind = JSTRACE_SYMBOL; };
|
||||
template <> struct MapTypeToTraceKind<JSAtom> { static const JSGCTraceKind kind = JSTRACE_STRING; };
|
||||
template <> struct MapTypeToTraceKind<JSFlatString> { static const JSGCTraceKind kind = JSTRACE_STRING; };
|
||||
template <> struct MapTypeToTraceKind<JSFunction> { static const JSGCTraceKind kind = JSTRACE_OBJECT; };
|
||||
template <> struct MapTypeToTraceKind<JSLinearString> { static const JSGCTraceKind kind = JSTRACE_STRING; };
|
||||
template <> struct MapTypeToTraceKind<JSObject> { static const JSGCTraceKind kind = JSTRACE_OBJECT; };
|
||||
template <> struct MapTypeToTraceKind<JSScript> { static const JSGCTraceKind kind = JSTRACE_SCRIPT; };
|
||||
template <> struct MapTypeToTraceKind<JSString> { static const JSGCTraceKind kind = JSTRACE_STRING; };
|
||||
template <> struct MapTypeToTraceKind<LazyScript> { static const JSGCTraceKind kind = JSTRACE_LAZY_SCRIPT; };
|
||||
template <> struct MapTypeToTraceKind<NestedScopeObject>{ static const JSGCTraceKind kind = JSTRACE_OBJECT; };
|
||||
template <> struct MapTypeToTraceKind<PlainObject> { static const JSGCTraceKind kind = JSTRACE_OBJECT; };
|
||||
template <> struct MapTypeToTraceKind<PropertyName> { static const JSGCTraceKind kind = JSTRACE_STRING; };
|
||||
template <> struct MapTypeToTraceKind<SavedFrame> { static const JSGCTraceKind kind = JSTRACE_OBJECT; };
|
||||
template <> struct MapTypeToTraceKind<ScopeObject> { static const JSGCTraceKind kind = JSTRACE_OBJECT; };
|
||||
template <> struct MapTypeToTraceKind<Shape> { static const JSGCTraceKind kind = JSTRACE_SHAPE; };
|
||||
template <> struct MapTypeToTraceKind<AccessorShape> { static const JSGCTraceKind kind = JSTRACE_SHAPE; };
|
||||
template <> struct MapTypeToTraceKind<SharedArrayBufferObject>{ static const JSGCTraceKind kind = JSTRACE_OBJECT; };
|
||||
template <> struct MapTypeToTraceKind<SharedTypedArrayObject>{ static const JSGCTraceKind kind = JSTRACE_OBJECT; };
|
||||
template <> struct MapTypeToTraceKind<UnownedBaseShape> { static const JSGCTraceKind kind = JSTRACE_BASE_SHAPE; };
|
||||
template <> struct MapTypeToTraceKind<jit::JitCode> { static const JSGCTraceKind kind = JSTRACE_JITCODE; };
|
||||
template <> struct MapTypeToTraceKind<ObjectGroup> { static const JSGCTraceKind kind = JSTRACE_OBJECT_GROUP; };
|
||||
|
||||
// Marking.h depends on these barrier definitions, so we need a separate
|
||||
// entry point for marking to implement the pre-barrier.
|
||||
void MarkValueForBarrier(JSTracer* trc, Value* v, const char* name);
|
||||
|
@ -141,7 +141,7 @@ CheckHashTablesAfterMovingGC(JSRuntime* rt);
|
||||
struct MovingTracer : JS::CallbackTracer {
|
||||
explicit MovingTracer(JSRuntime* rt) : CallbackTracer(rt, Visit, TraceWeakMapKeysValues) {}
|
||||
|
||||
static void Visit(JS::CallbackTracer* jstrc, void** thingp, JSGCTraceKind kind);
|
||||
static void Visit(JS::CallbackTracer* jstrc, void** thingp, JS::TraceKind kind);
|
||||
static bool IsMovingTracer(JSTracer* trc) {
|
||||
return trc->isCallbackTracer() && trc->asCallbackTracer()->hasCallback(Visit);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ CurrentThreadIsIonCompiling();
|
||||
#endif
|
||||
|
||||
extern bool
|
||||
UnmarkGrayCellRecursively(gc::Cell* cell, JSGCTraceKind kind);
|
||||
UnmarkGrayCellRecursively(gc::Cell* cell, JS::TraceKind kind);
|
||||
|
||||
extern void
|
||||
TraceManuallyBarrieredGenericPointerEdge(JSTracer* trc, gc::Cell** thingp, const char* name);
|
||||
@ -169,35 +169,35 @@ template<typename ValueType> using AllAllocKindArray =
|
||||
template<typename ValueType> using ObjectAllocKindArray =
|
||||
mozilla::EnumeratedArray<AllocKind, AllocKind::OBJECT_LIMIT, ValueType>;
|
||||
|
||||
static inline JSGCTraceKind
|
||||
static inline JS::TraceKind
|
||||
MapAllocToTraceKind(AllocKind kind)
|
||||
{
|
||||
static const JSGCTraceKind map[] = {
|
||||
JSTRACE_OBJECT, /* AllocKind::FUNCTION */
|
||||
JSTRACE_OBJECT, /* AllocKind::FUNCTION_EXTENDED */
|
||||
JSTRACE_OBJECT, /* AllocKind::OBJECT0 */
|
||||
JSTRACE_OBJECT, /* AllocKind::OBJECT0_BACKGROUND */
|
||||
JSTRACE_OBJECT, /* AllocKind::OBJECT2 */
|
||||
JSTRACE_OBJECT, /* AllocKind::OBJECT2_BACKGROUND */
|
||||
JSTRACE_OBJECT, /* AllocKind::OBJECT4 */
|
||||
JSTRACE_OBJECT, /* AllocKind::OBJECT4_BACKGROUND */
|
||||
JSTRACE_OBJECT, /* AllocKind::OBJECT8 */
|
||||
JSTRACE_OBJECT, /* AllocKind::OBJECT8_BACKGROUND */
|
||||
JSTRACE_OBJECT, /* AllocKind::OBJECT12 */
|
||||
JSTRACE_OBJECT, /* AllocKind::OBJECT12_BACKGROUND */
|
||||
JSTRACE_OBJECT, /* AllocKind::OBJECT16 */
|
||||
JSTRACE_OBJECT, /* AllocKind::OBJECT16_BACKGROUND */
|
||||
JSTRACE_SCRIPT, /* AllocKind::SCRIPT */
|
||||
JSTRACE_LAZY_SCRIPT, /* AllocKind::LAZY_SCRIPT */
|
||||
JSTRACE_SHAPE, /* AllocKind::SHAPE */
|
||||
JSTRACE_SHAPE, /* AllocKind::ACCESSOR_SHAPE */
|
||||
JSTRACE_BASE_SHAPE, /* AllocKind::BASE_SHAPE */
|
||||
JSTRACE_OBJECT_GROUP, /* AllocKind::OBJECT_GROUP */
|
||||
JSTRACE_STRING, /* AllocKind::FAT_INLINE_STRING */
|
||||
JSTRACE_STRING, /* AllocKind::STRING */
|
||||
JSTRACE_STRING, /* AllocKind::EXTERNAL_STRING */
|
||||
JSTRACE_SYMBOL, /* AllocKind::SYMBOL */
|
||||
JSTRACE_JITCODE, /* AllocKind::JITCODE */
|
||||
static const JS::TraceKind map[] = {
|
||||
JS::TraceKind::Object, /* AllocKind::FUNCTION */
|
||||
JS::TraceKind::Object, /* AllocKind::FUNCTION_EXTENDED */
|
||||
JS::TraceKind::Object, /* AllocKind::OBJECT0 */
|
||||
JS::TraceKind::Object, /* AllocKind::OBJECT0_BACKGROUND */
|
||||
JS::TraceKind::Object, /* AllocKind::OBJECT2 */
|
||||
JS::TraceKind::Object, /* AllocKind::OBJECT2_BACKGROUND */
|
||||
JS::TraceKind::Object, /* AllocKind::OBJECT4 */
|
||||
JS::TraceKind::Object, /* AllocKind::OBJECT4_BACKGROUND */
|
||||
JS::TraceKind::Object, /* AllocKind::OBJECT8 */
|
||||
JS::TraceKind::Object, /* AllocKind::OBJECT8_BACKGROUND */
|
||||
JS::TraceKind::Object, /* AllocKind::OBJECT12 */
|
||||
JS::TraceKind::Object, /* AllocKind::OBJECT12_BACKGROUND */
|
||||
JS::TraceKind::Object, /* AllocKind::OBJECT16 */
|
||||
JS::TraceKind::Object, /* AllocKind::OBJECT16_BACKGROUND */
|
||||
JS::TraceKind::Script, /* AllocKind::SCRIPT */
|
||||
JS::TraceKind::LazyScript, /* AllocKind::LAZY_SCRIPT */
|
||||
JS::TraceKind::Shape, /* AllocKind::SHAPE */
|
||||
JS::TraceKind::Shape, /* AllocKind::ACCESSOR_SHAPE */
|
||||
JS::TraceKind::BaseShape, /* AllocKind::BASE_SHAPE */
|
||||
JS::TraceKind::ObjectGroup, /* AllocKind::OBJECT_GROUP */
|
||||
JS::TraceKind::String, /* AllocKind::FAT_INLINE_STRING */
|
||||
JS::TraceKind::String, /* AllocKind::STRING */
|
||||
JS::TraceKind::String, /* AllocKind::EXTERNAL_STRING */
|
||||
JS::TraceKind::Symbol, /* AllocKind::SYMBOL */
|
||||
JS::TraceKind::JitCode, /* AllocKind::JITCODE */
|
||||
};
|
||||
|
||||
static_assert(MOZ_ARRAY_LENGTH(map) == size_t(AllocKind::LIMIT),
|
||||
@ -235,7 +235,7 @@ struct Cell
|
||||
|
||||
inline StoreBuffer* storeBuffer() const;
|
||||
|
||||
inline JSGCTraceKind getTraceKind() const;
|
||||
inline JS::TraceKind getTraceKind() const;
|
||||
|
||||
static MOZ_ALWAYS_INLINE bool needWriteBarrierPre(JS::Zone* zone);
|
||||
|
||||
@ -270,7 +270,7 @@ class TenuredCell : public Cell
|
||||
// Access to the arena header.
|
||||
inline ArenaHeader* arenaHeader() const;
|
||||
inline AllocKind getAllocKind() const;
|
||||
inline JSGCTraceKind getTraceKind() const;
|
||||
inline JS::TraceKind getTraceKind() const;
|
||||
inline JS::Zone* zone() const;
|
||||
inline JS::Zone* zoneFromAnyThread() const;
|
||||
inline bool isInsideZone(JS::Zone* zone) const;
|
||||
@ -1316,10 +1316,10 @@ Cell::storeBuffer() const
|
||||
return chunk()->info.trailer.storeBuffer;
|
||||
}
|
||||
|
||||
inline JSGCTraceKind
|
||||
inline JS::TraceKind
|
||||
Cell::getTraceKind() const
|
||||
{
|
||||
return isTenured() ? asTenured().getTraceKind() : JSTRACE_OBJECT;
|
||||
return isTenured() ? asTenured().getTraceKind() : JS::TraceKind::Object;
|
||||
}
|
||||
|
||||
inline bool
|
||||
@ -1401,7 +1401,7 @@ TenuredCell::getAllocKind() const
|
||||
return arenaHeader()->getAllocKind();
|
||||
}
|
||||
|
||||
JSGCTraceKind
|
||||
JS::TraceKind
|
||||
TenuredCell::getTraceKind() const
|
||||
{
|
||||
return MapAllocToTraceKind(getAllocKind());
|
||||
@ -1463,7 +1463,7 @@ static MOZ_ALWAYS_INLINE void
|
||||
AssertValidToSkipBarrier(TenuredCell* thing)
|
||||
{
|
||||
MOZ_ASSERT(!IsInsideNursery(thing));
|
||||
MOZ_ASSERT_IF(thing, MapAllocToTraceKind(thing->getAllocKind()) != JSTRACE_OBJECT);
|
||||
MOZ_ASSERT_IF(thing, MapAllocToTraceKind(thing->getAllocKind()) != JS::TraceKind::Object);
|
||||
}
|
||||
|
||||
/* static */ MOZ_ALWAYS_INLINE void
|
||||
|
@ -39,7 +39,7 @@ IterateCompartmentsArenasCells(JSRuntime* rt, Zone* zone, void* data,
|
||||
(*compartmentCallback)(rt, data, comp);
|
||||
|
||||
for (auto thingKind : AllAllocKinds()) {
|
||||
JSGCTraceKind traceKind = MapAllocToTraceKind(thingKind);
|
||||
JS::TraceKind traceKind = MapAllocToTraceKind(thingKind);
|
||||
size_t thingSize = Arena::thingSize(thingKind);
|
||||
|
||||
for (ArenaIter aiter(zone, thingKind); !aiter.done(); aiter.next()) {
|
||||
|
@ -337,13 +337,6 @@ AssertRootMarkingPhase(JSTracer* trc)
|
||||
|
||||
/*** Tracing Interface ***************************************************************************/
|
||||
|
||||
// A C++ version of JSGCTraceKind
|
||||
enum class TraceKind {
|
||||
#define NAMES(name, _, __) name,
|
||||
FOR_EACH_GC_LAYOUT(NAMES)
|
||||
#undef NAMES
|
||||
};
|
||||
|
||||
#define FOR_EACH_GC_POINTER_TYPE(D) \
|
||||
D(AccessorShape*) \
|
||||
D(BaseShape*) \
|
||||
@ -392,18 +385,18 @@ FOR_EACH_GC_LAYOUT(NAMES)
|
||||
// BaseGCType<UnownedBaseShape>::type => BaseShape
|
||||
// etc.
|
||||
template <typename T,
|
||||
TraceKind = IsBaseOf<JSObject, T>::value ? TraceKind::Object
|
||||
: IsBaseOf<JSString, T>::value ? TraceKind::String
|
||||
: IsBaseOf<JS::Symbol, T>::value ? TraceKind::Symbol
|
||||
: IsBaseOf<JSScript, T>::value ? TraceKind::Script
|
||||
: IsBaseOf<Shape, T>::value ? TraceKind::Shape
|
||||
: IsBaseOf<BaseShape, T>::value ? TraceKind::BaseShape
|
||||
: IsBaseOf<jit::JitCode, T>::value ? TraceKind::JitCode
|
||||
: IsBaseOf<LazyScript, T>::value ? TraceKind::LazyScript
|
||||
: TraceKind::ObjectGroup>
|
||||
JS::TraceKind = IsBaseOf<JSObject, T>::value ? JS::TraceKind::Object
|
||||
: IsBaseOf<JSString, T>::value ? JS::TraceKind::String
|
||||
: IsBaseOf<JS::Symbol, T>::value ? JS::TraceKind::Symbol
|
||||
: IsBaseOf<JSScript, T>::value ? JS::TraceKind::Script
|
||||
: IsBaseOf<Shape, T>::value ? JS::TraceKind::Shape
|
||||
: IsBaseOf<BaseShape, T>::value ? JS::TraceKind::BaseShape
|
||||
: IsBaseOf<jit::JitCode, T>::value ? JS::TraceKind::JitCode
|
||||
: IsBaseOf<LazyScript, T>::value ? JS::TraceKind::LazyScript
|
||||
: JS::TraceKind::ObjectGroup>
|
||||
struct BaseGCType;
|
||||
#define IMPL_BASE_GC_TYPE(name, type_, _) \
|
||||
template <typename T> struct BaseGCType<T, TraceKind:: name> { typedef type_ type; };
|
||||
template <typename T> struct BaseGCType<T, JS::TraceKind:: name> { typedef type_ type; };
|
||||
FOR_EACH_GC_LAYOUT(IMPL_BASE_GC_TYPE);
|
||||
#undef IMPL_BASE_GC_TYPE
|
||||
|
||||
@ -520,7 +513,7 @@ js::TraceProcessGlobalRoot(JSTracer* trc, T* thing, const char* name)
|
||||
// things so they do not need to go through the mark stack and may simply
|
||||
// be marked directly. Moreover, well-known symbols can refer only to
|
||||
// permanent atoms, so likewise require no subsquent marking.
|
||||
CheckTracedThing(trc, thing);
|
||||
CheckTracedThing(trc, *ConvertToBase(&thing));
|
||||
if (trc->isMarkingTracer())
|
||||
thing->markIfUnmarked(gc::BLACK);
|
||||
else
|
||||
@ -931,9 +924,9 @@ js::GCMarker::eagerlyMarkChildren(JSRope* rope)
|
||||
// other ropes or linear strings, it cannot refer to GC things of other
|
||||
// types.
|
||||
ptrdiff_t savedPos = stack.position();
|
||||
JS_DIAGNOSTICS_ASSERT(rope->getTraceKind() == JSTRACE_STRING);
|
||||
JS_DIAGNOSTICS_ASSERT(rope->getTraceKind() == JS::TraceKind::String);
|
||||
while (true) {
|
||||
JS_DIAGNOSTICS_ASSERT(rope->getTraceKind() == JSTRACE_STRING);
|
||||
JS_DIAGNOSTICS_ASSERT(rope->getTraceKind() == JS::TraceKind::String);
|
||||
JS_DIAGNOSTICS_ASSERT(rope->JSString::isRope());
|
||||
AssertZoneIsMarking(rope);
|
||||
MOZ_ASSERT(rope->isMarked());
|
||||
@ -1797,8 +1790,8 @@ void
|
||||
js::gc::StoreBuffer::WholeCellEdges::trace(TenuringTracer& mover) const
|
||||
{
|
||||
MOZ_ASSERT(edge->isTenured());
|
||||
JSGCTraceKind kind = edge->getTraceKind();
|
||||
if (kind <= JSTRACE_OBJECT) {
|
||||
JS::TraceKind kind = edge->getTraceKind();
|
||||
if (kind == JS::TraceKind::Object) {
|
||||
JSObject *object = static_cast<JSObject*>(edge);
|
||||
mover.traceObject(object);
|
||||
|
||||
@ -1815,7 +1808,7 @@ js::gc::StoreBuffer::WholeCellEdges::trace(TenuringTracer& mover) const
|
||||
|
||||
return;
|
||||
}
|
||||
MOZ_ASSERT(kind == JSTRACE_JITCODE);
|
||||
MOZ_ASSERT(kind == JS::TraceKind::JitCode);
|
||||
static_cast<jit::JitCode*>(edge)->traceChildren(&mover);
|
||||
}
|
||||
|
||||
@ -1825,7 +1818,7 @@ js::gc::StoreBuffer::CellPtrEdge::trace(TenuringTracer& mover) const
|
||||
if (!*edge)
|
||||
return;
|
||||
|
||||
MOZ_ASSERT((*edge)->getTraceKind() == JSTRACE_OBJECT);
|
||||
MOZ_ASSERT((*edge)->getTraceKind() == JS::TraceKind::Object);
|
||||
mover.traverse(reinterpret_cast<JSObject**>(edge));
|
||||
}
|
||||
|
||||
@ -2273,7 +2266,7 @@ TypeSet::MarkTypeUnbarriered(JSTracer* trc, TypeSet::Type* v, const char* name)
|
||||
|
||||
#ifdef DEBUG
|
||||
static void
|
||||
AssertNonGrayGCThing(JS::CallbackTracer* trc, void** thingp, JSGCTraceKind kind)
|
||||
AssertNonGrayGCThing(JS::CallbackTracer* trc, void** thingp, JS::TraceKind kind)
|
||||
{
|
||||
DebugOnly<Cell*> thing(static_cast<Cell*>(*thingp));
|
||||
MOZ_ASSERT_IF(thing->isTenured(), !thing->asTenured().isMarked(js::gc::GRAY));
|
||||
@ -2281,7 +2274,7 @@ AssertNonGrayGCThing(JS::CallbackTracer* trc, void** thingp, JSGCTraceKind kind)
|
||||
#endif
|
||||
|
||||
static void
|
||||
UnmarkGrayChildren(JS::CallbackTracer* trc, void** thingp, JSGCTraceKind kind);
|
||||
UnmarkGrayChildren(JS::CallbackTracer* trc, void** thingp, JS::TraceKind kind);
|
||||
|
||||
struct UnmarkGrayTracer : public JS::CallbackTracer
|
||||
{
|
||||
@ -2344,7 +2337,7 @@ struct UnmarkGrayTracer : public JS::CallbackTracer
|
||||
* containers.
|
||||
*/
|
||||
static void
|
||||
UnmarkGrayChildren(JS::CallbackTracer* trc, void** thingp, JSGCTraceKind kind)
|
||||
UnmarkGrayChildren(JS::CallbackTracer* trc, void** thingp, JS::TraceKind kind)
|
||||
{
|
||||
int stackDummy;
|
||||
if (!JS_CHECK_STACK_SIZE(trc->runtime()->mainThread.nativeStackLimit[StackForSystemCode],
|
||||
@ -2383,16 +2376,16 @@ UnmarkGrayChildren(JS::CallbackTracer* trc, void** thingp, JSGCTraceKind kind)
|
||||
// The parent will later trace |tenured|. This is done to avoid increasing
|
||||
// the stack depth during shape tracing. It is safe to do because a shape
|
||||
// can only have one child that is a shape.
|
||||
UnmarkGrayTracer childTracer(tracer, kind == JSTRACE_SHAPE);
|
||||
UnmarkGrayTracer childTracer(tracer, kind == JS::TraceKind::Shape);
|
||||
|
||||
if (kind != JSTRACE_SHAPE) {
|
||||
if (kind != JS::TraceKind::Shape) {
|
||||
TraceChildren(&childTracer, &tenured, kind);
|
||||
MOZ_ASSERT(!childTracer.previousShape);
|
||||
tracer->unmarkedAny |= childTracer.unmarkedAny;
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(kind == JSTRACE_SHAPE);
|
||||
MOZ_ASSERT(kind == JS::TraceKind::Shape);
|
||||
Shape* shape = static_cast<Shape*>(&tenured);
|
||||
if (tracer->tracingShape) {
|
||||
MOZ_ASSERT(!tracer->previousShape);
|
||||
@ -2402,7 +2395,7 @@ UnmarkGrayChildren(JS::CallbackTracer* trc, void** thingp, JSGCTraceKind kind)
|
||||
|
||||
do {
|
||||
MOZ_ASSERT(!shape->isMarked(js::gc::GRAY));
|
||||
TraceChildren(&childTracer, shape, JSTRACE_SHAPE);
|
||||
TraceChildren(&childTracer, shape, JS::TraceKind::Shape);
|
||||
shape = childTracer.previousShape;
|
||||
childTracer.previousShape = nullptr;
|
||||
} while (shape);
|
||||
@ -2410,7 +2403,7 @@ UnmarkGrayChildren(JS::CallbackTracer* trc, void** thingp, JSGCTraceKind kind)
|
||||
}
|
||||
|
||||
bool
|
||||
js::UnmarkGrayCellRecursively(gc::Cell* cell, JSGCTraceKind kind)
|
||||
js::UnmarkGrayCellRecursively(gc::Cell* cell, JS::TraceKind kind)
|
||||
{
|
||||
MOZ_ASSERT(cell);
|
||||
|
||||
@ -2439,7 +2432,7 @@ js::UnmarkGrayCellRecursively(gc::Cell* cell, JSGCTraceKind kind)
|
||||
bool
|
||||
js::UnmarkGrayShapeRecursively(Shape* shape)
|
||||
{
|
||||
return js::UnmarkGrayCellRecursively(shape, JSTRACE_SHAPE);
|
||||
return js::UnmarkGrayCellRecursively(shape, JS::TraceKind::Shape);
|
||||
}
|
||||
|
||||
JS_FRIEND_API(bool)
|
||||
|
@ -552,14 +552,14 @@ class BufferGrayRootsTracer : public JS::CallbackTracer
|
||||
// Set to false if we OOM while buffering gray roots.
|
||||
bool bufferingGrayRootsFailed;
|
||||
|
||||
void appendGrayRoot(gc::TenuredCell* thing, JSGCTraceKind kind);
|
||||
void appendGrayRoot(gc::TenuredCell* thing, JS::TraceKind kind);
|
||||
|
||||
public:
|
||||
explicit BufferGrayRootsTracer(JSRuntime* rt)
|
||||
: JS::CallbackTracer(rt, grayTraceCallback), bufferingGrayRootsFailed(false)
|
||||
{}
|
||||
|
||||
static void grayTraceCallback(JS::CallbackTracer* trc, void** thingp, JSGCTraceKind kind) {
|
||||
static void grayTraceCallback(JS::CallbackTracer* trc, void** thingp, JS::TraceKind kind) {
|
||||
auto tracer = static_cast<BufferGrayRootsTracer*>(trc);
|
||||
tracer->appendGrayRoot(gc::TenuredCell::fromPointer(*thingp), kind);
|
||||
}
|
||||
@ -595,7 +595,7 @@ struct SetMaybeAliveFunctor {
|
||||
};
|
||||
|
||||
void
|
||||
BufferGrayRootsTracer::appendGrayRoot(TenuredCell* thing, JSGCTraceKind kind)
|
||||
BufferGrayRootsTracer::appendGrayRoot(TenuredCell* thing, JS::TraceKind kind)
|
||||
{
|
||||
MOZ_ASSERT(runtime()->isHeapBusy());
|
||||
|
||||
|
@ -44,7 +44,7 @@ T
|
||||
DoCallback(JS::CallbackTracer* trc, T* thingp, const char* name)
|
||||
{
|
||||
CheckTracedThing(trc, *thingp);
|
||||
JSGCTraceKind kind = MapTypeToTraceKind<typename mozilla::RemovePointer<T>::Type>::kind;
|
||||
JS::TraceKind kind = MapTypeToTraceKind<typename mozilla::RemovePointer<T>::Type>::kind;
|
||||
JS::AutoTracingName ctx(trc, name);
|
||||
trc->invoke((void**)thingp, kind);
|
||||
return *thingp;
|
||||
@ -174,7 +174,7 @@ JS_CallTenuredObjectTracer(JSTracer* trc, JS::TenuredHeap<JSObject*>* objp, cons
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_TraceChildren(JSTracer* trc, void* thing, JSGCTraceKind kind)
|
||||
JS_TraceChildren(JSTracer* trc, void* thing, JS::TraceKind kind)
|
||||
{
|
||||
js::TraceChildren(trc, thing, kind);
|
||||
}
|
||||
@ -187,7 +187,7 @@ struct TraceChildrenFunctor {
|
||||
};
|
||||
|
||||
void
|
||||
js::TraceChildren(JSTracer* trc, void* thing, JSGCTraceKind kind)
|
||||
js::TraceChildren(JSTracer* trc, void* thing, JS::TraceKind kind)
|
||||
{
|
||||
MOZ_ASSERT(thing);
|
||||
TraceChildrenFunctor f;
|
||||
@ -306,7 +306,7 @@ gc::TraceCycleCollectorChildren(JS::CallbackTracer* trc, Shape* shape)
|
||||
|
||||
void
|
||||
TraceObjectGroupCycleCollectorChildrenCallback(JS::CallbackTracer* trc,
|
||||
void** thingp, JSGCTraceKind kind);
|
||||
void** thingp, JS::TraceKind kind);
|
||||
|
||||
// Object groups can point to other object groups via an UnboxedLayout or the
|
||||
// the original unboxed group link. There can potentially be deep or cyclic
|
||||
@ -328,7 +328,7 @@ struct ObjectGroupCycleCollectorTracer : public JS::CallbackTracer
|
||||
|
||||
void
|
||||
TraceObjectGroupCycleCollectorChildrenCallback(JS::CallbackTracer* trcArg,
|
||||
void** thingp, JSGCTraceKind kind)
|
||||
void** thingp, JS::TraceKind kind)
|
||||
{
|
||||
ObjectGroupCycleCollectorTracer* trc = static_cast<ObjectGroupCycleCollectorTracer*>(trcArg);
|
||||
JS::GCCellPtr thing(*thingp, kind);
|
||||
@ -396,7 +396,7 @@ CountDecimalDigits(size_t num)
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_GetTraceThingInfo(char* buf, size_t bufsize, JSTracer* trc, void* thing,
|
||||
JSGCTraceKind kind, bool details)
|
||||
JS::TraceKind kind, bool details)
|
||||
{
|
||||
const char* name = nullptr; /* silence uninitialized warning */
|
||||
size_t n;
|
||||
@ -405,43 +405,43 @@ JS_GetTraceThingInfo(char* buf, size_t bufsize, JSTracer* trc, void* thing,
|
||||
return;
|
||||
|
||||
switch (kind) {
|
||||
case JSTRACE_OBJECT:
|
||||
case JS::TraceKind::Object:
|
||||
{
|
||||
name = static_cast<JSObject*>(thing)->getClass()->name;
|
||||
break;
|
||||
}
|
||||
|
||||
case JSTRACE_SCRIPT:
|
||||
case JS::TraceKind::Script:
|
||||
name = "script";
|
||||
break;
|
||||
|
||||
case JSTRACE_STRING:
|
||||
case JS::TraceKind::String:
|
||||
name = ((JSString*)thing)->isDependent()
|
||||
? "substring"
|
||||
: "string";
|
||||
break;
|
||||
|
||||
case JSTRACE_SYMBOL:
|
||||
case JS::TraceKind::Symbol:
|
||||
name = "symbol";
|
||||
break;
|
||||
|
||||
case JSTRACE_BASE_SHAPE:
|
||||
case JS::TraceKind::BaseShape:
|
||||
name = "base_shape";
|
||||
break;
|
||||
|
||||
case JSTRACE_JITCODE:
|
||||
case JS::TraceKind::JitCode:
|
||||
name = "jitcode";
|
||||
break;
|
||||
|
||||
case JSTRACE_LAZY_SCRIPT:
|
||||
case JS::TraceKind::LazyScript:
|
||||
name = "lazyscript";
|
||||
break;
|
||||
|
||||
case JSTRACE_SHAPE:
|
||||
case JS::TraceKind::Shape:
|
||||
name = "shape";
|
||||
break;
|
||||
|
||||
case JSTRACE_OBJECT_GROUP:
|
||||
case JS::TraceKind::ObjectGroup:
|
||||
name = "object_group";
|
||||
break;
|
||||
|
||||
@ -460,7 +460,7 @@ JS_GetTraceThingInfo(char* buf, size_t bufsize, JSTracer* trc, void* thing,
|
||||
|
||||
if (details && bufsize > 2) {
|
||||
switch (kind) {
|
||||
case JSTRACE_OBJECT:
|
||||
case JS::TraceKind::Object:
|
||||
{
|
||||
JSObject* obj = (JSObject*)thing;
|
||||
if (obj->is<JSFunction>()) {
|
||||
@ -478,14 +478,14 @@ JS_GetTraceThingInfo(char* buf, size_t bufsize, JSTracer* trc, void* thing,
|
||||
break;
|
||||
}
|
||||
|
||||
case JSTRACE_SCRIPT:
|
||||
case JS::TraceKind::Script:
|
||||
{
|
||||
JSScript* script = static_cast<JSScript*>(thing);
|
||||
JS_snprintf(buf, bufsize, " %s:%" PRIuSIZE, script->filename(), script->lineno());
|
||||
break;
|
||||
}
|
||||
|
||||
case JSTRACE_STRING:
|
||||
case JS::TraceKind::String:
|
||||
{
|
||||
*buf++ = ' ';
|
||||
bufsize--;
|
||||
@ -508,7 +508,7 @@ JS_GetTraceThingInfo(char* buf, size_t bufsize, JSTracer* trc, void* thing,
|
||||
break;
|
||||
}
|
||||
|
||||
case JSTRACE_SYMBOL:
|
||||
case JS::TraceKind::Symbol:
|
||||
{
|
||||
JS::Symbol* sym = static_cast<JS::Symbol*>(thing);
|
||||
if (JSString* desc = sym->description()) {
|
||||
|
@ -111,7 +111,7 @@ TraceManuallyBarrieredGenericPointerEdge(JSTracer* trc, gc::Cell** thingp, const
|
||||
|
||||
// Depricated. Please use one of the strongly typed variants above.
|
||||
void
|
||||
TraceChildren(JSTracer* trc, void* thing, JSGCTraceKind kind);
|
||||
TraceChildren(JSTracer* trc, void* thing, JS::TraceKind kind);
|
||||
|
||||
namespace gc {
|
||||
|
||||
|
@ -50,14 +50,14 @@ using namespace js::gc;
|
||||
struct EdgeValue
|
||||
{
|
||||
void* thing;
|
||||
JSGCTraceKind kind;
|
||||
JS::TraceKind kind;
|
||||
const char* label;
|
||||
};
|
||||
|
||||
struct VerifyNode
|
||||
{
|
||||
void* thing;
|
||||
JSGCTraceKind kind;
|
||||
JS::TraceKind kind;
|
||||
uint32_t count;
|
||||
EdgeValue edges[1];
|
||||
};
|
||||
@ -109,7 +109,7 @@ struct VerifyPreTracer : JS::CallbackTracer
|
||||
* node.
|
||||
*/
|
||||
static void
|
||||
AccumulateEdge(JS::CallbackTracer* jstrc, void** thingp, JSGCTraceKind kind)
|
||||
AccumulateEdge(JS::CallbackTracer* jstrc, void** thingp, JS::TraceKind kind)
|
||||
{
|
||||
VerifyPreTracer* trc = (VerifyPreTracer*)jstrc;
|
||||
|
||||
@ -131,7 +131,7 @@ AccumulateEdge(JS::CallbackTracer* jstrc, void** thingp, JSGCTraceKind kind)
|
||||
}
|
||||
|
||||
static VerifyNode*
|
||||
MakeNode(VerifyPreTracer* trc, void* thing, JSGCTraceKind kind)
|
||||
MakeNode(VerifyPreTracer* trc, void* thing, JS::TraceKind kind)
|
||||
{
|
||||
NodeMap::AddPtr p = trc->nodemap.lookupForAdd(thing);
|
||||
if (!p) {
|
||||
@ -202,7 +202,7 @@ gc::GCRuntime::startVerifyPreBarriers()
|
||||
goto oom;
|
||||
|
||||
/* Create the root node. */
|
||||
trc->curnode = MakeNode(trc, nullptr, JSGCTraceKind(0));
|
||||
trc->curnode = MakeNode(trc, nullptr, JS::TraceKind(0));
|
||||
|
||||
incrementalState = MARK_ROOTS;
|
||||
|
||||
@ -265,7 +265,7 @@ static const uint32_t MAX_VERIFIER_EDGES = 1000;
|
||||
* been modified) must point to marked objects.
|
||||
*/
|
||||
static void
|
||||
CheckEdge(JS::CallbackTracer* jstrc, void** thingp, JSGCTraceKind kind)
|
||||
CheckEdge(JS::CallbackTracer* jstrc, void** thingp, JS::TraceKind kind)
|
||||
{
|
||||
VerifyPreTracer* trc = (VerifyPreTracer*)jstrc;
|
||||
VerifyNode* node = trc->curnode;
|
||||
@ -290,9 +290,9 @@ AssertMarkedOrAllocated(const EdgeValue& edge)
|
||||
return;
|
||||
|
||||
// Permanent atoms and well-known symbols aren't marked during graph traversal.
|
||||
if (edge.kind == JSTRACE_STRING && static_cast<JSString*>(edge.thing)->isPermanentAtom())
|
||||
if (edge.kind == JS::TraceKind::String && static_cast<JSString*>(edge.thing)->isPermanentAtom())
|
||||
return;
|
||||
if (edge.kind == JSTRACE_SYMBOL && static_cast<JS::Symbol*>(edge.thing)->isWellKnownSymbol())
|
||||
if (edge.kind == JS::TraceKind::Symbol && static_cast<JS::Symbol*>(edge.thing)->isWellKnownSymbol())
|
||||
return;
|
||||
|
||||
char msgbuf[1024];
|
||||
|
@ -35,16 +35,16 @@ BEGIN_TEST(testGCCellPtr)
|
||||
CHECK(!JS::GCCellPtr(nullptr));
|
||||
|
||||
CHECK(JS::GCCellPtr(obj.get()));
|
||||
CHECK(JS::GCCellPtr(obj.get()).kind() == JSTRACE_OBJECT);
|
||||
CHECK(JS::GCCellPtr(JS::ObjectValue(*obj)).kind() == JSTRACE_OBJECT);
|
||||
CHECK(JS::GCCellPtr(obj.get()).kind() == JS::TraceKind::Object);
|
||||
CHECK(JS::GCCellPtr(JS::ObjectValue(*obj)).kind() == JS::TraceKind::Object);
|
||||
|
||||
CHECK(JS::GCCellPtr(str.get()));
|
||||
CHECK(JS::GCCellPtr(str.get()).kind() == JSTRACE_STRING);
|
||||
CHECK(JS::GCCellPtr(JS::StringValue(str)).kind() == JSTRACE_STRING);
|
||||
CHECK(JS::GCCellPtr(str.get()).kind() == JS::TraceKind::String);
|
||||
CHECK(JS::GCCellPtr(JS::StringValue(str)).kind() == JS::TraceKind::String);
|
||||
|
||||
CHECK(JS::GCCellPtr(script.get()));
|
||||
CHECK(!JS::GCCellPtr(nullptr));
|
||||
CHECK(JS::GCCellPtr(script.get()).kind() == JSTRACE_SCRIPT);
|
||||
CHECK(JS::GCCellPtr(script.get()).kind() == JS::TraceKind::Script);
|
||||
|
||||
JS::GCCellPtr objcell(obj.get());
|
||||
JS::GCCellPtr scriptcell = JS::GCCellPtr(script.get());
|
||||
|
@ -8,11 +8,11 @@
|
||||
#include "jsapi-tests/tests.h"
|
||||
|
||||
class CCWTestTracer : public JS::CallbackTracer {
|
||||
static void staticCallback(JS::CallbackTracer* trc, void** thingp, JSGCTraceKind kind) {
|
||||
static void staticCallback(JS::CallbackTracer* trc, void** thingp, JS::TraceKind kind) {
|
||||
static_cast<CCWTestTracer*>(trc)->callback(thingp, kind);
|
||||
}
|
||||
|
||||
void callback(void** thingp, JSGCTraceKind kind) {
|
||||
void callback(void** thingp, JS::TraceKind kind) {
|
||||
numberOfThingsTraced++;
|
||||
|
||||
printf("*thingp = %p\n", *thingp);
|
||||
@ -29,9 +29,9 @@ class CCWTestTracer : public JS::CallbackTracer {
|
||||
bool okay;
|
||||
size_t numberOfThingsTraced;
|
||||
void** expectedThingp;
|
||||
JSGCTraceKind expectedKind;
|
||||
JS::TraceKind expectedKind;
|
||||
|
||||
CCWTestTracer(JSContext* cx, void** expectedThingp, JSGCTraceKind expectedKind)
|
||||
CCWTestTracer(JSContext* cx, void** expectedThingp, JS::TraceKind expectedKind)
|
||||
: JS::CallbackTracer(JS_GetRuntime(cx), staticCallback),
|
||||
okay(true),
|
||||
numberOfThingsTraced(0),
|
||||
@ -69,7 +69,7 @@ BEGIN_TEST(testTracingIncomingCCWs)
|
||||
CHECK(zones.put(global1->zone()));
|
||||
|
||||
void* thing = obj.get();
|
||||
CCWTestTracer trc(cx, &thing, JSTRACE_OBJECT);
|
||||
CCWTestTracer trc(cx, &thing, JS::TraceKind::Object);
|
||||
JS_TraceIncomingCCWs(&trc, zones);
|
||||
CHECK(trc.numberOfThingsTraced == 1);
|
||||
CHECK(trc.okay);
|
||||
|
@ -223,7 +223,7 @@ class WrapperMapRef : public BufferableRef
|
||||
key.kind == CrossCompartmentKey::DebuggerSource)
|
||||
{
|
||||
MOZ_ASSERT(IsInsideNursery(key.wrapped) ||
|
||||
key.wrapped->asTenured().getTraceKind() == JSTRACE_OBJECT);
|
||||
key.wrapped->asTenured().getTraceKind() == JS::TraceKind::Object);
|
||||
TraceManuallyBarrieredEdge(trc, reinterpret_cast<JSObject**>(&key.wrapped),
|
||||
"CCW wrapped object");
|
||||
}
|
||||
@ -624,17 +624,17 @@ JSCompartment::sweepCrossCompartmentWrappers()
|
||||
case CrossCompartmentKey::DebuggerEnvironment:
|
||||
case CrossCompartmentKey::DebuggerSource:
|
||||
MOZ_ASSERT(IsInsideNursery(key.wrapped) ||
|
||||
key.wrapped->asTenured().getTraceKind() == JSTRACE_OBJECT);
|
||||
key.wrapped->asTenured().getTraceKind() == JS::TraceKind::Object);
|
||||
keyDying = IsAboutToBeFinalizedUnbarriered(
|
||||
reinterpret_cast<JSObject**>(&key.wrapped));
|
||||
break;
|
||||
case CrossCompartmentKey::StringWrapper:
|
||||
MOZ_ASSERT(key.wrapped->asTenured().getTraceKind() == JSTRACE_STRING);
|
||||
MOZ_ASSERT(key.wrapped->asTenured().getTraceKind() == JS::TraceKind::String);
|
||||
keyDying = IsAboutToBeFinalizedUnbarriered(
|
||||
reinterpret_cast<JSString**>(&key.wrapped));
|
||||
break;
|
||||
case CrossCompartmentKey::DebuggerScript:
|
||||
MOZ_ASSERT(key.wrapped->asTenured().getTraceKind() == JSTRACE_SCRIPT);
|
||||
MOZ_ASSERT(key.wrapped->asTenured().getTraceKind() == JS::TraceKind::Script);
|
||||
keyDying = IsAboutToBeFinalizedUnbarriered(
|
||||
reinterpret_cast<JSScript**>(&key.wrapped));
|
||||
break;
|
||||
|
@ -592,7 +592,7 @@ js::ZoneGlobalsAreAllGray(JS::Zone* zone)
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_FRIEND_API(JSGCTraceKind)
|
||||
JS_FRIEND_API(JS::TraceKind)
|
||||
js::GCThingTraceKind(void* thing)
|
||||
{
|
||||
MOZ_ASSERT(thing);
|
||||
@ -945,7 +945,7 @@ DumpHeapVisitCompartment(JSRuntime* rt, void* data, JSCompartment* comp)
|
||||
|
||||
static void
|
||||
DumpHeapVisitArena(JSRuntime* rt, void* data, gc::Arena* arena,
|
||||
JSGCTraceKind traceKind, size_t thingSize)
|
||||
JS::TraceKind traceKind, size_t thingSize)
|
||||
{
|
||||
DumpHeapTracer* dtrc = static_cast<DumpHeapTracer*>(data);
|
||||
fprintf(dtrc->output, "# arena allockind=%u size=%u\n",
|
||||
@ -954,7 +954,7 @@ DumpHeapVisitArena(JSRuntime* rt, void* data, gc::Arena* arena,
|
||||
|
||||
static void
|
||||
DumpHeapVisitCell(JSRuntime* rt, void* data, void* thing,
|
||||
JSGCTraceKind traceKind, size_t thingSize)
|
||||
JS::TraceKind traceKind, size_t thingSize)
|
||||
{
|
||||
DumpHeapTracer* dtrc = static_cast<DumpHeapTracer*>(data);
|
||||
char cellDesc[1024 * 32];
|
||||
@ -964,7 +964,7 @@ DumpHeapVisitCell(JSRuntime* rt, void* data, void* thing,
|
||||
}
|
||||
|
||||
static void
|
||||
DumpHeapVisitChild(JS::CallbackTracer* trc, void** thingp, JSGCTraceKind kind)
|
||||
DumpHeapVisitChild(JS::CallbackTracer* trc, void** thingp, JS::TraceKind kind)
|
||||
{
|
||||
if (gc::IsInsideNursery((js::gc::Cell*)*thingp))
|
||||
return;
|
||||
@ -976,7 +976,7 @@ DumpHeapVisitChild(JS::CallbackTracer* trc, void** thingp, JSGCTraceKind kind)
|
||||
}
|
||||
|
||||
static void
|
||||
DumpHeapVisitRoot(JS::CallbackTracer* trc, void** thingp, JSGCTraceKind kind)
|
||||
DumpHeapVisitRoot(JS::CallbackTracer* trc, void** thingp, JS::TraceKind kind)
|
||||
{
|
||||
if (gc::IsInsideNursery((js::gc::Cell*)*thingp))
|
||||
return;
|
||||
|
@ -526,7 +526,7 @@ VisitGrayWrapperTargets(JS::Zone* zone, GCThingCallback callback, void* closure)
|
||||
extern JS_FRIEND_API(JSObject*)
|
||||
GetWeakmapKeyDelegate(JSObject* key);
|
||||
|
||||
JS_FRIEND_API(JSGCTraceKind)
|
||||
JS_FRIEND_API(JS::TraceKind)
|
||||
GCThingTraceKind(void* thing);
|
||||
|
||||
/*
|
||||
|
@ -2209,12 +2209,12 @@ GCRuntime::relocateArenas(Zone* zone, JS::gcreason::Reason reason, SliceBudget&
|
||||
|
||||
|
||||
void
|
||||
MovingTracer::Visit(JS::CallbackTracer* jstrc, void** thingp, JSGCTraceKind kind)
|
||||
MovingTracer::Visit(JS::CallbackTracer* jstrc, void** thingp, JS::TraceKind kind)
|
||||
{
|
||||
TenuredCell* thing = TenuredCell::fromPointer(*thingp);
|
||||
|
||||
// Currently we only relocate objects.
|
||||
if (kind != JSTRACE_OBJECT) {
|
||||
if (kind != JS::TraceKind::Object) {
|
||||
MOZ_ASSERT(!RelocationOverlay::isCellForwarded(thing));
|
||||
return;
|
||||
}
|
||||
@ -2272,7 +2272,7 @@ GCRuntime::sweepZoneAfterCompacting(Zone* zone)
|
||||
|
||||
template <typename T>
|
||||
static void
|
||||
UpdateCellPointersTyped(MovingTracer* trc, ArenaHeader* arena, JSGCTraceKind traceKind)
|
||||
UpdateCellPointersTyped(MovingTracer* trc, ArenaHeader* arena, JS::TraceKind traceKind)
|
||||
{
|
||||
for (ArenaCellIterUnderGC i(arena); !i.done(); i.next()) {
|
||||
T* cell = reinterpret_cast<T*>(i.getCell());
|
||||
@ -2288,7 +2288,7 @@ static void
|
||||
UpdateCellPointers(MovingTracer* trc, ArenaHeader* arena)
|
||||
{
|
||||
AllocKind kind = arena->getAllocKind();
|
||||
JSGCTraceKind traceKind = MapAllocToTraceKind(kind);
|
||||
JS::TraceKind traceKind = MapAllocToTraceKind(kind);
|
||||
|
||||
switch (kind) {
|
||||
case AllocKind::FUNCTION:
|
||||
@ -3685,17 +3685,17 @@ class CompartmentCheckTracer : public JS::CallbackTracer
|
||||
{}
|
||||
|
||||
Cell* src;
|
||||
JSGCTraceKind srcKind;
|
||||
JS::TraceKind srcKind;
|
||||
Zone* zone;
|
||||
JSCompartment* compartment;
|
||||
};
|
||||
|
||||
static bool
|
||||
InCrossCompartmentMap(JSObject* src, Cell* dst, JSGCTraceKind dstKind)
|
||||
InCrossCompartmentMap(JSObject* src, Cell* dst, JS::TraceKind dstKind)
|
||||
{
|
||||
JSCompartment* srccomp = src->compartment();
|
||||
|
||||
if (dstKind == JSTRACE_OBJECT) {
|
||||
if (dstKind == JS::TraceKind::Object) {
|
||||
Value key = ObjectValue(*static_cast<JSObject*>(dst));
|
||||
if (WrapperMap::Ptr p = srccomp->lookupWrapper(key)) {
|
||||
if (*p->value().unsafeGet() == ObjectValue(*src))
|
||||
@ -3717,11 +3717,11 @@ InCrossCompartmentMap(JSObject* src, Cell* dst, JSGCTraceKind dstKind)
|
||||
|
||||
static void
|
||||
CheckCompartment(CompartmentCheckTracer* trc, JSCompartment* thingCompartment,
|
||||
Cell* thing, JSGCTraceKind kind)
|
||||
Cell* thing, JS::TraceKind kind)
|
||||
{
|
||||
MOZ_ASSERT(thingCompartment == trc->compartment ||
|
||||
trc->runtime()->isAtomsCompartment(thingCompartment) ||
|
||||
(trc->srcKind == JSTRACE_OBJECT &&
|
||||
(trc->srcKind == JS::TraceKind::Object &&
|
||||
InCrossCompartmentMap((JSObject*)trc->src, thing, kind)));
|
||||
}
|
||||
|
||||
@ -3730,7 +3730,7 @@ struct MaybeCompartmentFunctor {
|
||||
};
|
||||
|
||||
static void
|
||||
CheckCompartmentCallback(JS::CallbackTracer* trcArg, void** thingp, JSGCTraceKind kind)
|
||||
CheckCompartmentCallback(JS::CallbackTracer* trcArg, void** thingp, JS::TraceKind kind)
|
||||
{
|
||||
CompartmentCheckTracer* trc = static_cast<CompartmentCheckTracer*>(trcArg);
|
||||
TenuredCell* thing = TenuredCell::fromPointer(*thingp);
|
||||
@ -6862,16 +6862,16 @@ JS_FRIEND_API(void)
|
||||
JS::AssertGCThingIsNotAnObjectSubclass(Cell* cell)
|
||||
{
|
||||
MOZ_ASSERT(cell);
|
||||
MOZ_ASSERT(cell->getTraceKind() != JSTRACE_OBJECT);
|
||||
MOZ_ASSERT(cell->getTraceKind() != JS::TraceKind::Object);
|
||||
}
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
js::gc::AssertGCThingHasType(js::gc::Cell* cell, JSGCTraceKind kind)
|
||||
js::gc::AssertGCThingHasType(js::gc::Cell* cell, JS::TraceKind kind)
|
||||
{
|
||||
if (!cell)
|
||||
MOZ_ASSERT(kind == JSTRACE_NULL);
|
||||
MOZ_ASSERT(kind == JS::TraceKind::Null);
|
||||
else if (IsInsideNursery(cell))
|
||||
MOZ_ASSERT(kind == JSTRACE_OBJECT);
|
||||
MOZ_ASSERT(kind == JS::TraceKind::Object);
|
||||
else
|
||||
MOZ_ASSERT(MapAllocToTraceKind(cell->asTenured().getAllocKind()) == kind);
|
||||
}
|
||||
@ -6960,18 +6960,12 @@ JS::AutoAssertGCCallback::AutoAssertGCCallback(JSObject* obj)
|
||||
}
|
||||
|
||||
JS_FRIEND_API(const char*)
|
||||
JS::GCTraceKindToAscii(JSGCTraceKind kind)
|
||||
JS::GCTraceKindToAscii(JS::TraceKind kind)
|
||||
{
|
||||
switch(kind) {
|
||||
case JSTRACE_OBJECT: return "Object";
|
||||
case JSTRACE_SCRIPT: return "Script";
|
||||
case JSTRACE_STRING: return "String";
|
||||
case JSTRACE_SYMBOL: return "Symbol";
|
||||
case JSTRACE_SHAPE: return "Shape";
|
||||
case JSTRACE_BASE_SHAPE: return "BaseShape";
|
||||
case JSTRACE_LAZY_SCRIPT: return "LazyScript";
|
||||
case JSTRACE_JITCODE: return "JitCode";
|
||||
case JSTRACE_OBJECT_GROUP: return "ObjectGroup";
|
||||
#define MAP_NAME(name, _0, _1) case JS::TraceKind::name: return #name;
|
||||
FOR_EACH_GC_LAYOUT(MAP_NAME);
|
||||
#undef MAP_NAME
|
||||
default: return "Invalid";
|
||||
}
|
||||
}
|
||||
@ -6980,19 +6974,19 @@ JS::GCCellPtr::GCCellPtr(const Value& v)
|
||||
: ptr(0)
|
||||
{
|
||||
if (v.isString())
|
||||
ptr = checkedCast(v.toString(), JSTRACE_STRING);
|
||||
ptr = checkedCast(v.toString(), JS::TraceKind::String);
|
||||
else if (v.isObject())
|
||||
ptr = checkedCast(&v.toObject(), JSTRACE_OBJECT);
|
||||
ptr = checkedCast(&v.toObject(), JS::TraceKind::Object);
|
||||
else if (v.isSymbol())
|
||||
ptr = checkedCast(v.toSymbol(), JSTRACE_SYMBOL);
|
||||
ptr = checkedCast(v.toSymbol(), JS::TraceKind::Symbol);
|
||||
else
|
||||
ptr = checkedCast(nullptr, JSTRACE_NULL);
|
||||
ptr = checkedCast(nullptr, JS::TraceKind::Null);
|
||||
}
|
||||
|
||||
JSGCTraceKind
|
||||
JS::TraceKind
|
||||
JS::GCCellPtr::outOfLineKind() const
|
||||
{
|
||||
MOZ_ASSERT(JSGCTraceKind(ptr & JSTRACE_OUTOFLINE) == JSTRACE_OUTOFLINE);
|
||||
MOZ_ASSERT((ptr & OutOfLineTraceKindMask) == OutOfLineTraceKindMask);
|
||||
MOZ_ASSERT(asCell()->isTenured());
|
||||
return MapAllocToTraceKind(asCell()->asTenured().getAllocKind());
|
||||
}
|
||||
|
@ -70,6 +70,15 @@ enum State {
|
||||
COMPACT
|
||||
};
|
||||
|
||||
// Map from base trace type to the trace kind.
|
||||
template <typename T> struct MapTypeToTraceKind {};
|
||||
#define EXPAND_DEF(name, type, _) \
|
||||
template <> struct MapTypeToTraceKind<type> { \
|
||||
static const JS::TraceKind kind = JS::TraceKind::name; \
|
||||
};
|
||||
FOR_EACH_GC_LAYOUT(EXPAND_DEF);
|
||||
#undef EXPAND_DEF
|
||||
|
||||
/* Map from C++ type to alloc kind. JSObject does not have a 1:1 mapping, so must use Arena::thingSize. */
|
||||
template <typename T> struct MapTypeToFinalizeKind {};
|
||||
template <> struct MapTypeToFinalizeKind<JSScript> { static const AllocKind kind = AllocKind::SCRIPT; };
|
||||
@ -192,28 +201,15 @@ CanBeFinalizedInBackground(AllocKind kind, const Class* clasp)
|
||||
#endif
|
||||
template <typename F, typename... Args>
|
||||
auto
|
||||
CallTyped(F f, JSGCTraceKind traceKind, Args&&... args)
|
||||
CallTyped(F f, JS::TraceKind traceKind, Args&&... args)
|
||||
-> decltype(f. DEPENDENT_TEMPLATE_HINT operator()<JSObject>(mozilla::Forward<Args>(args)...))
|
||||
{
|
||||
switch (traceKind) {
|
||||
case JSTRACE_OBJECT:
|
||||
return f. DEPENDENT_TEMPLATE_HINT operator()<JSObject>(mozilla::Forward<Args>(args)...);
|
||||
case JSTRACE_SCRIPT:
|
||||
return f. DEPENDENT_TEMPLATE_HINT operator()<JSScript>(mozilla::Forward<Args>(args)...);
|
||||
case JSTRACE_STRING:
|
||||
return f. DEPENDENT_TEMPLATE_HINT operator()<JSString>(mozilla::Forward<Args>(args)...);
|
||||
case JSTRACE_SYMBOL:
|
||||
return f. DEPENDENT_TEMPLATE_HINT operator()<JS::Symbol>(mozilla::Forward<Args>(args)...);
|
||||
case JSTRACE_BASE_SHAPE:
|
||||
return f. DEPENDENT_TEMPLATE_HINT operator()<BaseShape>(mozilla::Forward<Args>(args)...);
|
||||
case JSTRACE_JITCODE:
|
||||
return f. DEPENDENT_TEMPLATE_HINT operator()<jit::JitCode>(mozilla::Forward<Args>(args)...);
|
||||
case JSTRACE_LAZY_SCRIPT:
|
||||
return f. DEPENDENT_TEMPLATE_HINT operator()<LazyScript>(mozilla::Forward<Args>(args)...);
|
||||
case JSTRACE_SHAPE:
|
||||
return f. DEPENDENT_TEMPLATE_HINT operator()<Shape>(mozilla::Forward<Args>(args)...);
|
||||
case JSTRACE_OBJECT_GROUP:
|
||||
return f. DEPENDENT_TEMPLATE_HINT operator()<ObjectGroup>(mozilla::Forward<Args>(args)...);
|
||||
#define EXPAND_DEF(name, type, _) \
|
||||
case JS::TraceKind::name: \
|
||||
return f. DEPENDENT_TEMPLATE_HINT operator()<type>(mozilla::Forward<Args>(args)...);
|
||||
FOR_EACH_GC_LAYOUT(EXPAND_DEF);
|
||||
#undef EXPAND_DEF
|
||||
default:
|
||||
MOZ_CRASH("Invalid trace kind in CallTyped.");
|
||||
}
|
||||
@ -222,28 +218,15 @@ CallTyped(F f, JSGCTraceKind traceKind, Args&&... args)
|
||||
|
||||
template <typename F, typename... Args>
|
||||
auto
|
||||
CallTyped(F f, void* thing, JSGCTraceKind traceKind, Args&&... args)
|
||||
CallTyped(F f, void* thing, JS::TraceKind traceKind, Args&&... args)
|
||||
-> decltype(f(reinterpret_cast<JSObject*>(0), mozilla::Forward<Args>(args)...))
|
||||
{
|
||||
switch (traceKind) {
|
||||
case JSTRACE_OBJECT:
|
||||
return f(static_cast<JSObject*>(thing), mozilla::Forward<Args>(args)...);
|
||||
case JSTRACE_SCRIPT:
|
||||
return f(static_cast<JSScript*>(thing), mozilla::Forward<Args>(args)...);
|
||||
case JSTRACE_STRING:
|
||||
return f(static_cast<JSString*>(thing), mozilla::Forward<Args>(args)...);
|
||||
case JSTRACE_SYMBOL:
|
||||
return f(static_cast<JS::Symbol*>(thing), mozilla::Forward<Args>(args)...);
|
||||
case JSTRACE_BASE_SHAPE:
|
||||
return f(static_cast<BaseShape*>(thing), mozilla::Forward<Args>(args)...);
|
||||
case JSTRACE_JITCODE:
|
||||
return f(static_cast<jit::JitCode*>(thing), mozilla::Forward<Args>(args)...);
|
||||
case JSTRACE_LAZY_SCRIPT:
|
||||
return f(static_cast<LazyScript*>(thing), mozilla::Forward<Args>(args)...);
|
||||
case JSTRACE_SHAPE:
|
||||
return f(static_cast<Shape*>(thing), mozilla::Forward<Args>(args)...);
|
||||
case JSTRACE_OBJECT_GROUP:
|
||||
return f(static_cast<ObjectGroup*>(thing), mozilla::Forward<Args>(args)...);
|
||||
#define EXPAND_DEF(name, type, _) \
|
||||
case JS::TraceKind::name: \
|
||||
return f(static_cast<type*>(thing), mozilla::Forward<Args>(args)...);
|
||||
FOR_EACH_GC_LAYOUT(EXPAND_DEF);
|
||||
#undef EXPAND_DEF
|
||||
default:
|
||||
MOZ_CRASH("Invalid trace kind in CallTyped.");
|
||||
}
|
||||
@ -1148,9 +1131,9 @@ typedef HashSet<js::gc::Chunk*, GCChunkHasher, SystemAllocPolicy> GCChunkSet;
|
||||
typedef void (*IterateChunkCallback)(JSRuntime* rt, void* data, gc::Chunk* chunk);
|
||||
typedef void (*IterateZoneCallback)(JSRuntime* rt, void* data, JS::Zone* zone);
|
||||
typedef void (*IterateArenaCallback)(JSRuntime* rt, void* data, gc::Arena* arena,
|
||||
JSGCTraceKind traceKind, size_t thingSize);
|
||||
JS::TraceKind traceKind, size_t thingSize);
|
||||
typedef void (*IterateCellCallback)(JSRuntime* rt, void* data, void* thing,
|
||||
JSGCTraceKind traceKind, size_t thingSize);
|
||||
JS::TraceKind traceKind, size_t thingSize);
|
||||
|
||||
/*
|
||||
* This function calls |zoneCallback| on every zone, |compartmentCallback| on
|
||||
|
@ -346,7 +346,7 @@ StatsCompartmentCallback(JSRuntime* rt, void* data, JSCompartment* compartment)
|
||||
|
||||
static void
|
||||
StatsArenaCallback(JSRuntime* rt, void* data, gc::Arena* arena,
|
||||
JSGCTraceKind traceKind, size_t thingSize)
|
||||
JS::TraceKind traceKind, size_t thingSize)
|
||||
{
|
||||
RuntimeStats* rtStats = static_cast<StatsClosure*>(data)->rtStats;
|
||||
|
||||
@ -401,14 +401,14 @@ AddClassInfo(Granularity granularity, CompartmentStats* cStats, const char* clas
|
||||
// profile speed for complex pages such as gmail.com.
|
||||
template <Granularity granularity>
|
||||
static void
|
||||
StatsCellCallback(JSRuntime* rt, void* data, void* thing, JSGCTraceKind traceKind,
|
||||
StatsCellCallback(JSRuntime* rt, void* data, void* thing, JS::TraceKind traceKind,
|
||||
size_t thingSize)
|
||||
{
|
||||
StatsClosure* closure = static_cast<StatsClosure*>(data);
|
||||
RuntimeStats* rtStats = closure->rtStats;
|
||||
ZoneStats* zStats = rtStats->currZoneStats;
|
||||
switch (traceKind) {
|
||||
case JSTRACE_OBJECT: {
|
||||
case JS::TraceKind::Object: {
|
||||
JSObject* obj = static_cast<JSObject*>(thing);
|
||||
CompartmentStats* cStats = GetCompartmentStats(obj->compartment());
|
||||
JS::ClassInfo info; // This zeroes all the sizes.
|
||||
@ -429,7 +429,7 @@ StatsCellCallback(JSRuntime* rt, void* data, void* thing, JSGCTraceKind traceKin
|
||||
break;
|
||||
}
|
||||
|
||||
case JSTRACE_SCRIPT: {
|
||||
case JS::TraceKind::Script: {
|
||||
JSScript* script = static_cast<JSScript*>(thing);
|
||||
CompartmentStats* cStats = GetCompartmentStats(script->compartment());
|
||||
cStats->scriptsGCHeap += thingSize;
|
||||
@ -469,7 +469,7 @@ StatsCellCallback(JSRuntime* rt, void* data, void* thing, JSGCTraceKind traceKin
|
||||
break;
|
||||
}
|
||||
|
||||
case JSTRACE_STRING: {
|
||||
case JS::TraceKind::String: {
|
||||
JSString* str = static_cast<JSString*>(thing);
|
||||
|
||||
JS::StringInfo info;
|
||||
@ -499,11 +499,11 @@ StatsCellCallback(JSRuntime* rt, void* data, void* thing, JSGCTraceKind traceKin
|
||||
break;
|
||||
}
|
||||
|
||||
case JSTRACE_SYMBOL:
|
||||
case JS::TraceKind::Symbol:
|
||||
zStats->symbolsGCHeap += thingSize;
|
||||
break;
|
||||
|
||||
case JSTRACE_BASE_SHAPE: {
|
||||
case JS::TraceKind::BaseShape: {
|
||||
BaseShape* base = static_cast<BaseShape*>(thing);
|
||||
CompartmentStats* cStats = GetCompartmentStats(base->compartment());
|
||||
|
||||
@ -519,20 +519,20 @@ StatsCellCallback(JSRuntime* rt, void* data, void* thing, JSGCTraceKind traceKin
|
||||
break;
|
||||
}
|
||||
|
||||
case JSTRACE_JITCODE: {
|
||||
case JS::TraceKind::JitCode: {
|
||||
zStats->jitCodesGCHeap += thingSize;
|
||||
// The code for a script is counted in ExecutableAllocator::sizeOfCode().
|
||||
break;
|
||||
}
|
||||
|
||||
case JSTRACE_LAZY_SCRIPT: {
|
||||
case JS::TraceKind::LazyScript: {
|
||||
LazyScript* lazy = static_cast<LazyScript*>(thing);
|
||||
zStats->lazyScriptsGCHeap += thingSize;
|
||||
zStats->lazyScriptsMallocHeap += lazy->sizeOfExcludingThis(rtStats->mallocSizeOf_);
|
||||
break;
|
||||
}
|
||||
|
||||
case JSTRACE_SHAPE: {
|
||||
case JS::TraceKind::Shape: {
|
||||
Shape* shape = static_cast<Shape*>(thing);
|
||||
CompartmentStats* cStats = GetCompartmentStats(shape->compartment());
|
||||
JS::ClassInfo info; // This zeroes all the sizes.
|
||||
@ -550,7 +550,7 @@ StatsCellCallback(JSRuntime* rt, void* data, void* thing, JSGCTraceKind traceKin
|
||||
break;
|
||||
}
|
||||
|
||||
case JSTRACE_OBJECT_GROUP: {
|
||||
case JS::TraceKind::ObjectGroup: {
|
||||
ObjectGroup* group = static_cast<ObjectGroup*>(thing);
|
||||
zStats->objectGroupsGCHeap += thingSize;
|
||||
zStats->objectGroupsMallocHeap += group->sizeOfExcludingThis(rtStats->mallocSizeOf_);
|
||||
|
@ -62,7 +62,7 @@ struct Node::ConstructFunctor : public BoolDefaultAdaptor<Value, false> {
|
||||
template <typename T> bool operator()(T* t, Node* node) { node->construct(t); return true; }
|
||||
};
|
||||
|
||||
Node::Node(JSGCTraceKind kind, void* ptr)
|
||||
Node::Node(JS::TraceKind kind, void* ptr)
|
||||
{
|
||||
CallTyped(ConstructFunctor(), ptr, kind, this);
|
||||
}
|
||||
@ -108,11 +108,11 @@ class SimpleEdgeVectorTracer : public JS::CallbackTracer {
|
||||
// True if we should populate the edge's names.
|
||||
bool wantNames;
|
||||
|
||||
static void staticCallback(JS::CallbackTracer* trc, void** thingp, JSGCTraceKind kind) {
|
||||
static void staticCallback(JS::CallbackTracer* trc, void** thingp, JS::TraceKind kind) {
|
||||
static_cast<SimpleEdgeVectorTracer*>(trc)->callback(thingp, kind);
|
||||
}
|
||||
|
||||
void callback(void** thingp, JSGCTraceKind kind) {
|
||||
void callback(void** thingp, JS::TraceKind kind) {
|
||||
if (!okay)
|
||||
return;
|
||||
|
||||
@ -172,7 +172,7 @@ class SimpleEdgeRange : public EdgeRange {
|
||||
public:
|
||||
explicit SimpleEdgeRange(JSContext* cx) : edges(cx), i(0) { }
|
||||
|
||||
bool init(JSContext* cx, void* thing, JSGCTraceKind kind, bool wantNames = true) {
|
||||
bool init(JSContext* cx, void* thing, JS::TraceKind kind, bool wantNames = true) {
|
||||
SimpleEdgeVectorTracer tracer(cx, &edges, wantNames);
|
||||
JS_TraceChildren(&tracer, thing, kind);
|
||||
settle();
|
||||
@ -273,7 +273,6 @@ template class TracerConcrete<js::ObjectGroup>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace JS {
|
||||
namespace ubi {
|
||||
|
||||
|
@ -372,7 +372,7 @@ CreateGlobalObject(JSContext* cx, const JSClass* clasp, nsIPrincipal* principal,
|
||||
if (!((const js::Class*)clasp)->ext.isWrappedNative)
|
||||
{
|
||||
VerifyTraceProtoAndIfaceCacheCalledTracer trc(JS_GetRuntime(cx));
|
||||
JS_TraceChildren(&trc, global, JSTRACE_OBJECT);
|
||||
JS_TraceChildren(&trc, global, JS::TraceKind::Object);
|
||||
MOZ_ASSERT(trc.ok, "Trace hook on global needs to call TraceXPCGlobal for XPConnect compartments.");
|
||||
}
|
||||
#endif
|
||||
|
@ -121,7 +121,7 @@ public:
|
||||
|
||||
static void
|
||||
TraceWeakMappingChild(JS::CallbackTracer* aTrc, void** aThingp,
|
||||
JSGCTraceKind aKind);
|
||||
JS::TraceKind aKind);
|
||||
|
||||
struct NoteWeakMapChildrenTracer : public JS::CallbackTracer
|
||||
{
|
||||
@ -141,7 +141,7 @@ struct NoteWeakMapChildrenTracer : public JS::CallbackTracer
|
||||
|
||||
static void
|
||||
TraceWeakMappingChild(JS::CallbackTracer* aTrc, void** aThingp,
|
||||
JSGCTraceKind aKind)
|
||||
JS::TraceKind aKind)
|
||||
{
|
||||
MOZ_ASSERT(aTrc->hasCallback(TraceWeakMappingChild));
|
||||
NoteWeakMapChildrenTracer* tracer =
|
||||
@ -260,7 +260,7 @@ private:
|
||||
// If nothing that could be held alive by this entry is marked gray, return.
|
||||
bool delegateMightNeedMarking = aKey && JS::GCThingIsMarkedGray(aKey);
|
||||
bool valueMightNeedMarking = aValue && JS::GCThingIsMarkedGray(aValue) &&
|
||||
aValue.kind() != JSTRACE_STRING;
|
||||
aValue.kind() != JS::TraceKind::String;
|
||||
if (!delegateMightNeedMarking && !valueMightNeedMarking) {
|
||||
return;
|
||||
}
|
||||
@ -281,7 +281,7 @@ private:
|
||||
if (aValue && JS::GCThingIsMarkedGray(aValue) &&
|
||||
(!aKey || !JS::GCThingIsMarkedGray(aKey)) &&
|
||||
(!aMap || !JS::ObjectIsMarkedGray(aMap)) &&
|
||||
aValue.kind() != JSTRACE_SHAPE) {
|
||||
aValue.kind() != JS::TraceKind::Shape) {
|
||||
if (JS::UnmarkGrayGCThingRecursively(aValue)) {
|
||||
tracer->mAnyMarked = true;
|
||||
}
|
||||
@ -373,7 +373,7 @@ JSZoneParticipant::Traverse(void* aPtr, nsCycleCollectionTraversalCallback& aCb)
|
||||
|
||||
static void
|
||||
NoteJSChildTracerShim(JS::CallbackTracer* aTrc, void** aThingp,
|
||||
JSGCTraceKind aTraceKind);
|
||||
JS::TraceKind aTraceKind);
|
||||
|
||||
struct TraversalTracer : public JS::CallbackTracer
|
||||
{
|
||||
@ -429,7 +429,7 @@ NoteJSChild(JS::CallbackTracer* aTrc, JS::GCCellPtr aThing)
|
||||
|
||||
static void
|
||||
NoteJSChildTracerShim(JS::CallbackTracer* aTrc, void** aThingp,
|
||||
JSGCTraceKind aTraceKind)
|
||||
JS::TraceKind aTraceKind)
|
||||
{
|
||||
JS::GCCellPtr thing(*aThingp, aTraceKind);
|
||||
NoteJSChild(aTrc, thing);
|
||||
|
@ -334,10 +334,10 @@ private:
|
||||
|
||||
void TraceScriptHolder(nsISupports* aHolder, JSTracer* aTracer);
|
||||
|
||||
// Returns true if the JSGCTraceKind is one the cycle collector cares about.
|
||||
inline bool AddToCCKind(JSGCTraceKind aKind)
|
||||
// Returns true if the JS::TraceKind is one the cycle collector cares about.
|
||||
inline bool AddToCCKind(JS::TraceKind aKind)
|
||||
{
|
||||
return aKind == JSTRACE_OBJECT || aKind == JSTRACE_SCRIPT;
|
||||
return aKind == JS::TraceKind::Object || aKind == JS::TraceKind::Script;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -2007,7 +2007,7 @@ GCThingIsGrayCCThing(JS::GCCellPtr thing)
|
||||
static bool
|
||||
ValueIsGrayCCThing(const JS::Value& value)
|
||||
{
|
||||
return AddToCCKind(value.gcKind()) &&
|
||||
return AddToCCKind(value.traceKind()) &&
|
||||
JS::GCThingIsMarkedGray(value.toGCCellPtr());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user