Bug 1021114 - Remove GCMethods::kind() in favour or RootKind::rootKind() r=terrence

This commit is contained in:
Jon Coppeard 2014-06-07 10:34:57 +01:00
parent 0d943dd656
commit fe6d3a4b70
9 changed files with 4 additions and 18 deletions

View File

@ -16,6 +16,9 @@
* 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
* pointer, when present.
*
* No implementation of rootKind() is provided, which prevents
* Root<nsXBLMaybeCompiled<UncompiledT>> from being used.
*/
template <class UncompiledT>
class nsXBLMaybeCompiled
@ -88,11 +91,6 @@ struct GCMethods<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)
{
return function.IsCompiled() && Base::poisoned(function.GetJSFunction());

View File

@ -171,7 +171,6 @@ IsPoisonedId(jsid iden)
template <> struct GCMethods<jsid>
{
static jsid initial() { return JSID_VOID; }
static ThingRootKind kind() { return THING_ROOT_ID; }
static bool poisoned(jsid id) { return IsPoisonedId(id); }
static bool needsPostBarrier(jsid id) { return false; }
#ifdef JSGC_GENERATIONAL

View File

@ -654,7 +654,6 @@ template <typename T>
struct GCMethods<T *>
{
static T *initial() { return nullptr; }
static ThingRootKind kind() { return RootKind<T *>::rootKind(); }
static bool poisoned(T *v) { return JS::IsPoisonedPtr(v); }
static bool needsPostBarrier(T *v) { return false; }
#ifdef JSGC_GENERATIONAL
@ -667,7 +666,6 @@ template <>
struct GCMethods<JSObject *>
{
static JSObject *initial() { return nullptr; }
static ThingRootKind kind() { return RootKind<JSObject *>::rootKind(); }
static bool poisoned(JSObject *v) { return JS::IsPoisonedPtr(v); }
static bool needsPostBarrier(JSObject *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>
void init(CX *cx) {
#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->prev = *stack;
*stack = reinterpret_cast<Rooted<void*>*>(this);

View File

@ -1550,14 +1550,12 @@ namespace js {
template <> struct GCMethods<const JS::Value>
{
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); }
};
template <> struct GCMethods<JS::Value>
{
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 needsPostBarrier(const JS::Value &v) {
return v.isObject() && gc::IsInsideNursery(reinterpret_cast<gc::Cell*>(&v.toObject()));

View File

@ -3009,7 +3009,6 @@ namespace js {
template <>
struct GCMethods<JSPropertyDescriptor> {
static JSPropertyDescriptor initial() { return JSPropertyDescriptor(); }
static ThingRootKind kind() { return THING_ROOT_PROPERTY_DESCRIPTOR; }
static bool poisoned(const JSPropertyDescriptor &desc) {
return (desc.obj && JS::IsPoisonedPtr(desc.obj)) ||
(desc.attrs & JSPROP_GETTER && desc.getter && JS::IsPoisonedPtr(desc.getter)) ||

View File

@ -71,14 +71,12 @@ struct RootKind<TaggedProto>
template <> struct GCMethods<const TaggedProto>
{
static TaggedProto initial() { return TaggedProto(); }
static ThingRootKind kind() { return THING_ROOT_OBJECT; }
static bool poisoned(const TaggedProto &v) { return IsPoisonedPtr(v.raw()); }
};
template <> struct GCMethods<TaggedProto>
{
static TaggedProto initial() { return TaggedProto(); }
static ThingRootKind kind() { return THING_ROOT_OBJECT; }
static bool poisoned(const TaggedProto &v) { return IsPoisonedPtr(v.raw()); }
};

View File

@ -1271,7 +1271,6 @@ template <>
struct GCMethods<const types::Type>
{
static types::Type initial() { return types::Type::UnknownType(); }
static ThingRootKind kind() { return THING_ROOT_TYPE; }
static bool poisoned(const types::Type &v) {
return (v.isTypeObject() && IsPoisonedPtr(v.typeObject()))
|| (v.isSingleObject() && IsPoisonedPtr(v.singleObject()));
@ -1282,7 +1281,6 @@ template <>
struct GCMethods<types::Type>
{
static types::Type initial() { return types::Type::UnknownType(); }
static ThingRootKind kind() { return THING_ROOT_TYPE; }
static bool poisoned(const types::Type &v) {
return (v.isTypeObject() && IsPoisonedPtr(v.typeObject()))
|| (v.isSingleObject() && IsPoisonedPtr(v.singleObject()));

View File

@ -273,7 +273,6 @@ class Bindings
template <>
struct GCMethods<Bindings> {
static Bindings initial();
static ThingRootKind kind() { return THING_ROOT_BINDINGS; }
static bool poisoned(const Bindings &bindings) {
return IsPoisonedPtr(static_cast<Shape *>(bindings.callObjShape()));
}

View File

@ -336,7 +336,6 @@ namespace js {
template <>
struct GCMethods<PropDesc> {
static PropDesc initial() { return PropDesc(); }
static ThingRootKind kind() { return THING_ROOT_PROP_DESC; }
static bool poisoned(const PropDesc &desc) {
return JS::IsPoisonedPtr(desc.descObj_) ||
(desc.value_.isGCThing() &&