зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1234862 - Part 1: Rename GCMethods to BarrierMethods; r=sfink
--HG-- extra : rebase_source : a773cf25e8e9986a154b8a8b0d04c6b9267545b8
This commit is contained in:
Родитель
654c768bd1
Коммит
eff749c612
|
@ -79,18 +79,22 @@ private:
|
|||
JSObject* mCompiled;
|
||||
};
|
||||
|
||||
friend struct js::GCMethods<nsXBLMaybeCompiled<UncompiledT>>;
|
||||
friend struct js::BarrierMethods<nsXBLMaybeCompiled<UncompiledT>>;
|
||||
};
|
||||
|
||||
/* Add support for JS::Heap<nsXBLMaybeCompiled>. */
|
||||
namespace js {
|
||||
|
||||
template <class UncompiledT>
|
||||
struct GCMethods<nsXBLMaybeCompiled<UncompiledT> >
|
||||
struct GCPolicy<nsXBLMaybeCompiled<UncompiledT>>
|
||||
{
|
||||
typedef struct GCMethods<JSObject *> Base;
|
||||
|
||||
static nsXBLMaybeCompiled<UncompiledT> initial() { return nsXBLMaybeCompiled<UncompiledT>(); }
|
||||
};
|
||||
|
||||
template <class UncompiledT>
|
||||
struct BarrierMethods<nsXBLMaybeCompiled<UncompiledT>>
|
||||
{
|
||||
typedef struct BarrierMethods<JSObject *> Base;
|
||||
|
||||
static void postBarrier(nsXBLMaybeCompiled<UncompiledT>* functionp,
|
||||
nsXBLMaybeCompiled<UncompiledT> prev,
|
||||
|
|
|
@ -150,7 +150,7 @@ class Builder {
|
|||
// A rooted reference to our value.
|
||||
PersistentRooted<T> value;
|
||||
|
||||
BuiltThing(JSContext* cx, Builder& owner_, T value_ = js::GCMethods<T>::initial())
|
||||
BuiltThing(JSContext* cx, Builder& owner_, T value_ = js::GCPolicy<T>::initial())
|
||||
: owner(owner_), value(cx, value_)
|
||||
{
|
||||
owner.assertBuilt(value_);
|
||||
|
|
|
@ -169,9 +169,14 @@ extern JS_PUBLIC_DATA(const JS::HandleId) JSID_EMPTYHANDLE;
|
|||
namespace js {
|
||||
|
||||
template <>
|
||||
struct GCMethods<jsid>
|
||||
struct GCPolicy<jsid>
|
||||
{
|
||||
static jsid initial() { return JSID_VOID; }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct BarrierMethods<jsid>
|
||||
{
|
||||
static void postBarrier(jsid* idp, jsid prev, jsid next) {}
|
||||
};
|
||||
|
||||
|
|
|
@ -105,7 +105,11 @@
|
|||
namespace js {
|
||||
|
||||
template <typename T>
|
||||
struct GCMethods {
|
||||
struct BarrierMethods {
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct GCPolicy {
|
||||
static T initial() { return T(); }
|
||||
};
|
||||
|
||||
|
@ -221,7 +225,7 @@ class Heap : public js::HeapBase<T>
|
|||
Heap() {
|
||||
static_assert(sizeof(T) == sizeof(Heap<T>),
|
||||
"Heap<T> must be binary compatible with T.");
|
||||
init(js::GCMethods<T>::initial());
|
||||
init(js::GCPolicy<T>::initial());
|
||||
}
|
||||
explicit Heap(T p) { init(p); }
|
||||
|
||||
|
@ -234,7 +238,7 @@ class Heap : public js::HeapBase<T>
|
|||
explicit Heap(const Heap<T>& p) { init(p.ptr); }
|
||||
|
||||
~Heap() {
|
||||
post(ptr, js::GCMethods<T>::initial());
|
||||
post(ptr, js::GCPolicy<T>::initial());
|
||||
}
|
||||
|
||||
DECLARE_POINTER_CONSTREF_OPS(T);
|
||||
|
@ -258,7 +262,7 @@ class Heap : public js::HeapBase<T>
|
|||
private:
|
||||
void init(T newPtr) {
|
||||
ptr = newPtr;
|
||||
post(js::GCMethods<T>::initial(), ptr);
|
||||
post(js::GCPolicy<T>::initial(), ptr);
|
||||
}
|
||||
|
||||
void set(T newPtr) {
|
||||
|
@ -268,7 +272,7 @@ class Heap : public js::HeapBase<T>
|
|||
}
|
||||
|
||||
void post(const T& prev, const T& next) {
|
||||
js::GCMethods<T>::postBarrier(&ptr, prev, next);
|
||||
js::BarrierMethods<T>::postBarrier(&ptr, prev, next);
|
||||
}
|
||||
|
||||
enum {
|
||||
|
@ -527,7 +531,7 @@ struct RootKind<T*>
|
|||
};
|
||||
|
||||
template <typename T>
|
||||
struct GCMethods<T*>
|
||||
struct BarrierMethods<T*>
|
||||
{
|
||||
static T* initial() { return nullptr; }
|
||||
static void postBarrier(T** vp, T* prev, T* next) {
|
||||
|
@ -538,7 +542,7 @@ struct GCMethods<T*>
|
|||
};
|
||||
|
||||
template <>
|
||||
struct GCMethods<JSObject*>
|
||||
struct BarrierMethods<JSObject*>
|
||||
{
|
||||
static JSObject* initial() { return nullptr; }
|
||||
static gc::Cell* asGCThingOrNull(JSObject* v) {
|
||||
|
@ -553,7 +557,7 @@ struct GCMethods<JSObject*>
|
|||
};
|
||||
|
||||
template <>
|
||||
struct GCMethods<JSFunction*>
|
||||
struct BarrierMethods<JSFunction*>
|
||||
{
|
||||
static JSFunction* initial() { return nullptr; }
|
||||
static void postBarrier(JSFunction** vp, JSFunction* prev, JSFunction* next) {
|
||||
|
@ -703,7 +707,7 @@ class MOZ_RAII Rooted : public js::RootedBase<T>
|
|||
public:
|
||||
template <typename RootingContext>
|
||||
explicit Rooted(const RootingContext& cx)
|
||||
: ptr(js::GCMethods<T>::initial())
|
||||
: ptr(js::GCPolicy<T>::initial())
|
||||
{
|
||||
registerWithRootLists(js::RootListsForRootingContext(cx));
|
||||
}
|
||||
|
@ -808,7 +812,7 @@ class MOZ_RAII FakeRooted : public RootedBase<T>
|
|||
{
|
||||
public:
|
||||
template <typename CX>
|
||||
explicit FakeRooted(CX* cx) : ptr(GCMethods<T>::initial()) {}
|
||||
explicit FakeRooted(CX* cx) : ptr(GCPolicy<T>::initial()) {}
|
||||
|
||||
template <typename CX>
|
||||
FakeRooted(CX* cx, T initial) : ptr(initial) {}
|
||||
|
@ -1025,11 +1029,11 @@ class PersistentRooted : public js::PersistentRootedBase<T>,
|
|||
}
|
||||
|
||||
public:
|
||||
PersistentRooted() : ptr(js::GCMethods<T>::initial()) {}
|
||||
PersistentRooted() : ptr(js::GCPolicy<T>::initial()) {}
|
||||
|
||||
template <typename RootingContext>
|
||||
explicit PersistentRooted(const RootingContext& cx)
|
||||
: ptr(js::GCMethods<T>::initial())
|
||||
: ptr(js::GCPolicy<T>::initial())
|
||||
{
|
||||
registerWithRootLists(js::RootListsForRootingContext(cx));
|
||||
}
|
||||
|
@ -1062,7 +1066,7 @@ class PersistentRooted : public js::PersistentRootedBase<T>,
|
|||
|
||||
template <typename RootingContext>
|
||||
void init(const RootingContext& cx) {
|
||||
init(cx, js::GCMethods<T>::initial());
|
||||
init(cx, js::GCPolicy<T>::initial());
|
||||
}
|
||||
|
||||
template <typename RootingContext, typename U>
|
||||
|
@ -1073,7 +1077,7 @@ class PersistentRooted : public js::PersistentRootedBase<T>,
|
|||
|
||||
void reset() {
|
||||
if (initialized()) {
|
||||
set(js::GCMethods<T>::initial());
|
||||
set(js::GCPolicy<T>::initial());
|
||||
ListBase::remove();
|
||||
}
|
||||
}
|
||||
|
@ -1162,7 +1166,7 @@ CallTraceCallbackOnNonHeap(T* v, const TraceCallbacks& aCallbacks, const char* a
|
|||
{
|
||||
static_assert(sizeof(T) == sizeof(JS::Heap<T>), "T and Heap<T> must be compatible.");
|
||||
MOZ_ASSERT(v);
|
||||
mozilla::DebugOnly<Cell*> cell = GCMethods<T>::asGCThingOrNull(*v);
|
||||
mozilla::DebugOnly<Cell*> cell = BarrierMethods<T>::asGCThingOrNull(*v);
|
||||
MOZ_ASSERT(cell);
|
||||
MOZ_ASSERT(!IsInsideNursery(cell));
|
||||
JS::Heap<T>* asHeapT = reinterpret_cast<JS::Heap<T>*>(v);
|
||||
|
|
|
@ -1699,14 +1699,15 @@ JS_PUBLIC_API(void) HeapValuePostBarrier(Value* valuep, const Value& prev, const
|
|||
|
||||
namespace js {
|
||||
|
||||
template <> struct GCMethods<const JS::Value>
|
||||
template <>
|
||||
struct GCPolicy<JS::Value>
|
||||
{
|
||||
static JS::Value initial() { return JS::UndefinedValue(); }
|
||||
};
|
||||
|
||||
template <> struct GCMethods<JS::Value>
|
||||
template <>
|
||||
struct BarrierMethods<JS::Value>
|
||||
{
|
||||
static JS::Value initial() { return JS::UndefinedValue(); }
|
||||
static gc::Cell* asGCThingOrNull(const JS::Value& v) {
|
||||
return v.isMarkable() ? v.toGCThing() : nullptr;
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ template <typename T>
|
|||
void
|
||||
ReadBarrierFunctor<S>::operator()(T* t)
|
||||
{
|
||||
InternalGCMethods<T*>::readBarrier(t);
|
||||
InternalBarrierMethods<T*>::readBarrier(t);
|
||||
}
|
||||
template void ReadBarrierFunctor<JS::Value>::operator()<JS::Symbol>(JS::Symbol*);
|
||||
template void ReadBarrierFunctor<JS::Value>::operator()<JSObject>(JSObject*);
|
||||
|
@ -101,7 +101,7 @@ template <typename T>
|
|||
void
|
||||
PreBarrierFunctor<S>::operator()(T* t)
|
||||
{
|
||||
InternalGCMethods<T*>::preBarrier(t);
|
||||
InternalBarrierMethods<T*>::preBarrier(t);
|
||||
}
|
||||
template void PreBarrierFunctor<JS::Value>::operator()<JS::Symbol>(JS::Symbol*);
|
||||
template void PreBarrierFunctor<JS::Value>::operator()<JSObject>(JSObject*);
|
||||
|
@ -170,12 +170,12 @@ JS_PUBLIC_API(void)
|
|||
JS::HeapObjectPostBarrier(JSObject** objp, JSObject* prev, JSObject* next)
|
||||
{
|
||||
MOZ_ASSERT(objp);
|
||||
js::InternalGCMethods<JSObject*>::postBarrier(objp, prev, next);
|
||||
js::InternalBarrierMethods<JSObject*>::postBarrier(objp, prev, next);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS::HeapValuePostBarrier(JS::Value* valuep, const Value& prev, const Value& next)
|
||||
{
|
||||
MOZ_ASSERT(valuep);
|
||||
js::InternalGCMethods<JS::Value>::postBarrier(valuep, prev, next);
|
||||
js::InternalBarrierMethods<JS::Value>::postBarrier(valuep, prev, next);
|
||||
}
|
||||
|
|
|
@ -156,23 +156,23 @@
|
|||
* via:
|
||||
*
|
||||
* WriteBarrieredBase<T>::pre
|
||||
* -> InternalGCMethods<T*>::preBarrier
|
||||
* -> InternalBarrierMethods<T*>::preBarrier
|
||||
* -> T::writeBarrierPre
|
||||
* -> InternalGCMethods<Value>::preBarrier
|
||||
* -> InternalGCMethods<jsid>::preBarrier
|
||||
* -> InternalGCMethods<T*>::preBarrier
|
||||
* -> InternalBarrierMethods<Value>::preBarrier
|
||||
* -> InternalBarrierMethods<jsid>::preBarrier
|
||||
* -> InternalBarrierMethods<T*>::preBarrier
|
||||
* -> T::writeBarrierPre
|
||||
*
|
||||
* HeapPtr<T>::post and RelocatablePtr<T>::post
|
||||
* -> InternalGCMethods<T*>::postBarrier
|
||||
* -> InternalBarrierMethods<T*>::postBarrier
|
||||
* -> T::writeBarrierPost
|
||||
* -> InternalGCMethods<Value>::postBarrier
|
||||
* -> InternalBarrierMethods<Value>::postBarrier
|
||||
* -> StoreBuffer::put
|
||||
*
|
||||
* These classes are designed to be used by the internals of the JS engine.
|
||||
* Barriers designed to be used externally are provided in js/RootingAPI.h.
|
||||
* These external barriers call into the same post-barrier implementations at
|
||||
* InternalGCMethods<T>::post via an indirect call to Heap(.+)Barrier.
|
||||
* InternalBarrierMethods<T>::post via an indirect call to Heap(.+)Barrier.
|
||||
*/
|
||||
|
||||
class JSAtom;
|
||||
|
@ -240,10 +240,10 @@ void MarkIdForBarrier(JSTracer* trc, jsid* idp, const char* name);
|
|||
} // namespace gc
|
||||
|
||||
template <typename T>
|
||||
struct InternalGCMethods {};
|
||||
struct InternalBarrierMethods {};
|
||||
|
||||
template <typename T>
|
||||
struct InternalGCMethods<T*>
|
||||
struct InternalBarrierMethods<T*>
|
||||
{
|
||||
static bool isMarkable(T* v) { return v != nullptr; }
|
||||
|
||||
|
@ -265,7 +265,7 @@ template <typename S> struct ReadBarrierFunctor : public VoidDefaultAdaptor<S> {
|
|||
};
|
||||
|
||||
template <>
|
||||
struct InternalGCMethods<Value>
|
||||
struct InternalBarrierMethods<Value>
|
||||
{
|
||||
static bool isMarkable(Value v) { return v.isMarkable(); }
|
||||
static bool isMarkableTaggedPointer(Value v) { return isMarkable(v); }
|
||||
|
@ -301,7 +301,7 @@ struct InternalGCMethods<Value>
|
|||
};
|
||||
|
||||
template <>
|
||||
struct InternalGCMethods<jsid>
|
||||
struct InternalBarrierMethods<jsid>
|
||||
{
|
||||
static bool isMarkable(jsid id) { return JSID_IS_STRING(id) || JSID_IS_SYMBOL(id); }
|
||||
static bool isMarkableTaggedPointer(jsid id) { return isMarkable(id); }
|
||||
|
@ -368,11 +368,11 @@ class WriteBarrieredBase : public BarrieredBase<T>
|
|||
void unsafeSet(T v) { this->value = v; }
|
||||
|
||||
// For users who need to manually barrier the raw types.
|
||||
static void writeBarrierPre(const T& v) { InternalGCMethods<T>::preBarrier(v); }
|
||||
static void writeBarrierPre(const T& v) { InternalBarrierMethods<T>::preBarrier(v); }
|
||||
|
||||
protected:
|
||||
void pre() { InternalGCMethods<T>::preBarrier(this->value); }
|
||||
void post(T prev, T next) { InternalGCMethods<T>::postBarrier(&this->value, prev, next); }
|
||||
void pre() { InternalBarrierMethods<T>::preBarrier(this->value); }
|
||||
void post(T prev, T next) { InternalBarrierMethods<T>::postBarrier(&this->value, prev, next); }
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -385,7 +385,7 @@ template <class T>
|
|||
class PreBarriered : public WriteBarrieredBase<T>
|
||||
{
|
||||
public:
|
||||
PreBarriered() : WriteBarrieredBase<T>(GCMethods<T>::initial()) {}
|
||||
PreBarriered() : WriteBarrieredBase<T>(GCPolicy<T>::initial()) {}
|
||||
/*
|
||||
* Allow implicit construction for use in generic contexts, such as DebuggerWeakMap::markKeys.
|
||||
*/
|
||||
|
@ -430,12 +430,12 @@ template <class T>
|
|||
class HeapPtr : public WriteBarrieredBase<T>
|
||||
{
|
||||
public:
|
||||
HeapPtr() : WriteBarrieredBase<T>(GCMethods<T>::initial()) {}
|
||||
HeapPtr() : WriteBarrieredBase<T>(GCPolicy<T>::initial()) {}
|
||||
explicit HeapPtr(T v) : WriteBarrieredBase<T>(v) {
|
||||
this->post(GCMethods<T>::initial(), v);
|
||||
this->post(GCPolicy<T>::initial(), v);
|
||||
}
|
||||
explicit HeapPtr(const HeapPtr<T>& v) : WriteBarrieredBase<T>(v) {
|
||||
this->post(GCMethods<T>::initial(), v);
|
||||
this->post(GCPolicy<T>::initial(), v);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
~HeapPtr() {
|
||||
|
@ -447,7 +447,7 @@ class HeapPtr : public WriteBarrieredBase<T>
|
|||
|
||||
void init(T v) {
|
||||
this->value = v;
|
||||
this->post(GCMethods<T>::initial(), v);
|
||||
this->post(GCPolicy<T>::initial(), v);
|
||||
}
|
||||
|
||||
DECLARE_POINTER_ASSIGN_OPS(HeapPtr, T);
|
||||
|
@ -482,11 +482,11 @@ template <class T>
|
|||
class RelocatablePtr : public WriteBarrieredBase<T>
|
||||
{
|
||||
public:
|
||||
RelocatablePtr() : WriteBarrieredBase<T>(GCMethods<T>::initial()) {}
|
||||
RelocatablePtr() : WriteBarrieredBase<T>(GCPolicy<T>::initial()) {}
|
||||
|
||||
// Implicitly adding barriers is a reasonable default.
|
||||
MOZ_IMPLICIT RelocatablePtr(const T& v) : WriteBarrieredBase<T>(v) {
|
||||
this->post(GCMethods<T>::initial(), this->value);
|
||||
this->post(GCPolicy<T>::initial(), this->value);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -496,17 +496,17 @@ class RelocatablePtr : public WriteBarrieredBase<T>
|
|||
* simply omit the rvalue variant.
|
||||
*/
|
||||
MOZ_IMPLICIT RelocatablePtr(const RelocatablePtr<T>& v) : WriteBarrieredBase<T>(v) {
|
||||
this->post(GCMethods<T>::initial(), this->value);
|
||||
this->post(GCPolicy<T>::initial(), this->value);
|
||||
}
|
||||
|
||||
~RelocatablePtr() {
|
||||
this->pre();
|
||||
this->post(this->value, GCMethods<T>::initial());
|
||||
this->post(this->value, GCPolicy<T>::initial());
|
||||
}
|
||||
|
||||
void init(T v) {
|
||||
this->value = v;
|
||||
this->post(GCMethods<T>::initial(), this->value);
|
||||
this->post(GCPolicy<T>::initial(), this->value);
|
||||
}
|
||||
|
||||
DECLARE_POINTER_ASSIGN_OPS(RelocatablePtr, T);
|
||||
|
@ -540,8 +540,8 @@ class ReadBarrieredBase : public BarrieredBase<T>
|
|||
explicit ReadBarrieredBase(T v) : BarrieredBase<T>(v) {}
|
||||
|
||||
protected:
|
||||
void read() const { InternalGCMethods<T>::readBarrier(this->value); }
|
||||
void post(T prev, T next) { InternalGCMethods<T>::postBarrier(&this->value, prev, next); }
|
||||
void read() const { InternalBarrierMethods<T>::readBarrier(this->value); }
|
||||
void post(T prev, T next) { InternalBarrierMethods<T>::postBarrier(&this->value, prev, next); }
|
||||
};
|
||||
|
||||
// Incremental GC requires that weak pointers have read barriers. This is mostly
|
||||
|
@ -561,16 +561,16 @@ template <typename T>
|
|||
class ReadBarriered : public ReadBarrieredBase<T>
|
||||
{
|
||||
public:
|
||||
ReadBarriered() : ReadBarrieredBase<T>(GCMethods<T>::initial()) {}
|
||||
ReadBarriered() : ReadBarrieredBase<T>(GCPolicy<T>::initial()) {}
|
||||
|
||||
// It is okay to add barriers implicitly.
|
||||
MOZ_IMPLICIT ReadBarriered(const T& v) : ReadBarrieredBase<T>(v) {
|
||||
this->post(GCMethods<T>::initial(), v);
|
||||
this->post(GCPolicy<T>::initial(), v);
|
||||
}
|
||||
|
||||
// Copy is creating a new edge, so we must read barrier the source edge.
|
||||
explicit ReadBarriered(const ReadBarriered& v) : ReadBarrieredBase<T>(v) {
|
||||
this->post(GCMethods<T>::initial(), v.get());
|
||||
this->post(GCPolicy<T>::initial(), v.get());
|
||||
}
|
||||
|
||||
// Move retains the lifetime status of the source edge, so does not fire
|
||||
|
@ -578,11 +578,11 @@ class ReadBarriered : public ReadBarrieredBase<T>
|
|||
ReadBarriered(ReadBarriered&& v)
|
||||
: ReadBarrieredBase<T>(mozilla::Forward<ReadBarriered<T>>(v))
|
||||
{
|
||||
this->post(GCMethods<T>::initial(), v.value);
|
||||
this->post(GCPolicy<T>::initial(), v.value);
|
||||
}
|
||||
|
||||
~ReadBarriered() {
|
||||
this->post(this->value, GCMethods<T>::initial());
|
||||
this->post(this->value, GCPolicy<T>::initial());
|
||||
}
|
||||
|
||||
ReadBarriered& operator=(const ReadBarriered& v) {
|
||||
|
@ -593,8 +593,8 @@ class ReadBarriered : public ReadBarrieredBase<T>
|
|||
}
|
||||
|
||||
const T get() const {
|
||||
if (!InternalGCMethods<T>::isMarkable(this->value))
|
||||
return GCMethods<T>::initial();
|
||||
if (!InternalBarrierMethods<T>::isMarkable(this->value))
|
||||
return GCPolicy<T>::initial();
|
||||
this->read();
|
||||
return this->value;
|
||||
}
|
||||
|
|
|
@ -403,7 +403,7 @@ JS_PUBLIC_API(void)
|
|||
JS::TraceEdge(JSTracer* trc, JS::Heap<T>* thingp, const char* name)
|
||||
{
|
||||
MOZ_ASSERT(thingp);
|
||||
if (InternalGCMethods<T>::isMarkable(thingp->get()))
|
||||
if (InternalBarrierMethods<T>::isMarkable(thingp->get()))
|
||||
DispatchToTracer(trc, ConvertToBase(thingp->unsafeGet()), name);
|
||||
}
|
||||
|
||||
|
@ -463,7 +463,7 @@ void
|
|||
js::TraceNullableRoot(JSTracer* trc, T* thingp, const char* name)
|
||||
{
|
||||
AssertRootMarkingPhase(trc);
|
||||
if (InternalGCMethods<T>::isMarkableTaggedPointer(*thingp))
|
||||
if (InternalBarrierMethods<T>::isMarkableTaggedPointer(*thingp))
|
||||
DispatchToTracer(trc, ConvertToBase(thingp), name);
|
||||
}
|
||||
|
||||
|
@ -488,7 +488,7 @@ js::TraceRange(JSTracer* trc, size_t len, WriteBarrieredBase<T>* vec, const char
|
|||
{
|
||||
JS::AutoTracingIndex index(trc);
|
||||
for (auto i : MakeRange(len)) {
|
||||
if (InternalGCMethods<T>::isMarkable(vec[i].get()))
|
||||
if (InternalBarrierMethods<T>::isMarkable(vec[i].get()))
|
||||
DispatchToTracer(trc, ConvertToBase(vec[i].unsafeUnbarrieredForTracing()), name);
|
||||
++index;
|
||||
}
|
||||
|
@ -501,7 +501,7 @@ js::TraceRootRange(JSTracer* trc, size_t len, T* vec, const char* name)
|
|||
AssertRootMarkingPhase(trc);
|
||||
JS::AutoTracingIndex index(trc);
|
||||
for (auto i : MakeRange(len)) {
|
||||
if (InternalGCMethods<T>::isMarkable(vec[i]))
|
||||
if (InternalBarrierMethods<T>::isMarkable(vec[i]))
|
||||
DispatchToTracer(trc, ConvertToBase(&vec[i]), name);
|
||||
++index;
|
||||
}
|
||||
|
|
|
@ -1482,11 +1482,11 @@ class ReservedRooted : public ReservedRootedBase<T>
|
|||
}
|
||||
|
||||
explicit ReservedRooted(Rooted<T>* root) : savedRoot(root) {
|
||||
*root = js::GCMethods<T>::initial();
|
||||
*root = js::GCPolicy<T>::initial();
|
||||
}
|
||||
|
||||
~ReservedRooted() {
|
||||
*savedRoot = js::GCMethods<T>::initial();
|
||||
*savedRoot = js::GCPolicy<T>::initial();
|
||||
}
|
||||
|
||||
void set(const T& p) const { *savedRoot = p; }
|
||||
|
|
|
@ -14,17 +14,18 @@
|
|||
namespace js {
|
||||
|
||||
/* static */ void
|
||||
InternalGCMethods<TaggedProto>::preBarrier(TaggedProto& proto)
|
||||
InternalBarrierMethods<TaggedProto>::preBarrier(TaggedProto& proto)
|
||||
{
|
||||
InternalGCMethods<JSObject*>::preBarrier(proto.toObjectOrNull());
|
||||
InternalBarrierMethods<JSObject*>::preBarrier(proto.toObjectOrNull());
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
InternalGCMethods<TaggedProto>::postBarrier(TaggedProto* vp, TaggedProto prev, TaggedProto next)
|
||||
InternalBarrierMethods<TaggedProto>::postBarrier(TaggedProto* vp, TaggedProto prev,
|
||||
TaggedProto next)
|
||||
{
|
||||
JSObject* prevObj = prev.isObject() ? prev.toObject() : nullptr;
|
||||
JSObject* nextObj = next.isObject() ? next.toObject() : nullptr;
|
||||
InternalGCMethods<JSObject*>::postBarrier(reinterpret_cast<JSObject**>(vp), prevObj,
|
||||
InternalBarrierMethods<JSObject*>::postBarrier(reinterpret_cast<JSObject**>(vp), prevObj,
|
||||
nextObj);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,12 +52,14 @@ class TaggedProto : public JS::Traceable
|
|||
JSObject* proto;
|
||||
};
|
||||
|
||||
template <> struct GCMethods<TaggedProto>
|
||||
template <>
|
||||
struct GCPolicy<TaggedProto>
|
||||
{
|
||||
static TaggedProto initial() { return TaggedProto(); }
|
||||
};
|
||||
|
||||
template <> struct InternalGCMethods<TaggedProto>
|
||||
template <>
|
||||
struct InternalBarrierMethods<TaggedProto>
|
||||
{
|
||||
static void preBarrier(TaggedProto& proto);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче