diff --git a/js/src/gc/Barrier.h b/js/src/gc/Barrier.h index 1e8d4fd61bed..1da568f34e81 100644 --- a/js/src/gc/Barrier.h +++ b/js/src/gc/Barrier.h @@ -137,7 +137,7 @@ * For each of pointers, Values and jsids this file implements four classes, * illustrated here for the pointer (Ptr) classes: * - * BarrieredPtr abstract base class which provides common operations + * BarrieredBase abstract base class which provides common operations * | | | * | | PreBarriered provides pre-barriers only * | | @@ -411,13 +411,13 @@ struct InternalGCMethods * Base class for barriered pointer types. */ template -class BarrieredPtr : public HeapBase +class BarrieredBase : public HeapBase { protected: T value; - BarrieredPtr(T v) : value(v) {} - ~BarrieredPtr() { pre(); } + BarrieredBase(T v) : value(v) {} + ~BarrieredBase() { pre(); } public: void init(T v) { @@ -458,13 +458,13 @@ class BarrieredPtr : public HeapBase * of moving behavior, e.g. for HashMap keys. */ template -class PreBarriered : public BarrieredPtr +class PreBarriered : public BarrieredBase { public: - PreBarriered() : BarrieredPtr(GCMethods::initial()) {} - PreBarriered(T v) : BarrieredPtr(v) {} + PreBarriered() : BarrieredBase(GCMethods::initial()) {} + PreBarriered(T v) : BarrieredBase(v) {} explicit PreBarriered(const PreBarriered &v) - : BarrieredPtr(v.value) {} + : BarrieredBase(v.value) {} /* Use to set the pointer to nullptr. */ void clear() { @@ -500,12 +500,12 @@ class PreBarriered : public BarrieredPtr * where it may be implicitly moved or deleted, e.g. most containers. */ template -class HeapPtr : public BarrieredPtr +class HeapPtr : public BarrieredBase { public: - HeapPtr() : BarrieredPtr(GCMethods::initial()) {} - explicit HeapPtr(T v) : BarrieredPtr(v) { post(); } - explicit HeapPtr(const HeapPtr &v) : BarrieredPtr(v) { post(); } + HeapPtr() : BarrieredBase(GCMethods::initial()) {} + explicit HeapPtr(T v) : BarrieredBase(v) { post(); } + explicit HeapPtr(const HeapPtr &v) : BarrieredBase(v) { post(); } void init(T v) { JS_ASSERT(!GCMethods::poisoned(v)); @@ -590,11 +590,11 @@ class ImmutableTenuredPtr * used in contexts where this ability is necessary. */ template -class RelocatablePtr : public BarrieredPtr +class RelocatablePtr : public BarrieredBase { public: - RelocatablePtr() : BarrieredPtr(GCMethods::initial()) {} - explicit RelocatablePtr(T v) : BarrieredPtr(v) { + RelocatablePtr() : BarrieredBase(GCMethods::initial()) {} + explicit RelocatablePtr(T v) : BarrieredBase(v) { if (isMarkable(v)) post(); } @@ -605,7 +605,7 @@ class RelocatablePtr : public BarrieredPtr * function that will be used for both lvalue and rvalue copies, so we can * simply omit the rvalue variant. */ - RelocatablePtr(const RelocatablePtr &v) : BarrieredPtr(v) { + RelocatablePtr(const RelocatablePtr &v) : BarrieredBase(v) { if (isMarkable(this->value)) post(); } @@ -769,9 +769,6 @@ struct TypeObject; struct TypeObjectAddendum; } -typedef BarrieredPtr BarrieredPtrObject; -typedef BarrieredPtr BarrieredPtrScript; - typedef PreBarriered PreBarrieredObject; typedef PreBarriered PreBarrieredScript; typedef PreBarriered PreBarrieredJitCode; @@ -796,12 +793,10 @@ typedef HeapPtr HeapPtrJitCode; typedef HeapPtr HeapPtrTypeObject; typedef HeapPtr HeapPtrTypeObjectAddendum; -typedef BarrieredPtr BarrieredValue; typedef PreBarriered PreBarrieredValue; typedef RelocatablePtr RelocatableValue; typedef HeapPtr HeapValue; -typedef BarrieredPtr BarrieredId; typedef PreBarriered PreBarrieredId; typedef RelocatablePtr RelocatableId; typedef HeapPtr HeapId; @@ -823,7 +818,7 @@ typedef ReadBarriered ReadBarrieredValue; // A pre- and post-barriered Value that is specialized to be aware that it // resides in a slots or elements vector. This allows it to be relocated in // memory, but with substantially less overhead than a RelocatablePtr. -class HeapSlot : public BarrieredValue +class HeapSlot : public BarrieredBase { public: enum Kind { @@ -834,14 +829,14 @@ class HeapSlot : public BarrieredValue explicit HeapSlot() MOZ_DELETE; explicit HeapSlot(JSObject *obj, Kind kind, uint32_t slot, const Value &v) - : BarrieredValue(v) + : BarrieredBase(v) { JS_ASSERT(!IsPoisonedValue(v)); post(obj, kind, slot, v); } explicit HeapSlot(JSObject *obj, Kind kind, uint32_t slot, const HeapSlot &s) - : BarrieredValue(s.value) + : BarrieredBase(s.value) { JS_ASSERT(!IsPoisonedValue(s.value)); post(obj, kind, slot, s); @@ -918,7 +913,7 @@ class HeapSlot : public BarrieredValue }; static inline const Value * -Valueify(const BarrieredValue *array) +Valueify(const BarrieredBase *array) { JS_STATIC_ASSERT(sizeof(HeapValue) == sizeof(Value)); JS_STATIC_ASSERT(sizeof(HeapSlot) == sizeof(Value)); diff --git a/js/src/gc/Marking.cpp b/js/src/gc/Marking.cpp index a1891a703bf9..106768a33d47 100644 --- a/js/src/gc/Marking.cpp +++ b/js/src/gc/Marking.cpp @@ -263,7 +263,7 @@ MarkUnbarriered(JSTracer *trc, T **thingp, const char *name) template static void -Mark(JSTracer *trc, BarrieredPtr *thing, const char *name) +Mark(JSTracer *trc, BarrieredBase *thing, const char *name) { trc->setTracingName(name); MarkInternal(trc, thing->unsafeGet()); @@ -402,7 +402,7 @@ UpdateIfRelocated(JSRuntime *rt, T **thingp) #define DeclMarkerImpl(base, type) \ void \ -Mark##base(JSTracer *trc, BarrieredPtr *thing, const char *name) \ +Mark##base(JSTracer *trc, BarrieredBase *thing, const char *name) \ { \ Mark(trc, thing, name); \ } \ @@ -443,7 +443,7 @@ Is##base##Marked(type **thingp) } \ \ bool \ -Is##base##Marked(BarrieredPtr *thingp) \ +Is##base##Marked(BarrieredBase *thingp) \ { \ return IsMarked(thingp->unsafeGet()); \ } \ @@ -455,13 +455,13 @@ Is##base##AboutToBeFinalized(type **thingp) } \ \ bool \ -Is##base##AboutToBeFinalized(BarrieredPtr *thingp) \ +Is##base##AboutToBeFinalized(BarrieredBase *thingp) \ { \ return IsAboutToBeFinalized(thingp->unsafeGet()); \ } \ \ type * \ -Update##base##IfRelocated(JSRuntime *rt, BarrieredPtr *thingp) \ +Update##base##IfRelocated(JSRuntime *rt, BarrieredBase *thingp) \ { \ return UpdateIfRelocated(rt, thingp->unsafeGet()); \ } \ @@ -581,7 +581,7 @@ MarkIdInternal(JSTracer *trc, jsid *id) } void -gc::MarkId(JSTracer *trc, BarrieredId *id, const char *name) +gc::MarkId(JSTracer *trc, BarrieredBase *id, const char *name) { trc->setTracingName(name); MarkIdInternal(trc, id->unsafeGet()); @@ -642,7 +642,7 @@ MarkValueInternal(JSTracer *trc, Value *v) } void -gc::MarkValue(JSTracer *trc, BarrieredValue *v, const char *name) +gc::MarkValue(JSTracer *trc, BarrieredBase *v, const char *name) { trc->setTracingName(name); MarkValueInternal(trc, v->unsafeGet()); @@ -673,7 +673,7 @@ gc::MarkTypeRoot(JSTracer *trc, types::Type *v, const char *name) } void -gc::MarkValueRange(JSTracer *trc, size_t len, BarrieredValue *vec, const char *name) +gc::MarkValueRange(JSTracer *trc, size_t len, BarrieredBase *vec, const char *name) { for (size_t i = 0; i < len; ++i) { trc->setTracingIndex(name, i); @@ -975,7 +975,7 @@ ScanShape(GCMarker *gcmarker, Shape *shape) restart: PushMarkStack(gcmarker, shape->base()); - const BarrieredId &id = shape->propidRef(); + const BarrieredBase &id = shape->propidRef(); if (JSID_IS_STRING(id)) PushMarkStack(gcmarker, JSID_TO_STRING(id)); else if (MOZ_UNLIKELY(JSID_IS_OBJECT(id))) diff --git a/js/src/gc/Marking.h b/js/src/gc/Marking.h index db1cc33e88f8..d5137c40cc30 100644 --- a/js/src/gc/Marking.h +++ b/js/src/gc/Marking.h @@ -88,16 +88,16 @@ namespace gc { */ #define DeclMarker(base, type) \ -void Mark##base(JSTracer *trc, BarrieredPtr *thing, const char *name); \ +void Mark##base(JSTracer *trc, BarrieredBase *thing, const char *name); \ void Mark##base##Root(JSTracer *trc, type **thingp, const char *name); \ void Mark##base##Unbarriered(JSTracer *trc, type **thingp, const char *name); \ void Mark##base##Range(JSTracer *trc, size_t len, HeapPtr *thing, const char *name); \ void Mark##base##RootRange(JSTracer *trc, size_t len, type **thing, const char *name); \ bool Is##base##Marked(type **thingp); \ -bool Is##base##Marked(BarrieredPtr *thingp); \ +bool Is##base##Marked(BarrieredBase *thingp); \ bool Is##base##AboutToBeFinalized(type **thingp); \ -bool Is##base##AboutToBeFinalized(BarrieredPtr *thingp); \ -type *Update##base##IfRelocated(JSRuntime *rt, BarrieredPtr *thingp); \ +bool Is##base##AboutToBeFinalized(BarrieredBase *thingp); \ +type *Update##base##IfRelocated(JSRuntime *rt, BarrieredBase *thingp); \ type *Update##base##IfRelocated(JSRuntime *rt, type **thingp); DeclMarker(BaseShape, BaseShape) @@ -155,7 +155,7 @@ MarkGCThingUnbarriered(JSTracer *trc, void **thingp, const char *name); /*** ID Marking ***/ void -MarkId(JSTracer *trc, BarrieredId *id, const char *name); +MarkId(JSTracer *trc, BarrieredBase *id, const char *name); void MarkIdRoot(JSTracer *trc, jsid *id, const char *name); @@ -172,10 +172,10 @@ MarkIdRootRange(JSTracer *trc, size_t len, jsid *vec, const char *name); /*** Value Marking ***/ void -MarkValue(JSTracer *trc, BarrieredValue *v, const char *name); +MarkValue(JSTracer *trc, BarrieredBase *v, const char *name); void -MarkValueRange(JSTracer *trc, size_t len, BarrieredValue *vec, const char *name); +MarkValueRange(JSTracer *trc, size_t len, BarrieredBase *vec, const char *name); inline void MarkValueRange(JSTracer *trc, HeapValue *begin, HeapValue *end, const char *name) @@ -265,19 +265,19 @@ PushArena(GCMarker *gcmarker, ArenaHeader *aheader); */ inline void -Mark(JSTracer *trc, BarrieredValue *v, const char *name) +Mark(JSTracer *trc, BarrieredBase *v, const char *name) { MarkValue(trc, v, name); } inline void -Mark(JSTracer *trc, BarrieredPtrObject *o, const char *name) +Mark(JSTracer *trc, BarrieredBase *o, const char *name) { MarkObject(trc, o, name); } inline void -Mark(JSTracer *trc, BarrieredPtrScript *o, const char *name) +Mark(JSTracer *trc, BarrieredBase *o, const char *name) { MarkScript(trc, o, name); } @@ -309,7 +309,7 @@ bool IsCellAboutToBeFinalized(Cell **thing); inline bool -IsMarked(BarrieredValue *v) +IsMarked(BarrieredBase *v) { if (!v->isMarkable()) return true; @@ -317,19 +317,19 @@ IsMarked(BarrieredValue *v) } inline bool -IsMarked(BarrieredPtrObject *objp) +IsMarked(BarrieredBase *objp) { return IsObjectMarked(objp); } inline bool -IsMarked(BarrieredPtrScript *scriptp) +IsMarked(BarrieredBase *scriptp) { return IsScriptMarked(scriptp); } inline bool -IsAboutToBeFinalized(BarrieredValue *v) +IsAboutToBeFinalized(BarrieredBase *v) { if (!v->isMarkable()) return false; @@ -337,13 +337,13 @@ IsAboutToBeFinalized(BarrieredValue *v) } inline bool -IsAboutToBeFinalized(BarrieredPtrObject *objp) +IsAboutToBeFinalized(BarrieredBase *objp) { return IsObjectAboutToBeFinalized(objp); } inline bool -IsAboutToBeFinalized(BarrieredPtrScript *scriptp) +IsAboutToBeFinalized(BarrieredBase *scriptp) { return IsScriptAboutToBeFinalized(scriptp); }