зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1021114 - Remove GCMethods::kind() in favour or RootKind::rootKind() r=terrence
This commit is contained in:
Родитель
f9ee688bb5
Коммит
1e52d084da
|
@ -16,6 +16,9 @@
|
||||||
* The purpose of abstracting this as a separate class is to allow it to be
|
* The purpose of abstracting this as a separate class is to allow it to be
|
||||||
* wrapped in a JS::Heap<T> to correctly handle post-barriering of the JSObject
|
* wrapped in a JS::Heap<T> to correctly handle post-barriering of the JSObject
|
||||||
* pointer, when present.
|
* pointer, when present.
|
||||||
|
*
|
||||||
|
* No implementation of rootKind() is provided, which prevents
|
||||||
|
* Root<nsXBLMaybeCompiled<UncompiledT>> from being used.
|
||||||
*/
|
*/
|
||||||
template <class UncompiledT>
|
template <class UncompiledT>
|
||||||
class nsXBLMaybeCompiled
|
class nsXBLMaybeCompiled
|
||||||
|
@ -88,11 +91,6 @@ struct GCMethods<nsXBLMaybeCompiled<UncompiledT> >
|
||||||
|
|
||||||
static nsXBLMaybeCompiled<UncompiledT> initial() { return nsXBLMaybeCompiled<UncompiledT>(); }
|
static nsXBLMaybeCompiled<UncompiledT> initial() { return nsXBLMaybeCompiled<UncompiledT>(); }
|
||||||
|
|
||||||
/*
|
|
||||||
* No implementation of kind() is provided to prevent
|
|
||||||
* Root<nsXBLMaybeCompiled<UncompiledT>> from being used.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static bool poisoned(nsXBLMaybeCompiled<UncompiledT> function)
|
static bool poisoned(nsXBLMaybeCompiled<UncompiledT> function)
|
||||||
{
|
{
|
||||||
return function.IsCompiled() && Base::poisoned(function.GetJSFunction());
|
return function.IsCompiled() && Base::poisoned(function.GetJSFunction());
|
||||||
|
|
|
@ -171,7 +171,6 @@ IsPoisonedId(jsid iden)
|
||||||
template <> struct GCMethods<jsid>
|
template <> struct GCMethods<jsid>
|
||||||
{
|
{
|
||||||
static jsid initial() { return JSID_VOID; }
|
static jsid initial() { return JSID_VOID; }
|
||||||
static ThingRootKind kind() { return THING_ROOT_ID; }
|
|
||||||
static bool poisoned(jsid id) { return IsPoisonedId(id); }
|
static bool poisoned(jsid id) { return IsPoisonedId(id); }
|
||||||
static bool needsPostBarrier(jsid id) { return false; }
|
static bool needsPostBarrier(jsid id) { return false; }
|
||||||
#ifdef JSGC_GENERATIONAL
|
#ifdef JSGC_GENERATIONAL
|
||||||
|
|
|
@ -654,7 +654,6 @@ template <typename T>
|
||||||
struct GCMethods<T *>
|
struct GCMethods<T *>
|
||||||
{
|
{
|
||||||
static T *initial() { return nullptr; }
|
static T *initial() { return nullptr; }
|
||||||
static ThingRootKind kind() { return RootKind<T *>::rootKind(); }
|
|
||||||
static bool poisoned(T *v) { return JS::IsPoisonedPtr(v); }
|
static bool poisoned(T *v) { return JS::IsPoisonedPtr(v); }
|
||||||
static bool needsPostBarrier(T *v) { return false; }
|
static bool needsPostBarrier(T *v) { return false; }
|
||||||
#ifdef JSGC_GENERATIONAL
|
#ifdef JSGC_GENERATIONAL
|
||||||
|
@ -667,7 +666,6 @@ template <>
|
||||||
struct GCMethods<JSObject *>
|
struct GCMethods<JSObject *>
|
||||||
{
|
{
|
||||||
static JSObject *initial() { return nullptr; }
|
static JSObject *initial() { return nullptr; }
|
||||||
static ThingRootKind kind() { return RootKind<JSObject *>::rootKind(); }
|
|
||||||
static bool poisoned(JSObject *v) { return JS::IsPoisonedPtr(v); }
|
static bool poisoned(JSObject *v) { return JS::IsPoisonedPtr(v); }
|
||||||
static bool needsPostBarrier(JSObject *v) {
|
static bool needsPostBarrier(JSObject *v) {
|
||||||
return v != nullptr && gc::IsInsideNursery(reinterpret_cast<gc::Cell *>(v));
|
return v != nullptr && gc::IsInsideNursery(reinterpret_cast<gc::Cell *>(v));
|
||||||
|
@ -707,7 +705,7 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase<T>
|
||||||
template <typename CX>
|
template <typename CX>
|
||||||
void init(CX *cx) {
|
void init(CX *cx) {
|
||||||
#ifdef JSGC_TRACK_EXACT_ROOTS
|
#ifdef JSGC_TRACK_EXACT_ROOTS
|
||||||
js::ThingRootKind kind = js::GCMethods<T>::kind();
|
js::ThingRootKind kind = js::RootKind<T>::rootKind();
|
||||||
this->stack = &cx->thingGCRooters[kind];
|
this->stack = &cx->thingGCRooters[kind];
|
||||||
this->prev = *stack;
|
this->prev = *stack;
|
||||||
*stack = reinterpret_cast<Rooted<void*>*>(this);
|
*stack = reinterpret_cast<Rooted<void*>*>(this);
|
||||||
|
|
|
@ -1550,14 +1550,12 @@ namespace js {
|
||||||
template <> struct GCMethods<const JS::Value>
|
template <> struct GCMethods<const JS::Value>
|
||||||
{
|
{
|
||||||
static JS::Value initial() { return JS::UndefinedValue(); }
|
static JS::Value initial() { return JS::UndefinedValue(); }
|
||||||
static ThingRootKind kind() { return THING_ROOT_VALUE; }
|
|
||||||
static bool poisoned(const JS::Value &v) { return JS::IsPoisonedValue(v); }
|
static bool poisoned(const JS::Value &v) { return JS::IsPoisonedValue(v); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template <> struct GCMethods<JS::Value>
|
template <> struct GCMethods<JS::Value>
|
||||||
{
|
{
|
||||||
static JS::Value initial() { return JS::UndefinedValue(); }
|
static JS::Value initial() { return JS::UndefinedValue(); }
|
||||||
static ThingRootKind kind() { return THING_ROOT_VALUE; }
|
|
||||||
static bool poisoned(const JS::Value &v) { return JS::IsPoisonedValue(v); }
|
static bool poisoned(const JS::Value &v) { return JS::IsPoisonedValue(v); }
|
||||||
static bool needsPostBarrier(const JS::Value &v) {
|
static bool needsPostBarrier(const JS::Value &v) {
|
||||||
return v.isObject() && gc::IsInsideNursery(reinterpret_cast<gc::Cell*>(&v.toObject()));
|
return v.isObject() && gc::IsInsideNursery(reinterpret_cast<gc::Cell*>(&v.toObject()));
|
||||||
|
|
|
@ -3009,7 +3009,6 @@ namespace js {
|
||||||
template <>
|
template <>
|
||||||
struct GCMethods<JSPropertyDescriptor> {
|
struct GCMethods<JSPropertyDescriptor> {
|
||||||
static JSPropertyDescriptor initial() { return JSPropertyDescriptor(); }
|
static JSPropertyDescriptor initial() { return JSPropertyDescriptor(); }
|
||||||
static ThingRootKind kind() { return THING_ROOT_PROPERTY_DESCRIPTOR; }
|
|
||||||
static bool poisoned(const JSPropertyDescriptor &desc) {
|
static bool poisoned(const JSPropertyDescriptor &desc) {
|
||||||
return (desc.obj && JS::IsPoisonedPtr(desc.obj)) ||
|
return (desc.obj && JS::IsPoisonedPtr(desc.obj)) ||
|
||||||
(desc.attrs & JSPROP_GETTER && desc.getter && JS::IsPoisonedPtr(desc.getter)) ||
|
(desc.attrs & JSPROP_GETTER && desc.getter && JS::IsPoisonedPtr(desc.getter)) ||
|
||||||
|
|
|
@ -71,14 +71,12 @@ struct RootKind<TaggedProto>
|
||||||
template <> struct GCMethods<const TaggedProto>
|
template <> struct GCMethods<const TaggedProto>
|
||||||
{
|
{
|
||||||
static TaggedProto initial() { return TaggedProto(); }
|
static TaggedProto initial() { return TaggedProto(); }
|
||||||
static ThingRootKind kind() { return THING_ROOT_OBJECT; }
|
|
||||||
static bool poisoned(const TaggedProto &v) { return IsPoisonedPtr(v.raw()); }
|
static bool poisoned(const TaggedProto &v) { return IsPoisonedPtr(v.raw()); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template <> struct GCMethods<TaggedProto>
|
template <> struct GCMethods<TaggedProto>
|
||||||
{
|
{
|
||||||
static TaggedProto initial() { return TaggedProto(); }
|
static TaggedProto initial() { return TaggedProto(); }
|
||||||
static ThingRootKind kind() { return THING_ROOT_OBJECT; }
|
|
||||||
static bool poisoned(const TaggedProto &v) { return IsPoisonedPtr(v.raw()); }
|
static bool poisoned(const TaggedProto &v) { return IsPoisonedPtr(v.raw()); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1271,7 +1271,6 @@ template <>
|
||||||
struct GCMethods<const types::Type>
|
struct GCMethods<const types::Type>
|
||||||
{
|
{
|
||||||
static types::Type initial() { return types::Type::UnknownType(); }
|
static types::Type initial() { return types::Type::UnknownType(); }
|
||||||
static ThingRootKind kind() { return THING_ROOT_TYPE; }
|
|
||||||
static bool poisoned(const types::Type &v) {
|
static bool poisoned(const types::Type &v) {
|
||||||
return (v.isTypeObject() && IsPoisonedPtr(v.typeObject()))
|
return (v.isTypeObject() && IsPoisonedPtr(v.typeObject()))
|
||||||
|| (v.isSingleObject() && IsPoisonedPtr(v.singleObject()));
|
|| (v.isSingleObject() && IsPoisonedPtr(v.singleObject()));
|
||||||
|
@ -1282,7 +1281,6 @@ template <>
|
||||||
struct GCMethods<types::Type>
|
struct GCMethods<types::Type>
|
||||||
{
|
{
|
||||||
static types::Type initial() { return types::Type::UnknownType(); }
|
static types::Type initial() { return types::Type::UnknownType(); }
|
||||||
static ThingRootKind kind() { return THING_ROOT_TYPE; }
|
|
||||||
static bool poisoned(const types::Type &v) {
|
static bool poisoned(const types::Type &v) {
|
||||||
return (v.isTypeObject() && IsPoisonedPtr(v.typeObject()))
|
return (v.isTypeObject() && IsPoisonedPtr(v.typeObject()))
|
||||||
|| (v.isSingleObject() && IsPoisonedPtr(v.singleObject()));
|
|| (v.isSingleObject() && IsPoisonedPtr(v.singleObject()));
|
||||||
|
|
|
@ -273,7 +273,6 @@ class Bindings
|
||||||
template <>
|
template <>
|
||||||
struct GCMethods<Bindings> {
|
struct GCMethods<Bindings> {
|
||||||
static Bindings initial();
|
static Bindings initial();
|
||||||
static ThingRootKind kind() { return THING_ROOT_BINDINGS; }
|
|
||||||
static bool poisoned(const Bindings &bindings) {
|
static bool poisoned(const Bindings &bindings) {
|
||||||
return IsPoisonedPtr(static_cast<Shape *>(bindings.callObjShape()));
|
return IsPoisonedPtr(static_cast<Shape *>(bindings.callObjShape()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -336,7 +336,6 @@ namespace js {
|
||||||
template <>
|
template <>
|
||||||
struct GCMethods<PropDesc> {
|
struct GCMethods<PropDesc> {
|
||||||
static PropDesc initial() { return PropDesc(); }
|
static PropDesc initial() { return PropDesc(); }
|
||||||
static ThingRootKind kind() { return THING_ROOT_PROP_DESC; }
|
|
||||||
static bool poisoned(const PropDesc &desc) {
|
static bool poisoned(const PropDesc &desc) {
|
||||||
return JS::IsPoisonedPtr(desc.descObj_) ||
|
return JS::IsPoisonedPtr(desc.descObj_) ||
|
||||||
(desc.value_.isGCThing() &&
|
(desc.value_.isGCThing() &&
|
||||||
|
|
Загрузка…
Ссылка в новой задаче