Bug 720840 - Call MarkStringUnbarriered directly; r=billm
authorTerrence Cole <terrence@mozilla.com>
Tue, 24 Jan 2012 15:21:44 -0800
changeset 86509 680991750088895c293927b5c208a067ec20a984
parent 86508 383712b389bca5328f0c662e18d5afe49e2bd9ac
child 86510 6ae43e3c400be7d33ba7b60c7e94cc1ff12c31d0
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm
bugs720840
milestone12.0a1
Bug 720840 - Call MarkStringUnbarriered directly; r=billm We have a special marker function for handling the Atom list because we need to call JS_SET_TRACING_INDEX externally to avoid clobbering the index. However, nobody cares about the index here and if they do, they can add custom debug code. It is better at this point to have a consistent and correct interface, thus we remove the specialized atomized string marking in favor of the existing markers. Additionally, this is only used during root marking so we can switch to using MarkRoot for the extra assertions.
js/src/jsatom.cpp
js/src/jsfun.cpp
js/src/jsgcmark.cpp
js/src/jsgcmark.h
--- a/js/src/jsatom.cpp
+++ b/js/src/jsatom.cpp
@@ -380,33 +380,27 @@ js_FinishCommonAtoms(JSContext *cx)
 }
 
 void
 js_TraceAtomState(JSTracer *trc)
 {
     JSRuntime *rt = trc->runtime;
     JSAtomState *state = &rt->atomState;
 
-#ifdef DEBUG
-    size_t number = 0;
-#endif
-
     if (rt->gcKeepAtoms) {
         for (AtomSet::Range r = state->atoms.all(); !r.empty(); r.popFront()) {
-            JS_SET_TRACING_INDEX(trc, "locked_atom", number++);
-            MarkAtom(trc, r.front().asPtr());
+            MarkRoot(trc, r.front().asPtr(), "locked_atom");
         }
     } else {
         for (AtomSet::Range r = state->atoms.all(); !r.empty(); r.popFront()) {
             AtomStateEntry entry = r.front();
             if (!entry.isTagged())
                 continue;
 
-            JS_SET_TRACING_INDEX(trc, "interned_atom", number++);
-            MarkAtom(trc, entry.asPtr());
+            MarkRoot(trc, entry.asPtr(), "interned_atom");
         }
     }
 }
 
 void
 js_SweepAtomState(JSContext *cx)
 {
     JSAtomState *state = &cx->runtime->atomState;
--- a/js/src/jsfun.cpp
+++ b/js/src/jsfun.cpp
@@ -1442,17 +1442,17 @@ JSFunction::trace(JSTracer *trc)
     }
 
     if (isExtended()) {
         MarkValueRange(trc, ArrayLength(toExtended()->extendedSlots),
                        toExtended()->extendedSlots, "nativeReserved");
     }
 
     if (atom)
-        MarkAtom(trc, atom, "atom");
+        MarkStringUnbarriered(trc, atom, "atom");
 
     if (isInterpreted()) {
         if (script())
             MarkScript(trc, script(), "script");
         if (environment())
             MarkObjectUnbarriered(trc, environment(), "fun_callscope");
     }
 }
--- a/js/src/jsgcmark.cpp
+++ b/js/src/jsgcmark.cpp
@@ -158,30 +158,16 @@ MarkStringUnbarriered(JSTracer *trc, JSS
 
 void
 MarkString(JSTracer *trc, const MarkablePtr<JSString> &str, const char *name)
 {
     MarkStringUnbarriered(trc, str.value, name);
 }
 
 void
-MarkAtom(JSTracer *trc, JSAtom *atom)
-{
-    JS_ASSERT(trc);
-    JS_ASSERT(atom);
-    Mark(trc, atom);
-}
-
-void
-MarkAtom(JSTracer *trc, JSAtom *atom, const char *name)
-{
-    MarkStringUnbarriered(trc, atom, name);
-}
-
-void
 MarkObjectUnbarriered(JSTracer *trc, JSObject *obj, const char *name)
 {
     JS_ASSERT(trc);
     JS_ASSERT(obj);
     JS_SET_TRACING_NAME(trc, name);
     Mark(trc, obj);
 }
 
--- a/js/src/jsgcmark.h
+++ b/js/src/jsgcmark.h
@@ -47,22 +47,16 @@
 
 #include "gc/Barrier.h"
 #include "js/TemplateLib.h"
 
 namespace js {
 namespace gc {
 
 void
-MarkAtom(JSTracer *trc, JSAtom *str);
-
-void
-MarkAtom(JSTracer *trc, JSAtom *str, const char *name);
-
-void
 MarkObjectUnbarriered(JSTracer *trc, JSObject *obj, const char *name);
 
 void
 MarkObject(JSTracer *trc, const MarkablePtr<JSObject> &obj, const char *name);
 
 void
 MarkStringUnbarriered(JSTracer *trc, JSString *str, const char *name);