[INFER] Check compartment when tracing TypeObject conservative roots during GC, bug 673792.
authorBrian Hackett <bhackett1024@gmail.com>
Mon, 25 Jul 2011 14:48:22 -0700
changeset 76072 681d2903edb79aa46050872ee0962aa6527c178e
parent 76071 4d1506b097db00d81d4b06c594f86220195b3cf9
child 76073 60cb5a22dc10d5e6be28e70770cbcda8b42edbc0
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
bugs673792
milestone8.0a1
[INFER] Check compartment when tracing TypeObject conservative roots during GC, bug 673792.
js/src/jsgcmark.cpp
--- a/js/src/jsgcmark.cpp
+++ b/js/src/jsgcmark.cpp
@@ -232,25 +232,16 @@ void
 MarkShape(JSTracer *trc, const Shape *shape, const char *name)
 {
     JS_ASSERT(trc);
     JS_ASSERT(shape);
     JS_SET_TRACING_NAME(trc, name);
     Mark(trc, shape);
 }
 
-void
-MarkTypeObject(JSTracer *trc, types::TypeObject *object, const char *name)
-{
-    JS_ASSERT(trc);
-    JS_ASSERT(object);
-    JS_SET_TRACING_NAME(trc, name);
-    object->trace(trc, false);
-}
-
 #if JS_HAS_XML_SUPPORT
 void
 MarkXML(JSTracer *trc, JSXML *xml, const char *name)
 {
     JS_ASSERT(trc);
     JS_ASSERT(xml);
     JS_SET_TRACING_NAME(trc, name);
     Mark(trc, xml);
@@ -522,17 +513,22 @@ void
 MarkRoot(JSTracer *trc, const Shape *thing, const char *name)
 {
     MarkShape(trc, thing, name);
 }
 
 void
 MarkRoot(JSTracer *trc, types::TypeObject *thing, const char *name)
 {
-    MarkTypeObject(trc, thing, name);
+    JS_ASSERT(trc);
+    JS_ASSERT(thing);
+    JS_SET_TRACING_NAME(trc, name);
+    JSRuntime *rt = trc->context->runtime;
+    if (!rt->gcCurrentCompartment || thing->compartment() == rt->gcCurrentCompartment)
+        thing->trace(trc, false);
 }
 
 void
 MarkRoot(JSTracer *trc, JSXML *thing, const char *name)
 {
     MarkXML(trc, thing, name);
 }