BUG 545303: TM: non API function for JS_CallTracer r=igor
authorGregor Wagner <anygregor@gmail.com>
Thu, 18 Feb 2010 13:16:02 -0800
changeset 38595 3b25677f1feedc46d2f92924b29c5afdd2416ffa
parent 38594 787a93994be811484c4a0a6a7a64b2ccd4ef68b5
child 38596 36487442aeb0aac85d17a8c95a1168301b20b2b1
push idunknown
push userunknown
push dateunknown
reviewersigor
bugs545303
milestone1.9.3a2pre
BUG 545303: TM: non API function for JS_CallTracer r=igor
js/src/jsapi.cpp
js/src/jsarray.cpp
js/src/jsatom.cpp
js/src/jsfun.cpp
js/src/jsgc.cpp
js/src/jsgc.h
js/src/jsobj.cpp
js/src/jsscope.cpp
js/src/jsscript.cpp
js/src/jstracer.cpp
js/src/jsxml.cpp
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -1903,16 +1903,22 @@ JS_PUBLIC_API(void)
 JS_TraceRuntime(JSTracer *trc)
 {
     JSBool allAtoms = trc->context->runtime->gcKeepAtoms != 0;
 
     LeaveTrace(trc->context);
     js_TraceRuntime(trc, allAtoms);
 }
 
