Bug 1181292 - Make JSPropertyDescriptor a StaticTraceable; r=efaust
authorTerrence Cole <terrence@mozilla.com>
Thu, 09 Jul 2015 08:45:42 -0700
changeset 254021 8d2d0a61f5df41ffaf1664892d17a36ac7fd55b2
parent 254020 85960a28c72159ee790bad608dff9bd51cecd7ce
child 254022 f56986f50c7464d025b4e61b47bd1b52cd09d100
push id29087
push usercbook@mozilla.com
push dateWed, 22 Jul 2015 12:01:23 +0000
treeherdermozilla-central@e7434cafdf2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersefaust
bugs1181292
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1181292 - Make JSPropertyDescriptor a StaticTraceable; r=efaust
js/src/gc/RootMarking.cpp
js/src/jsapi.h
js/src/jspubtd.h
--- a/js/src/gc/RootMarking.cpp
+++ b/js/src/gc/RootMarking.cpp
@@ -35,26 +35,16 @@ using namespace js::gc;
 using mozilla::ArrayEnd;
 
 using JS::AutoGCRooter;
 
 typedef RootedValueMap::Range RootRange;
 typedef RootedValueMap::Entry RootEntry;
 typedef RootedValueMap::Enum RootEnum;
 
-// Note: the following two functions cannot be static as long as we are using
-// GCC 4.4, since it requires template function parameters to have external
-// linkage.
-
-void
-MarkPropertyDescriptorRoot(JSTracer* trc, JSPropertyDescriptor* pd, const char* name)
-{
-    pd->trace(trc);
-}
-
 // We cannot instantiate (even indirectly) the abstract JS::DynamicTraceable.
 // Instead we cast to a ConcreteTraceable, then upcast before calling trace so
 // that we get the implementation defined dynamically in the vtable.
 struct ConcreteTraceable : public JS::DynamicTraceable
 {
     void trace(JSTracer* trc) override {}
 };
 
@@ -90,18 +80,16 @@ MarkExactStackRootsAcrossTypes(T context
         trc, context, "exact-objectgroup");
     MarkExactStackRootList<JSString*>(trc, context, "exact-string");
     MarkExactStackRootList<JS::Symbol*>(trc, context, "exact-symbol");
     MarkExactStackRootList<jit::JitCode*>(trc, context, "exact-jitcode");
     MarkExactStackRootList<JSScript*>(trc, context, "exact-script");
     MarkExactStackRootList<LazyScript*>(trc, context, "exact-lazy-script");
     MarkExactStackRootList<jsid>(trc, context, "exact-id");
     MarkExactStackRootList<Value>(trc, context, "exact-value");
-    MarkExactStackRootList<JSPropertyDescriptor, MarkPropertyDescriptorRoot>(
-        trc, context, "JSPropertyDescriptor");
     MarkExactStackRootList<JS::StaticTraceable,
                            js::DispatchWrapper<JS::StaticTraceable>::TraceWrapped>(
         trc, context, "StaticTraceable");
     MarkExactStackRootList<ConcreteTraceable, MarkDynamicTraceable>(
         trc, context, "DynamicTraceable");
 }
 
 static void
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -2502,30 +2502,29 @@ extern JS_PUBLIC_API(bool)
 JS_PreventExtensions(JSContext* cx, JS::HandleObject obj, JS::ObjectOpResult& result);
 
 extern JS_PUBLIC_API(JSObject*)
 JS_New(JSContext* cx, JS::HandleObject ctor, const JS::HandleValueArray& args);
 
 
 /*** Property descriptors ************************************************************************/
 
-struct JSPropertyDescriptor {
+struct JSPropertyDescriptor : public JS::StaticTraceable {
     JSObject* obj;
     unsigned attrs;
     JSGetterOp getter;
     JSSetterOp setter;
     JS::Value value;
 
     JSPropertyDescriptor()
       : obj(nullptr), attrs(0), getter(nullptr), setter(nullptr), value(JS::UndefinedValue())
     {}
 
+    static void trace(JSPropertyDescriptor* self, JSTracer* trc) { self->trace(trc); }
     void trace(JSTracer* trc);
-
-    static js::ThingRootKind rootKind() { return js::THING_ROOT_PROPERTY_DESCRIPTOR; }
 };
 
 namespace JS {
 
 template <typename Outer>
 class PropertyDescriptorOperations
 {
     const JSPropertyDescriptor* desc() const { return static_cast<const Outer*>(this)->extract(); }
--- a/js/src/jspubtd.h
+++ b/js/src/jspubtd.h
@@ -319,18 +319,16 @@ enum ThingRootKind
     THING_ROOT_OBJECT_GROUP,
     THING_ROOT_STRING,
     THING_ROOT_SYMBOL,
     THING_ROOT_JIT_CODE,
     THING_ROOT_SCRIPT,
     THING_ROOT_LAZY_SCRIPT,
     THING_ROOT_ID,
     THING_ROOT_VALUE,
-    THING_ROOT_PROPERTY_DESCRIPTOR,
-    THING_ROOT_PROP_DESC,
     THING_ROOT_STATIC_TRACEABLE,
     THING_ROOT_DYNAMIC_TRACEABLE,
     THING_ROOT_LIMIT
 };
 
 template <typename T>
 struct RootKind;