Merge from tracemonkey to jsdbg2.
authorJason Orendorff <jorendorff@mozilla.com>
Fri, 01 Jul 2011 19:22:47 -0500
changeset 74495 449a0ee1ad8cd70907849887598453ba1e90565a
parent 74494 a4374705dd79c6ff959a3d4141a6fe313babde1c (current diff)
parent 72374 9b5a70a74209b96614b78518f5b62861f11df696 (diff)
child 74496 821e5b01b1b1c5d5dddb8312f273679f67d0cbf3
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
milestone7.0a1
Merge from tracemonkey to jsdbg2.
js/src/jsgc.cpp
js/src/jsgc.h
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -1771,28 +1771,16 @@ MarkContext(JSTracer *trc, JSContext *ac
         gcr->trace(trc);
 
     if (acx->sharpObjectMap.depth > 0)
         js_TraceSharpMap(trc, &acx->sharpObjectMap);
 
     MarkValue(trc, acx->iterValue, "iterValue");
 }
 
-void
-MarkWeakReferences(GCMarker *trc, JSGCInvocationKind gckind)
-{
-    trc->drainMarkStack();
-    while (js_TraceWatchPoints(trc) ||
-           WeakMapBase::markAllIteratively(trc) ||
-           Debug::mark(trc, gckind))
-    {
-        trc->drainMarkStack();
-    }
-}
-
 JS_REQUIRES_STACK void
 MarkRuntime(JSTracer *trc)
 {
     JSRuntime *rt = trc->context->runtime;
 
     if (rt->state != JSRTS_LANDING)
         MarkConservativeStackRoots(trc);
 
@@ -2246,19 +2234,28 @@ MarkAndSweep(JSContext *cx, JSCompartmen
         for (JSCompartment **c = rt->compartments.begin(); c != rt->compartments.end(); ++c)
             (*c)->markCrossCompartmentWrappers(&gcmarker);
         Debug::markCrossCompartmentDebugObjectReferents(&gcmarker);
     } else {
         js_MarkScriptFilenames(rt);
     }
 
     MarkRuntime(&gcmarker);
-    MarkWeakReferences(&gcmarker, gckind);
     gcmarker.drainMarkStack();
 
+    /*
+     * Mark weak roots.
+     */
+    while (js_TraceWatchPoints(&gcmarker) ||
+           WeakMapBase::markAllIteratively(&gcmarker) ||
+           Debug::mark(&gcmarker, gckind))
+    {
+        gcmarker.drainMarkStack();
+    }
+
     rt->gcMarkingTracer = NULL;
 
     if (rt->gcCallback)
         (void) rt->gcCallback(cx, JSGC_MARK_END);
 
 #ifdef DEBUG
     /* Make sure that we didn't mark an object in another compartment */
     if (comp) {
--- a/js/src/jsgc.h
+++ b/js/src/jsgc.h
@@ -1324,19 +1324,16 @@ struct GCMarker : public JSTracer {
     }
 
     void pushXML(JSXML *xml) {
         if (!xmlStack.push(xml))
             delayMarkingChildren(xml);
     }
 };
 
-JS_FRIEND_API(void)
-MarkWeakReferences(GCMarker *trc);
-
 void
 MarkStackRangeConservatively(JSTracer *trc, Value *begin, Value *end);
 
 static inline uint64
 TraceKindMask(unsigned kind)
 {
     return uint64(1) << kind;
 }
--- a/js/src/xpconnect/src/xpcjsruntime.cpp
+++ b/js/src/xpconnect/src/xpcjsruntime.cpp
@@ -368,20 +368,18 @@ void XPCJSRuntime::TraceJS(JSTracer* trc
     // Mark these roots as gray so the CC can walk them later.
     js::GCMarker *gcmarker = NULL;
     if (IS_GC_MARKING_TRACER(trc)) {
         gcmarker = static_cast<js::GCMarker *>(trc);
         JS_ASSERT(gcmarker->getMarkColor() == XPC_GC_COLOR_BLACK);
         gcmarker->setMarkColor(XPC_GC_COLOR_GRAY);
     }
     self->TraceXPConnectRoots(trc);
-    if (gcmarker) {
-        js::MarkWeakReferences(gcmarker);
+    if (gcmarker)
         gcmarker->setMarkColor(XPC_GC_COLOR_BLACK);
-    }
 }
 
 static void
 TraceJSObject(PRUint32 aLangID, void *aScriptThing, const char *name,
               void *aClosure)
 {
     if(aLangID == nsIProgrammingLanguage::JAVASCRIPT)
     {