+JS_PUBLIC_API(void)
+JS_CallTracer(JSTracer *trc, void *thing, uint32 kind)
+{
+    js_CallGCMarker(trc, thing, kind);
+}
+
 #ifdef DEBUG
 
 #ifdef HAVE_XPCONNECT
 #include "dump_xpc.h"
 #endif
 
 JS_PUBLIC_API(void)
 JS_PrintTraceThingInfo(char *buf, size_t bufsize, JSTracer *trc,
--- a/js/src/jsarray.cpp
+++ b/js/src/jsarray.cpp
@@ -1211,17 +1211,17 @@ array_trace(JSTracer *trc, JSObject *obj
     JS_ASSERT(obj->isDenseArray());
     obj->traceProtoAndParent(trc);
 
     capacity = js_DenseArrayCapacity(obj);
     for (i = 0; i < capacity; i++) {
         v = obj->dslots[i];
         if (JSVAL_IS_TRACEABLE(v)) {
             JS_SET_TRACING_INDEX(trc, "array_dslots", i);
-            JS_CallTracer(trc, JSVAL_TO_TRACEABLE(v), JSVAL_TRACE_KIND(v));
+            js_CallGCMarker(trc, JSVAL_TO_TRACEABLE(v), JSVAL_TRACE_KIND(v));
         }
     }
 }
 
 extern JSObjectOps js_ArrayObjectOps;
 
 static const JSObjectMap SharedArrayMap(&js_ArrayObjectOps, JSObjectMap::SHAPELESS);
 
--- a/js/src/jsatom.cpp
+++ b/js/src/jsatom.cpp
@@ -532,18 +532,18 @@ js_locked_atom_tracer(JSDHashTable *tabl
     JSAtomHashEntry *entry = TO_ATOM_ENTRY(hdr);
     JSTracer *trc = (JSTracer *)arg;
 
     if (entry->keyAndFlags == 0) {
         /* Ignore uninitialized entries during tracing. */
         return JS_DHASH_NEXT;
     }
     JS_SET_TRACING_INDEX(trc, "locked_atom", (size_t)number);
-    JS_CallTracer(trc, ATOM_ENTRY_KEY(entry),
-                  IS_STRING_TABLE(table) ? JSTRACE_STRING : JSTRACE_DOUBLE);
+    js_CallGCMarker(trc, ATOM_ENTRY_KEY(entry),
+                    IS_STRING_TABLE(table) ? JSTRACE_STRING : JSTRACE_DOUBLE);
     return JS_DHASH_NEXT;
 }
 
 static JSDHashOperator
 js_pinned_atom_tracer(JSDHashTable *table, JSDHashEntryHdr *hdr,
                         uint32 number, void *arg)
 {
     JSAtomHashEntry *entry = TO_ATOM_ENTRY(hdr);
@@ -552,17 +552,17 @@ js_pinned_atom_tracer(JSDHashTable *tabl
 
     JS_ASSERT(IS_STRING_TABLE(table));
     if (flags & (ATOM_PINNED | ATOM_INTERNED)) {
         JS_SET_TRACING_INDEX(trc,
                              flags & ATOM_PINNED
                              ? "pinned_atom"
                              : "interned_atom",
                              (size_t)number);
-        JS_CallTracer(trc, ATOM_ENTRY_KEY(entry), JSTRACE_STRING);
+        js_CallGCMarker(trc, ATOM_ENTRY_KEY(entry), JSTRACE_STRING);
     }
     return JS_DHASH_NEXT;
 }
 
 void
 js_TraceAtomState(JSTracer *trc, JSBool allAtoms)
 {
     JSRuntime *rt = trc->context->runtime;
--- a/js/src/jsfun.cpp
+++ b/js/src/jsfun.cpp
@@ -3031,17 +3031,17 @@ trace_local_names_enumerator(JSDHashTabl
     JSTracer *trc;
 
     entry = (JSLocalNameHashEntry *) hdr;
     JS_ASSERT(entry->name);
     trc = (JSTracer *) arg;
     JS_SET_TRACING_INDEX(trc,
                          entry->localKind == JSLOCAL_ARG ? "arg" : "var",
                          entry->index);
-    JS_CallTracer(trc, ATOM_TO_STRING(entry->name), JSTRACE_STRING);
+    js_CallGCMarker(trc, ATOM_TO_STRING(entry->name), JSTRACE_STRING);
     return JS_DHASH_NEXT;
 }
 
 static void
 TraceLocalNames(JSTracer *trc, JSFunction *fun)
 {
     uintN n, i;
     JSAtom *atom;
@@ -3056,17 +3056,17 @@ TraceLocalNames(JSTracer *trc, JSFunctio
         i = n;
         do {
             --i;
             atom = (JSAtom *) (array[i] & ~1);
             if (atom) {
                 JS_SET_TRACING_INDEX(trc,
                                      i < fun->nargs ? "arg" : "var",
                                      i < fun->nargs ? i : i - fun->nargs);
-                JS_CallTracer(trc, ATOM_TO_STRING(atom), JSTRACE_STRING);
+                js_CallGCMarker(trc, ATOM_TO_STRING(atom), JSTRACE_STRING);
             }
         } while (i != 0);
     } else {
         JS_DHashTableEnumerate(&fun->u.i.names.map->names,
                                trace_local_names_enumerator, trc);
 
         /*
          * No need to trace the list of duplicates in map->lastdup as the
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -2062,18 +2062,18 @@ MarkDelayedChildren(JSTracer *trc)
         }
     }
     JS_ASSERT(rt->gcUnmarkedArenaStackTop);
     JS_ASSERT(!rt->gcUnmarkedArenaStackTop->hasPrevUnmarked());
     rt->gcUnmarkedArenaStackTop = NULL;
     JS_ASSERT(rt->gcMarkLaterCount == 0);
 }
 
-JS_PUBLIC_API(void)
-JS_CallTracer(JSTracer *trc, void *thing, uint32 kind)
+void
+js_CallGCMarker(JSTracer *trc, void *thing, uint32 kind)
 {
     JSContext *cx;
     JSRuntime *rt;
     JSGCArena *a;
 
     JS_ASSERT(thing);
     JS_ASSERT(JS_IS_VALID_TRACE_KIND(kind));
     JS_ASSERT(trc->debugPrinter || trc->debugPrintArg);
@@ -2181,17 +2181,17 @@ js_CallValueTracerIfGCThing(JSTracer *tr
         JS_ASSERT(kind == js_GetGCThingTraceKind(thing));
     } else if (JSVAL_IS_OBJECT(v) && v != JSVAL_NULL) {
         /* v can be an arbitrary GC thing reinterpreted as an object. */
         thing = JSVAL_TO_OBJECT(v);
         kind = js_GetGCThingTraceKind(thing);
     } else {
         return;
     }
-    JS_CallTracer(trc, thing, kind);
+    js_CallGCMarker(trc, thing, kind);
 }
 
 static JSDHashOperator
 gc_root_traversal(JSDHashTable *table, JSDHashEntryHdr *hdr, uint32 num,
                   void *arg)
 {
     JSGCRootHashEntry *rhe = (JSGCRootHashEntry *)hdr;
     JSTracer *trc = (JSTracer *)arg;
@@ -2262,18 +2262,18 @@ gc_lock_traversal(JSDHashTable *table, J
 #define TRACE_JSVALS(trc, len, vec, name)                                     \
     JS_BEGIN_MACRO                                                            \
     jsval _v, *_vp, *_end;                                                    \
                                                                               \
         for (_vp = vec, _end = _vp + len; _vp < _end; _vp++) {                \
             _v = *_vp;                                                        \
             if (JSVAL_IS_TRACEABLE(_v)) {                                     \
                 JS_SET_TRACING_INDEX(trc, name, _vp - (vec));                 \
-                JS_CallTracer(trc, JSVAL_TO_TRACEABLE(_v),                    \
-                              JSVAL_TRACE_KIND(_v));                          \
+                js_CallGCMarker(trc, JSVAL_TO_TRACEABLE(_v),                  \
+                                JSVAL_TRACE_KIND(_v));                        \
             }                                                                 \
         }                                                                     \
     JS_END_MACRO
 
 void
 js_TraceStackFrame(JSTracer *trc, JSStackFrame *fp)
 {
     uintN nslots, minargs, skip;
--- a/js/src/jsgc.h
+++ b/js/src/jsgc.h
@@ -225,16 +225,19 @@ typedef enum JSGCInvocationKind {
      * jsgc.c just before js_GC's definition for details.
      */
     GC_LAST_DITCH       = GC_LOCK_HELD | 2
 } JSGCInvocationKind;
 
 extern void
 js_GC(JSContext *cx, JSGCInvocationKind gckind);
 
+extern void
+js_CallGCMarker(JSTracer *trc, void *thing, uint32 kind);
+
 /*
  * The kind of GC thing with a finalizer. The external strings follow the
  * ordinary string to simplify js_GetExternalStringGCType.
  */
 enum JSFinalizeGCThingKind {
     FINALIZE_OBJECT,
     FINALIZE_FUNCTION,
 #if JS_HAS_XML_SUPPORT
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -6607,17 +6607,17 @@ js_TraceObject(JSTracer *trc, JSObject *
     if (!scope->isSharedEmpty() && scope->freeslot < nslots)
         nslots = scope->freeslot;
     JS_ASSERT(nslots >= JSSLOT_START(clasp));
 
     for (uint32 i = JSSLOT_START(clasp); i != nslots; ++i) {
         jsval v = STOBJ_GET_SLOT(obj, i);
         if (JSVAL_IS_TRACEABLE(v)) {
             JS_SET_TRACING_DETAILS(trc, js_PrintObjectSlotName, obj, i);
-            JS_CallTracer(trc, JSVAL_TO_TRACEABLE(v), JSVAL_TRACE_KIND(v));
+            js_CallGCMarker(trc, JSVAL_TO_TRACEABLE(v), JSVAL_TRACE_KIND(v));
         }
     }
 }
 
 void
 js_Clear(JSContext *cx, JSObject *obj)
 {
     JSScope *scope;
--- a/js/src/jsscope.cpp
+++ b/js/src/jsscope.cpp
@@ -1783,28 +1783,28 @@ JSScopeProperty::trace(JSTracer *trc)
     if (IS_GC_MARKING_TRACER(trc))
         mark();
     js_TraceId(trc, id);
 
 #if JS_HAS_GETTER_SETTER
     if (attrs & (JSPROP_GETTER | JSPROP_SETTER)) {
         if ((attrs & JSPROP_GETTER) && getter) {
             JS_SET_TRACING_DETAILS(trc, PrintPropertyGetterOrSetter, this, 0);
-            JS_CallTracer(trc, getterObject(), JSTRACE_OBJECT);
+            js_CallGCMarker(trc, getterObject(), JSTRACE_OBJECT);
         }
         if ((attrs & JSPROP_SETTER) && setter) {
             JS_SET_TRACING_DETAILS(trc, PrintPropertyGetterOrSetter, this, 1);
-            JS_CallTracer(trc, setterObject(), JSTRACE_OBJECT);
+            js_CallGCMarker(trc, setterObject(), JSTRACE_OBJECT);
         }
     }
 #endif /* JS_HAS_GETTER_SETTER */
 
     if (isMethod()) {
         JS_SET_TRACING_DETAILS(trc, PrintPropertyMethod, this, 0);
-        JS_CallTracer(trc, methodObject(), JSTRACE_OBJECT);
+        js_CallGCMarker(trc, methodObject(), JSTRACE_OBJECT);
     }
 }
 
 #ifdef DEBUG
 
 static void
 MeterKidCount(JSBasicStats *bs, uintN nkids)
 {
--- a/js/src/jsscript.cpp
+++ b/js/src/jsscript.cpp
@@ -1783,47 +1783,47 @@ js_TraceScript(JSTracer *trc, JSScript *
 
     map = &script->atomMap;
     length = map->length;
     vector = map->vector;
     for (i = 0; i < length; i++) {
         v = ATOM_KEY(vector[i]);
         if (JSVAL_IS_TRACEABLE(v)) {
             JS_SET_TRACING_INDEX(trc, "atomMap", i);
-            JS_CallTracer(trc, JSVAL_TO_TRACEABLE(v), JSVAL_TRACE_KIND(v));
+            js_CallGCMarker(trc, JSVAL_TO_TRACEABLE(v), JSVAL_TRACE_KIND(v));
         }
     }
 
     if (script->objectsOffset != 0) {
         objarray = script->objects();
         i = objarray->length;
         do {
             --i;
             if (objarray->vector[i]) {
                 JS_SET_TRACING_INDEX(trc, "objects", i);
-                JS_CallTracer(trc, objarray->vector[i], JSTRACE_OBJECT);
+                js_CallGCMarker(trc, objarray->vector[i], JSTRACE_OBJECT);
             }
         } while (i != 0);
     }
 
     if (script->regexpsOffset != 0) {
         objarray = script->regexps();
         i = objarray->length;
         do {
             --i;
             if (objarray->vector[i]) {
                 JS_SET_TRACING_INDEX(trc, "regexps", i);
-                JS_CallTracer(trc, objarray->vector[i], JSTRACE_OBJECT);
+                js_CallGCMarker(trc, objarray->vector[i], JSTRACE_OBJECT);
             }
         } while (i != 0);
     }
 
     if (script->u.object) {
         JS_SET_TRACING_NAME(trc, "object");
-        JS_CallTracer(trc, script->u.object, JSTRACE_OBJECT);
+        js_CallGCMarker(trc, script->u.object, JSTRACE_OBJECT);
     }
 
     if (IS_GC_MARKING_TRACER(trc) && script->filename)
         js_MarkScriptFilename(script->filename);
 }
 
 typedef struct GSNCacheEntry {
     JSDHashEntryHdr     hdr;
--- a/js/src/jstracer.cpp
+++ b/js/src/jstracer.cpp
@@ -2688,17 +2688,17 @@ TraceMonitor::flush()
 static inline void
 MarkTree(JSTracer* trc, TreeFragment *f)
 {
     jsval* vp = f->gcthings.data();
     unsigned len = f->gcthings.length();
     while (len--) {
         jsval v = *vp++;
         JS_SET_TRACING_NAME(trc, "jitgcthing");
-        JS_CallTracer(trc, JSVAL_TO_TRACEABLE(v), JSVAL_TRACE_KIND(v));
+        js_CallGCMarker(trc, JSVAL_TO_TRACEABLE(v), JSVAL_TRACE_KIND(v));
     }
     JSScopeProperty** spropp = f->sprops.data();
     len = f->sprops.length();
     while (len--) {
         JSScopeProperty* sprop = *spropp++;
         sprop->trace(trc);
     }
 }
--- a/js/src/jsxml.cpp
+++ b/js/src/jsxml.cpp
@@ -4792,17 +4792,17 @@ xml_trace_vector(JSTracer *trc, JSXML **
 {
     uint32 i;
     JSXML *xml;
 
     for (i = 0; i < len; i++) {
         xml = vec[i];
         if (xml) {
             JS_SET_TRACING_INDEX(trc, "xml_vector", i);
-            JS_CallTracer(trc, xml, JSTRACE_XML);
+            js_CallGCMarker(trc, xml, JSTRACE_XML);
         }
     }
 }
 
 /*
  * js_XMLObjectOps.newObjectMap is null, so XML objects appear to be native.
  * Thus xml_lookupProperty must return a valid JSScopeProperty pointer
  * parameter via *propp to signify "property found".  Since the only call to
@@ -5889,17 +5889,17 @@ TraceObjectVector(JSTracer *trc, JSObjec
 {
     uint32 i;
     JSObject *obj;
 
     for (i = 0; i < len; i++) {
         obj = vec[i];
         if (obj) {
             JS_SET_TRACING_INDEX(trc, "vector", i);
-            JS_CallTracer(trc, obj, JSTRACE_OBJECT);
+            js_CallGCMarker(trc, obj, JSTRACE_OBJECT);
         }
     }
 }
 
 static void
 trace_temp_ns_array(JSTracer *trc, JSTempValueRooter *tvr)
 {
     JSTempRootedNSArray *tmp = (JSTempRootedNSArray *)tvr;