Bug 768626 - Add rooting analysis for PropertyId; r=Waldo
authorTerrence Cole <terrence@mozilla.com>
Tue, 26 Jun 2012 13:42:39 -0700
changeset 97721 57127eda3007339392ca16239d8a3eefeff87479
parent 97720 394ff92cde9886aced30286a3ad45d26e0c0bcda
child 97722 c7b0713958d6dbcb7fd4b8c2c17c8f6b939d99aa
push id22993
push useremorley@mozilla.com
push dateWed, 27 Jun 2012 10:31:27 +0000
treeherdermozilla-central@1a56f1f011c9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersWaldo
bugs768626
milestone16.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 768626 - Add rooting analysis for PropertyId; r=Waldo
js/src/jsgc.cpp
js/src/jspubtd.h
js/src/vm/ObjectImpl.h
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -874,16 +874,18 @@ MarkExactStackRoots(JSTracer *trc)
                 void **addr = (void **)rooter->address();
                 if (*addr) {
                     if (i == THING_ROOT_OBJECT) {
                         MarkObjectRoot(trc, (JSObject **)addr, "exact stackroot object");
                     } else if (i == THING_ROOT_STRING) {
                         MarkStringRoot(trc, (JSString **)addr, "exact stackroot string");
                     } else if (i == THING_ROOT_ID) {
                         MarkIdRoot(trc, (jsid *)addr, "exact stackroot id");
+                    } else if (i == THING_ROOT_PROPERTY_ID) {
+                        MarkIdRoot(trc, ((PropertyId *)addr)->asId(), "exact stackroot property id");
                     } else if (i == THING_ROOT_VALUE) {
                         MarkValueRoot(trc, (Value *)addr, "exact stackroot value");
                     } else if (i == THING_ROOT_SHAPE) {
                         MarkShapeRoot(trc, (Shape **)addr, "exact stackroot shape");
                     } else if (i == THING_ROOT_BASE_SHAPE) {
                         MarkBaseShapeRoot(trc, (BaseShape **)addr, "exact stackroot baseshape");
                     } else if (i == THING_ROOT_TYPE_OBJECT) {
                         MarkTypeObjectRoot(trc, (types::TypeObject **)addr, "exact stackroot typeobject");
--- a/js/src/jspubtd.h
+++ b/js/src/jspubtd.h
@@ -225,16 +225,17 @@ enum ThingRootKind
     THING_ROOT_OBJECT,
     THING_ROOT_SHAPE,
     THING_ROOT_BASE_SHAPE,
     THING_ROOT_TYPE_OBJECT,
     THING_ROOT_STRING,
     THING_ROOT_SCRIPT,
     THING_ROOT_XML,
     THING_ROOT_ID,
+    THING_ROOT_PROPERTY_ID,
     THING_ROOT_VALUE,
     THING_ROOT_LIMIT
 };
 
 struct ContextFriendFields {
     JSRuntime *const    runtime;
 
     ContextFriendFields(JSRuntime *rt)
--- a/js/src/vm/ObjectImpl.h
+++ b/js/src/vm/ObjectImpl.h
@@ -1261,16 +1261,17 @@ class ObjectImpl : public gc::Cell
          * aligned with the end of its arena and dynamic slots are allocated
          * immediately afterwards. Such cases cannot occur for dense arrays
          * (which have at least two fixed slots) and can only result in a leak.
          */
         return elements != emptyObjectElements && elements != fixedElements();
     }
 
     /* GC support. */
+    static inline ThingRootKind rootKind() { return THING_ROOT_OBJECT; }
     static inline void readBarrier(ObjectImpl *obj);
     static inline void writeBarrierPre(ObjectImpl *obj);
     static inline void writeBarrierPost(ObjectImpl *obj, void *addr);
     inline void privateWriteBarrierPre(void **oldval);
     inline void privateWriteBarrierPost(void **oldval);
     void markChildren(JSTracer *trc);
 
     /* Private data accessors. */
@@ -1354,9 +1355,18 @@ SetElement(JSContext *cx, Handle<ObjectI
            const Value &v, unsigned resolveFlags, bool *succeeded);
 
 extern bool
 HasElement(JSContext *cx, Handle<ObjectImpl*> obj, uint32_t index, unsigned resolveFlags,
            bool *found);
 
 } /* namespace js */
 
+namespace JS {
+template <> struct RootMethods<js::PropertyId>
+{
+    static js::PropertyId initial() { return js::PropertyId(); }
+    static ThingRootKind kind() { return THING_ROOT_PROPERTY_ID; }
+    static bool poisoned(js::PropertyId propid) { return IsPoisonedId(propid.asId()); }
+};
+}
+
 #endif /* ObjectImpl_h__ */