зеркало из https://github.com/mozilla/gecko-dev.git
Bug 989414 - Rename BarrieredPtr to BarrieredBase to match new usage; r=jonco
--HG-- extra : rebase_source : ce3bc7ca91169940fbc19f731eb10443b22d4dad
This commit is contained in:
Родитель
ca8ff4a0b0
Коммит
1620a120de
|
@ -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<jsid>
|
|||
* Base class for barriered pointer types.
|
||||
*/
|
||||
template <class T>
|
||||
class BarrieredPtr : public HeapBase<T>
|
||||
class BarrieredBase : public HeapBase<T>
|
||||
{
|
||||
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<T>
|
|||
* of moving behavior, e.g. for HashMap keys.
|
||||
*/
|
||||
template <class T>
|
||||
class PreBarriered : public BarrieredPtr<T>
|
||||
class PreBarriered : public BarrieredBase<T>
|
||||
{
|
||||
public:
|
||||
PreBarriered() : BarrieredPtr<T>(GCMethods<T>::initial()) {}
|
||||
PreBarriered(T v) : BarrieredPtr<T>(v) {}
|
||||
PreBarriered() : BarrieredBase<T>(GCMethods<T>::initial()) {}
|
||||
PreBarriered(T v) : BarrieredBase<T>(v) {}
|
||||
explicit PreBarriered(const PreBarriered<T> &v)
|
||||
: BarrieredPtr<T>(v.value) {}
|
||||
: BarrieredBase<T>(v.value) {}
|
||||
|
||||
/* Use to set the pointer to nullptr. */
|
||||
void clear() {
|
||||
|
@ -500,12 +500,12 @@ class PreBarriered : public BarrieredPtr<T>
|
|||
* where it may be implicitly moved or deleted, e.g. most containers.
|
||||
*/
|
||||
template <class T>
|
||||
class HeapPtr : public BarrieredPtr<T>
|
||||
class HeapPtr : public BarrieredBase<T>
|
||||
{
|
||||
public:
|
||||
HeapPtr() : BarrieredPtr<T>(GCMethods<T>::initial()) {}
|
||||
explicit HeapPtr(T v) : BarrieredPtr<T>(v) { post(); }
|
||||
explicit HeapPtr(const HeapPtr<T> &v) : BarrieredPtr<T>(v) { post(); }
|
||||
HeapPtr() : BarrieredBase<T>(GCMethods<T>::initial()) {}
|
||||
explicit HeapPtr(T v) : BarrieredBase<T>(v) { post(); }
|
||||
explicit HeapPtr(const HeapPtr<T> &v) : BarrieredBase<T>(v) { post(); }
|
||||
|
||||
void init(T v) {
|
||||
JS_ASSERT(!GCMethods<T>::poisoned(v));
|
||||
|
@ -590,11 +590,11 @@ class ImmutableTenuredPtr
|
|||
* used in contexts where this ability is necessary.
|
||||
*/
|
||||
template <class T>
|
||||
class RelocatablePtr : public BarrieredPtr<T>
|
||||
class RelocatablePtr : public BarrieredBase<T>
|
||||
{
|
||||
public:
|
||||
RelocatablePtr() : BarrieredPtr<T>(GCMethods<T>::initial()) {}
|
||||
explicit RelocatablePtr(T v) : BarrieredPtr<T>(v) {
|
||||
RelocatablePtr() : BarrieredBase<T>(GCMethods<T>::initial()) {}
|
||||
explicit RelocatablePtr(T v) : BarrieredBase<T>(v) {
|
||||
if (isMarkable(v))
|
||||
post();
|
||||
}
|
||||
|
@ -605,7 +605,7 @@ class RelocatablePtr : public BarrieredPtr<T>
|
|||
* function that will be used for both lvalue and rvalue copies, so we can
|
||||
* simply omit the rvalue variant.
|
||||
*/
|
||||
RelocatablePtr(const RelocatablePtr<T> &v) : BarrieredPtr<T>(v) {
|
||||
RelocatablePtr(const RelocatablePtr<T> &v) : BarrieredBase<T>(v) {
|
||||
if (isMarkable(this->value))
|
||||
post();
|
||||
}
|
||||
|
@ -769,9 +769,6 @@ struct TypeObject;
|
|||
struct TypeObjectAddendum;
|
||||
}
|
||||
|
||||
typedef BarrieredPtr<JSObject*> BarrieredPtrObject;
|
||||
typedef BarrieredPtr<JSScript*> BarrieredPtrScript;
|
||||
|
||||
typedef PreBarriered<JSObject*> PreBarrieredObject;
|
||||
typedef PreBarriered<JSScript*> PreBarrieredScript;
|
||||
typedef PreBarriered<jit::JitCode*> PreBarrieredJitCode;
|
||||
|
@ -796,12 +793,10 @@ typedef HeapPtr<jit::JitCode*> HeapPtrJitCode;
|
|||
typedef HeapPtr<types::TypeObject*> HeapPtrTypeObject;
|
||||
typedef HeapPtr<types::TypeObjectAddendum*> HeapPtrTypeObjectAddendum;
|
||||
|
||||
typedef BarrieredPtr<Value> BarrieredValue;
|
||||
typedef PreBarriered<Value> PreBarrieredValue;
|
||||
typedef RelocatablePtr<Value> RelocatableValue;
|
||||
typedef HeapPtr<Value> HeapValue;
|
||||
|
||||
typedef BarrieredPtr<jsid> BarrieredId;
|
||||
typedef PreBarriered<jsid> PreBarrieredId;
|
||||
typedef RelocatablePtr<jsid> RelocatableId;
|
||||
typedef HeapPtr<jsid> HeapId;
|
||||
|
@ -823,7 +818,7 @@ typedef ReadBarriered<Value> 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<Value>
|
||||
{
|
||||
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<Value>(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<Value>(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<Value> *array)
|
||||
{
|
||||
JS_STATIC_ASSERT(sizeof(HeapValue) == sizeof(Value));
|
||||
JS_STATIC_ASSERT(sizeof(HeapSlot) == sizeof(Value));
|
||||
|
|
|
@ -263,7 +263,7 @@ MarkUnbarriered(JSTracer *trc, T **thingp, const char *name)
|
|||
|
||||
template <typename T>
|
||||
static void
|
||||
Mark(JSTracer *trc, BarrieredPtr<T*> *thing, const char *name)
|
||||
Mark(JSTracer *trc, BarrieredBase<T*> *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<type*> *thing, const char *name) \
|
||||
Mark##base(JSTracer *trc, BarrieredBase<type*> *thing, const char *name) \
|
||||
{ \
|
||||
Mark<type>(trc, thing, name); \
|
||||
} \
|
||||
|
@ -443,7 +443,7 @@ Is##base##Marked(type **thingp)
|
|||
} \
|
||||
\
|
||||
bool \
|
||||
Is##base##Marked(BarrieredPtr<type*> *thingp) \
|
||||
Is##base##Marked(BarrieredBase<type*> *thingp) \
|
||||
{ \
|
||||
return IsMarked<type>(thingp->unsafeGet()); \
|
||||
} \
|
||||
|
@ -455,13 +455,13 @@ Is##base##AboutToBeFinalized(type **thingp)
|
|||
} \
|
||||
\
|
||||
bool \
|
||||
Is##base##AboutToBeFinalized(BarrieredPtr<type*> *thingp) \
|
||||
Is##base##AboutToBeFinalized(BarrieredBase<type*> *thingp) \
|
||||
{ \
|
||||
return IsAboutToBeFinalized<type>(thingp->unsafeGet()); \
|
||||
} \
|
||||
\
|
||||
type * \
|
||||
Update##base##IfRelocated(JSRuntime *rt, BarrieredPtr<type*> *thingp) \
|
||||
Update##base##IfRelocated(JSRuntime *rt, BarrieredBase<type*> *thingp) \
|
||||
{ \
|
||||
return UpdateIfRelocated<type>(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<jsid> *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<Value> *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<Value> *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<jsid> &id = shape->propidRef();
|
||||
if (JSID_IS_STRING(id))
|
||||
PushMarkStack(gcmarker, JSID_TO_STRING(id));
|
||||
else if (MOZ_UNLIKELY(JSID_IS_OBJECT(id)))
|
||||
|
|
|
@ -88,16 +88,16 @@ namespace gc {
|
|||
*/
|
||||
|
||||
#define DeclMarker(base, type) \
|
||||
void Mark##base(JSTracer *trc, BarrieredPtr<type*> *thing, const char *name); \
|
||||
void Mark##base(JSTracer *trc, BarrieredBase<type*> *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<type*> *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<type*> *thingp); \
|
||||
bool Is##base##Marked(BarrieredBase<type*> *thingp); \
|
||||
bool Is##base##AboutToBeFinalized(type **thingp); \
|
||||
bool Is##base##AboutToBeFinalized(BarrieredPtr<type*> *thingp); \
|
||||
type *Update##base##IfRelocated(JSRuntime *rt, BarrieredPtr<type*> *thingp); \
|
||||
bool Is##base##AboutToBeFinalized(BarrieredBase<type*> *thingp); \
|
||||
type *Update##base##IfRelocated(JSRuntime *rt, BarrieredBase<type*> *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<jsid> *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<Value> *v, const char *name);
|
||||
|
||||
void
|
||||
MarkValueRange(JSTracer *trc, size_t len, BarrieredValue *vec, const char *name);
|
||||
MarkValueRange(JSTracer *trc, size_t len, BarrieredBase<Value> *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<Value> *v, const char *name)
|
||||
{
|
||||
MarkValue(trc, v, name);
|
||||
}
|
||||
|
||||
inline void
|
||||
Mark(JSTracer *trc, BarrieredPtrObject *o, const char *name)
|
||||
Mark(JSTracer *trc, BarrieredBase<JSObject*> *o, const char *name)
|
||||
{
|
||||
MarkObject(trc, o, name);
|
||||
}
|
||||
|
||||
inline void
|
||||
Mark(JSTracer *trc, BarrieredPtrScript *o, const char *name)
|
||||
Mark(JSTracer *trc, BarrieredBase<JSScript*> *o, const char *name)
|
||||
{
|
||||
MarkScript(trc, o, name);
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ bool
|
|||
IsCellAboutToBeFinalized(Cell **thing);
|
||||
|
||||
inline bool
|
||||
IsMarked(BarrieredValue *v)
|
||||
IsMarked(BarrieredBase<Value> *v)
|
||||
{
|
||||
if (!v->isMarkable())
|
||||
return true;
|
||||
|
@ -317,19 +317,19 @@ IsMarked(BarrieredValue *v)
|
|||
}
|
||||
|
||||
inline bool
|
||||
IsMarked(BarrieredPtrObject *objp)
|
||||
IsMarked(BarrieredBase<JSObject*> *objp)
|
||||
{
|
||||
return IsObjectMarked(objp);
|
||||
}
|
||||
|
||||
inline bool
|
||||
IsMarked(BarrieredPtrScript *scriptp)
|
||||
IsMarked(BarrieredBase<JSScript*> *scriptp)
|
||||
{
|
||||
return IsScriptMarked(scriptp);
|
||||
}
|
||||
|
||||
inline bool
|
||||
IsAboutToBeFinalized(BarrieredValue *v)
|
||||
IsAboutToBeFinalized(BarrieredBase<Value> *v)
|
||||
{
|
||||
if (!v->isMarkable())
|
||||
return false;
|
||||
|
@ -337,13 +337,13 @@ IsAboutToBeFinalized(BarrieredValue *v)
|
|||
}
|
||||
|
||||
inline bool
|
||||
IsAboutToBeFinalized(BarrieredPtrObject *objp)
|
||||
IsAboutToBeFinalized(BarrieredBase<JSObject*> *objp)
|
||||
{
|
||||
return IsObjectAboutToBeFinalized(objp);
|
||||
}
|
||||
|
||||
inline bool
|
||||
IsAboutToBeFinalized(BarrieredPtrScript *scriptp)
|
||||
IsAboutToBeFinalized(BarrieredBase<JSScript*> *scriptp)
|
||||
{
|
||||
return IsScriptAboutToBeFinalized(scriptp);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче