bug 683862 - Using JSGCTraceKind in the public API. r=luke
authorIgor Bukanov <igor@mir2.org>
Thu, 01 Sep 2011 20:43:46 +0200
changeset 76404 9833be42339480a95a157190234226bae376faed
parent 76403 3b04343f238270cf32b5ba9d4cf742556750892a
child 76405 4f3eb6d6dcf5454c74e5bb69bcd39fd838ac7e66
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewersluke
bugs683862
milestone9.0a1
bug 683862 - Using JSGCTraceKind in the public API. r=luke
ipc/testshell/XPCShellEnvironment.cpp
js/jsd/jsd_xpc.cpp
js/src/jsapi.cpp
js/src/jsapi.h
js/src/jsgc.cpp
js/src/jsgcmark.cpp
js/src/jspubtd.h
js/src/shell/js.cpp
js/src/shell/jsheaptools.cpp
js/src/xpconnect/shell/xpcshell.cpp
js/src/xpconnect/src/nsXPConnect.cpp
--- a/ipc/testshell/XPCShellEnvironment.cpp
+++ b/ipc/testshell/XPCShellEnvironment.cpp
@@ -442,17 +442,17 @@ GCZeal(JSContext *cx,
 
 static JSBool
 DumpHeap(JSContext *cx,
          uintN argc,
          jsval *vp)
 {
     JSAutoByteString fileName;
     void* startThing = NULL;
-    uint32 startTraceKind = 0;
+    JSGCTraceKind startTraceKind = JSTRACE_OBJECT;
     void *thingToFind = NULL;
     size_t maxDepth = (size_t)-1;
     void *thingToIgnore = NULL;
     FILE *dumpFile;
     JSBool ok;
 
     jsval *argv = JS_ARGV(cx, vp);
     JS_SET_RVAL(cx, vp, JSVAL_VOID);
--- a/js/jsd/jsd_xpc.cpp
+++ b/js/jsd/jsd_xpc.cpp
@@ -2855,17 +2855,17 @@ jsdService::DumpHeap(const nsACString &f
     return NS_ERROR_NOT_IMPLEMENTED;
 #else
     nsresult rv = NS_OK;
     FILE *file = !fileName.IsEmpty() ? fopen(PromiseFlatCString(fileName).get(), "w") : stdout;
     if (!file) {
         rv = NS_ERROR_FAILURE;
     } else {
         JSContext *cx = JSD_GetDefaultJSContext (mCx);
-        if (!JS_DumpHeap(cx, file, NULL, 0, NULL, (size_t)-1, NULL))
+        if (!JS_DumpHeap(cx, file, NULL, JSTRACE_OBJECT, NULL, (size_t)-1, NULL))
             rv = NS_ERROR_FAILURE;
         if (file != stdout)
             fclose(file);
     }
     return rv;
 #endif
 }
 
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -2187,36 +2187,33 @@ JS_SetExtraGCRoots(JSRuntime *rt, JSTrac
 
 JS_PUBLIC_API(void)
 JS_TraceRuntime(JSTracer *trc)
 {
     TraceRuntime(trc);
 }
 
 JS_PUBLIC_API(void)
-JS_CallTracer(JSTracer *trc, void *thing, uint32 kind)
+JS_CallTracer(JSTracer *trc, void *thing, JSGCTraceKind kind)
 {
     JS_ASSERT(thing);
-    JS_ASSERT(kind <= JSTRACE_LAST);
-    MarkKind(trc, thing, JSGCTraceKind(kind));
+    MarkKind(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, void *thing, uint32 kindIndex,
-                       JSBool details)
-{
-    JS_ASSERT(kindIndex <= JSTRACE_LAST);
-    JSGCTraceKind kind = JSGCTraceKind(kindIndex);
-    const char *name;
+JS_PrintTraceThingInfo(char *buf, size_t bufsize, JSTracer *trc, void *thing,
+                       JSGCTraceKind kind, JSBool details)
+{
+    const char *name = NULL; /* silence uninitialized warning */
     size_t n;
 
     if (bufsize == 0)
         return;
 
     switch (kind) {
       case JSTRACE_OBJECT:
       {
@@ -2331,17 +2328,17 @@ JS_PrintTraceThingInfo(char *buf, size_t
     }
     buf[bufsize - 1] = '\0';
 }
 
 typedef struct JSHeapDumpNode JSHeapDumpNode;
 
 struct JSHeapDumpNode {
     void            *thing;
-    uint32          kind;
+    JSGCTraceKind   kind;
     JSHeapDumpNode  *next;          /* next sibling */
     JSHeapDumpNode  *parent;        /* node with the thing that refer to thing
                                        from this node */
     char            edgeName[1];    /* name of the edge from parent->thing
                                        into thing */
 };
 
 typedef struct JSDumpingTracer {
@@ -2352,17 +2349,17 @@ typedef struct JSDumpingTracer {
     void                *thingToFind;
     void                *thingToIgnore;
     JSHeapDumpNode      *parentNode;
     JSHeapDumpNode      **lastNodep;
     char                buffer[200];
 } JSDumpingTracer;
 
 static void
-DumpNotify(JSTracer *trc, void *thing, uint32 kind)
+DumpNotify(JSTracer *trc, void *thing, JSGCTraceKind kind)
 {
     JSDumpingTracer *dtrc;
     JSContext *cx;
     JSDHashEntryStub *entry;
     JSHeapDumpNode *node;
     const char *edgeName;
     size_t edgeNameSize;
 
@@ -2496,17 +2493,17 @@ DumpNode(JSDumpingTracer *dtrc, FILE* fp
         prev = node;
         node = following;
     } while (node);
 
     return ok && putc('\n', fp) >= 0;
 }
 
 JS_PUBLIC_API(JSBool)
-JS_DumpHeap(JSContext *cx, FILE *fp, void* startThing, uint32 startKind,
+JS_DumpHeap(JSContext *cx, FILE *fp, void* startThing, JSGCTraceKind startKind,
             void *thingToFind, size_t maxDepth, void *thingToIgnore)
 {
     JSDumpingTracer dtrc;
     JSHeapDumpNode *node, *children, *next, *parent;
     size_t depth;
     JSBool thingToFindWasTraced;
 
     if (maxDepth == 0)
@@ -2522,17 +2519,17 @@ JS_DumpHeap(JSContext *cx, FILE *fp, voi
     dtrc.ok = JS_TRUE;
     dtrc.startThing = startThing;
     dtrc.thingToFind = thingToFind;
     dtrc.thingToIgnore = thingToIgnore;
     dtrc.parentNode = NULL;
     node = NULL;
     dtrc.lastNodep = &node;
     if (!startThing) {
-        JS_ASSERT(startKind == 0);
+        JS_ASSERT(startKind == JSTRACE_OBJECT);
         TraceRuntime(&dtrc.base);
     } else {
         JS_TraceChildren(&dtrc.base, startThing, startKind);
     }
 
     depth = 1;
     if (!node)
         goto dump_out;
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -1605,18 +1605,18 @@ JS_SetExtraGCRoots(JSRuntime *rt, JSTrac
  */
 
 typedef enum {
     JSTRACE_OBJECT,
     JSTRACE_STRING,
     JSTRACE_SCRIPT,
 
     /*
-     * Trace kinds internal to the engine. JSTraceCallback implementation can
-     * only call JS_TraceChildren on them.
+     * Trace kinds internal to the engine. The embedding can only them if it
+     * implements JSTraceCallback.
      */ 
 #if JS_HAS_XML_SUPPORT
     JSTRACE_XML,
 #endif
     JSTRACE_SHAPE,
     JSTRACE_TYPE_OBJECT,
     JSTRACE_LAST = JSTRACE_TYPE_OBJECT
 } JSGCTraceKind;
@@ -1634,41 +1634,56 @@ JSVAL_IS_TRACEABLE(jsval v)
 }
 
 static JS_ALWAYS_INLINE void *
 JSVAL_TO_TRACEABLE(jsval v)
 {
     return JSVAL_TO_GCTHING(v);
 }
 
-static JS_ALWAYS_INLINE uint32
+static JS_ALWAYS_INLINE JSGCTraceKind
 JSVAL_TRACE_KIND(jsval v)
 {
     jsval_layout l;
     JS_ASSERT(JSVAL_IS_GCTHING(v));
     l.asBits = JSVAL_BITS(v);
-    return JSVAL_TRACE_KIND_IMPL(l);
+    return (JSGCTraceKind) JSVAL_TRACE_KIND_IMPL(l);
 }
 
+/*
+ * Tracer callback, called for each traceable thing directly referenced by a
+ * particular object or runtime structure. It is the callback responsibility
+ * to ensure the traversal of the full object graph via calling eventually
+ * JS_TraceChildren on the passed thing. In this case the callback must be
+ * prepared to deal with cycles in the traversal graph.
+ *
+ * kind argument is one of JSTRACE_OBJECT, JSTRACE_STRING or a tag denoting
+ * internal implementation-specific traversal kind. In the latter case the only
+ * operations on thing that the callback can do is to call JS_TraceChildren or
+ * DEBUG-only JS_PrintTraceThingInfo.
+ */
+typedef void
+(* JSTraceCallback)(JSTracer *trc, void *thing, JSGCTraceKind kind);
+
 struct JSTracer {
     JSContext           *context;
     JSTraceCallback     callback;
     JSTraceNamePrinter  debugPrinter;
     const void          *debugPrintArg;
     size_t              debugPrintIndex;
 };
 
 /*
  * The method to call on each reference to a traceable thing stored in a
  * particular JSObject or other runtime structure. With DEBUG defined the
  * caller before calling JS_CallTracer must initialize JSTracer fields
  * describing the reference using the macros below.
  */
 extern JS_PUBLIC_API(void)
-JS_CallTracer(JSTracer *trc, void *thing, uint32 kind);
+JS_CallTracer(JSTracer *trc, void *thing, JSGCTraceKind kind);
 
 /*
  * Set debugging information about a reference to a traceable thing to prepare
  * for the following call to JS_CallTracer.
  *
  * When printer is null, arg must be const char * or char * C string naming
  * the reference and index must be either (size_t)-1 indicating that the name
  * alone describes the reference or it must be an index into some array vector
@@ -1751,44 +1766,44 @@ JS_CallTracer(JSTracer *trc, void *thing
         (trc)->context = (cx_);                                               \
         (trc)->callback = (callback_);                                        \
         (trc)->debugPrinter = NULL;                                           \
         (trc)->debugPrintArg = NULL;                                          \
         (trc)->debugPrintIndex = (size_t)-1;                                  \
     JS_END_MACRO
 
 extern JS_PUBLIC_API(void)
-JS_TraceChildren(JSTracer *trc, void *thing, uint32 kind);
+JS_TraceChildren(JSTracer *trc, void *thing, JSGCTraceKind kind);
 
 extern JS_PUBLIC_API(void)
 JS_TraceRuntime(JSTracer *trc);
 
 #ifdef DEBUG
 
 extern JS_PUBLIC_API(void)
 JS_PrintTraceThingInfo(char *buf, size_t bufsize, JSTracer *trc,
-                       void *thing, uint32 kind, JSBool includeDetails);
+                       void *thing, JSGCTraceKind kind, JSBool includeDetails);
 
 /*
  * DEBUG-only method to dump the object graph of heap-allocated things.
  *
  * fp:              file for the dump output.
  * start:           when non-null, dump only things reachable from start
  *                  thing. Otherwise dump all things reachable from the
  *                  runtime roots.
- * startKind:       trace kind of start if start is not null. Must be 0 when
- *                  start is null.
+ * startKind:       trace kind of start if start is not null. Must be
+ *                  JSTRACE_OBJECT when start is null.
  * thingToFind:     dump only paths in the object graph leading to thingToFind
  *                  when non-null.
  * maxDepth:        the upper bound on the number of edges to descend from the
  *                  graph roots.
  * thingToIgnore:   thing to ignore during the graph traversal when non-null.
  */
 extern JS_PUBLIC_API(JSBool)
-JS_DumpHeap(JSContext *cx, FILE *fp, void* startThing, uint32 startKind,
+JS_DumpHeap(JSContext *cx, FILE *fp, void* startThing, JSGCTraceKind kind,
             void *thingToFind, size_t maxDepth, void *thingToIgnore);
 
 #endif
 
 /*
  * Garbage collector API.
  */
 extern JS_PUBLIC_API(void)
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -1615,17 +1615,17 @@ GCMarker::markDelayedChildren()
     }
     JS_ASSERT(!markLaterArenas);
 }
 
 } /* namespace js */
 
 #ifdef DEBUG
 static void
-EmptyMarkCallback(JSTracer *trc, void *thing, uint32 kind)
+EmptyMarkCallback(JSTracer *trc, void *thing, JSGCTraceKind kind)
 {
 }
 #endif
 
 static void
 gc_root_traversal(JSTracer *trc, const RootEntry &entry)
 {
 #ifdef DEBUG
--- a/js/src/jsgcmark.cpp
+++ b/js/src/jsgcmark.cpp
@@ -1006,23 +1006,20 @@ GCMarker::drainMarkStack()
     }
 
     rt->gcCheckCompartment = NULL;
 }
 
 } /* namespace js */
 
 JS_PUBLIC_API(void)
-JS_TraceChildren(JSTracer *trc, void *thing, uint32 kindIndex)
+JS_TraceChildren(JSTracer *trc, void *thing, JSGCTraceKind kind)
 {
-    JS_ASSERT(kindIndex <= JSTRACE_LAST);
-    JSGCTraceKind kind = JSGCTraceKind(kindIndex);
     switch (kind) {
-      default:
-        JS_ASSERT(kind == JSTRACE_OBJECT);
+      case JSTRACE_OBJECT:
 	MarkChildren(trc, static_cast<JSObject *>(thing));
         break;
 
       case JSTRACE_STRING:
 	MarkChildren(trc, static_cast<JSString *>(thing));
         break;
 
       case JSTRACE_SCRIPT:
--- a/js/src/jspubtd.h
+++ b/js/src/jspubtd.h
@@ -355,31 +355,16 @@ typedef JSBool
  * the traversal is a part of the marking phase through calling
  * JS_IsGCMarkingTracer and apply a special code like emptying caches or
  * marking its native structures.
  */
 typedef void
 (* JSTraceOp)(JSTracer *trc, JSObject *obj);
 
 /*
- * Tracer callback, called for each traceable thing directly referenced by a
- * particular object or runtime structure. It is the callback responsibility
- * to ensure the traversal of the full object graph via calling eventually
- * JS_TraceChildren on the passed thing. In this case the callback must be
- * prepared to deal with cycles in the traversal graph.
- *
- * kind argument is one of JSTRACE_OBJECT, JSTRACE_STRING or a tag denoting
- * internal implementation-specific traversal kind. In the latter case the only
- * operations on thing that the callback can do is to call JS_TraceChildren or
- * DEBUG-only JS_PrintTraceThingInfo.
- */
-typedef void
-(* JSTraceCallback)(JSTracer *trc, void *thing, uint32 kind);
-
-/*
  * DEBUG only callback that JSTraceOp implementation can provide to return
  * a string describing the reference traced with JS_CallTracer.
  */
 typedef void
 (* JSTraceNamePrinter)(JSTracer *trc, char *buf, size_t bufsize);
 
 typedef JSBool
 (* JSEqualityOp)(JSContext *cx, JSObject *obj, const jsval *v, JSBool *bp);
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -1359,30 +1359,30 @@ ScheduleGC(JSContext *cx, uintN argc, js
     return JS_TRUE;
 }
 #endif /* JS_GC_ZEAL */
 
 typedef struct JSCountHeapNode JSCountHeapNode;
 
 struct JSCountHeapNode {
     void                *thing;
-    int32               kind;
+    JSGCTraceKind       kind;
     JSCountHeapNode     *next;
 };
 
 typedef struct JSCountHeapTracer {
     JSTracer            base;
     JSDHashTable        visited;
     JSBool              ok;
     JSCountHeapNode     *traceList;
     JSCountHeapNode     *recycleList;
 } JSCountHeapTracer;
 
 static void
-CountHeapNotify(JSTracer *trc, void *thing, uint32 kind)
+CountHeapNotify(JSTracer *trc, void *thing, JSGCTraceKind kind)
 {
     JSCountHeapTracer *countTracer;
     JSDHashEntryStub *entry;
     JSCountHeapNode *node;
 
     JS_ASSERT(trc->callback == CountHeapNotify);
     countTracer = (JSCountHeapTracer *)trc;
     if (!countTracer->ok)
@@ -1414,17 +1414,17 @@ CountHeapNotify(JSTracer *trc, void *thi
     node->next = countTracer->traceList;
     countTracer->traceList = node;
 }
 
 static JSBool
 CountHeap(JSContext *cx, uintN argc, jsval *vp)
 {
     void* startThing;
-    int32 startTraceKind;
+    JSGCTraceKind startTraceKind;
     jsval v;
     int32 traceKind, i;
     JSString *str;
     JSCountHeapTracer countTracer;
     JSCountHeapNode *node;
     size_t counter;
 
     static const struct {
@@ -1435,17 +1435,17 @@ CountHeap(JSContext *cx, uintN argc, jsv
         { "object",     JSTRACE_OBJECT      },
         { "string",     JSTRACE_STRING      },
 #if JS_HAS_XML_SUPPORT
         { "xml",        JSTRACE_XML         },
 #endif
     };
 
     startThing = NULL;
-    startTraceKind = 0;
+    startTraceKind = JSTRACE_OBJECT;
     if (argc > 0) {
         v = JS_ARGV(cx, vp)[0];
         if (JSVAL_IS_TRACEABLE(v)) {
             startThing = JSVAL_TO_TRACEABLE(v);
             startTraceKind = JSVAL_TRACE_KIND(v);
         } else if (!JSVAL_IS_NULL(v)) {
             JS_ReportError(cx,
                            "the first argument is not null or a heap-allocated "
@@ -2365,17 +2365,17 @@ DumpStats(JSContext *cx, uintN argc, jsv
     return JS_TRUE;
 }
 
 static JSBool
 DumpHeap(JSContext *cx, uintN argc, jsval *vp)
 {
     jsval v;
     void* startThing;
-    uint32 startTraceKind;
+    JSGCTraceKind startTraceKind;
     const char *badTraceArg;
     void *thingToFind;
     size_t maxDepth;
     void *thingToIgnore;
     FILE *dumpFile;
     JSBool ok;
 
     const char *fileName = NULL;
@@ -2391,17 +2391,17 @@ DumpHeap(JSContext *cx, uintN argc, jsva
             JS_ARGV(cx, vp)[0] = STRING_TO_JSVAL(str);
             if (!fileNameBytes.encode(cx, str))
                 return JS_FALSE;
             fileName = fileNameBytes.ptr();
         }
     }
 
     startThing = NULL;
-    startTraceKind = 0;
+    startTraceKind = JSTRACE_OBJECT;
     if (argc > 1) {
         v = JS_ARGV(cx, vp)[1];
         if (JSVAL_IS_TRACEABLE(v)) {
             startThing = JSVAL_TO_TRACEABLE(v);
             startTraceKind = JSVAL_TRACE_KIND(v);
         } else if (!JSVAL_IS_NULL(v)) {
             badTraceArg = "start";
             goto not_traceable_arg;
--- a/js/src/shell/jsheaptools.cpp
+++ b/js/src/shell/jsheaptools.cpp
@@ -82,33 +82,34 @@ using namespace js;
 class HeapReverser : public JSTracer {
   public:
     struct Edge;
 
     /* Metadata for a given Cell we have visited. */
     class Node {
       public:
         Node() { }
-        Node(uint32 kind) : kind(kind), incoming(), marked(false) { }
+        Node(JSGCTraceKind kind)
+          : kind(kind), incoming(), marked(false) { }
 
         /*
          * Move constructor and move assignment. These allow us to store our
          * incoming edge Vector in the hash table: Vectors support moves, but
          * not assignments or copy construction.
          */
         Node(MoveRef<Node> rhs)
           : kind(rhs->kind), incoming(Move(rhs->incoming)), marked(rhs->marked) { }
         Node &operator=(MoveRef<Node> rhs) {
             this->~Node();
             new(this) Node(rhs);
             return *this;
         }
 
         /* What kind of Cell this is. */
-        uint32 kind;
+        JSGCTraceKind kind;
 
         /*
          * A vector of this Cell's incoming edges.
          * This must use SystemAllocPolicy because HashMap requires its elements to
          * be constructible with no arguments.
          */
         Vector<Edge, 0, SystemAllocPolicy> incoming;
 
@@ -194,50 +195,50 @@ class HeapReverser : public JSTracer {
         }
       private:
         HeapReverser *reverser;
         void *savedParent;
     };
 
     /* A work item in the stack of nodes whose children we need to traverse. */
     struct Child {
-        Child(void *cell, uint32 kind) : cell(cell), kind(kind) { }
+        Child(void *cell, JSGCTraceKind kind) : cell(cell), kind(kind) { }
         void *cell;
-        uint32 kind;
+        JSGCTraceKind kind;
     };
 
     /*
      * A stack of work items. We represent the stack explicitly to avoid
      * overflowing the C++ stack when traversing long chains of objects.
      */
     Vector<Child> work; 
 
     /* When traverseEdge is called, the Cell and kind at which the edge originated. */
     void *parent;
 
     /* Traverse an edge. */
-    bool traverseEdge(void *cell, uint32 kind);
+    bool traverseEdge(void *cell, JSGCTraceKind kind);
 
     /*
      * JS_TraceRuntime and JS_TraceChildren don't propagate error returns,
      * and out-of-memory errors, by design, don't establish an exception in
      * |context|, so traverseEdgeWithThis uses this to communicate the
      * result of the traversal to reverseHeap.
      */
     bool traversalStatus;
 
     /* Static member function wrapping 'traverseEdge'. */
-    static void traverseEdgeWithThis(JSTracer *tracer, void *cell, uint32 kind) {
+    static void traverseEdgeWithThis(JSTracer *tracer, void *cell, JSGCTraceKind kind) {
         HeapReverser *reverser = static_cast<HeapReverser *>(tracer);
         reverser->traversalStatus = reverser->traverseEdge(cell, kind);
     }
 };
 
 bool
-HeapReverser::traverseEdge(void *cell, uint32 kind) {
+HeapReverser::traverseEdge(void *cell, JSGCTraceKind kind) {
     /* Capture this edge before the JSTracer members get overwritten. */
     char *edgeDescription = getEdgeDescription();
     if (!edgeDescription)
         return false;
     Edge e(edgeDescription, parent);
 
     Map::AddPtr a = map.lookupForAdd(cell);
     if (!a) {
--- a/js/src/xpconnect/shell/xpcshell.cpp
+++ b/js/src/xpconnect/shell/xpcshell.cpp
@@ -571,17 +571,17 @@ GCZeal(JSContext *cx, uintN argc, jsval 
 #endif
 
 #ifdef DEBUG
 
 static JSBool
 DumpHeap(JSContext *cx, uintN argc, jsval *vp)
 {
     void* startThing = NULL;
-    uint32 startTraceKind = 0;
+    JSGCTraceKind startTraceKind = JSTRACE_OBJECT;
     void *thingToFind = NULL;
     size_t maxDepth = (size_t)-1;
     void *thingToIgnore = NULL;
     FILE *dumpFile;
     JSBool ok;
 
     jsval *argv = JS_ARGV(cx, vp);
     JS_SET_RVAL(cx, vp, JSVAL_VOID);
--- a/js/src/xpconnect/src/nsXPConnect.cpp
+++ b/js/src/xpconnect/src/nsXPConnect.cpp
@@ -218,17 +218,17 @@ nsXPConnect::ReleaseXPConnectSingleton()
                 if(dumpName)
                 {
                     FILE* dumpFile = (*dumpName == '\0' ||
                                       strcmp(dumpName, "stdout") == 0)
                                      ? stdout
                                      : fopen(dumpName, "w");
                     if(dumpFile)
                     {
-                        JS_DumpHeap(ccx, dumpFile, nsnull, 0, nsnull,
+                        JS_DumpHeap(ccx, dumpFile, nsnull, JSTRACE_OBJECT, nsnull,
                                     static_cast<size_t>(-1), nsnull);
                         if(dumpFile != stdout)
                             fclose(dumpFile);
                     }
                 }
             }
         }
 #endif
@@ -614,17 +614,17 @@ xpc_GCThingIsGrayCCThing(void *thing)
  *
  * To prevent this badness, we unmark the gray bit of an object when it is
  * accessed by callers outside XPConnect. This would cause the object to go
  * black in step 2 above. This must be done on everything reachable from the
  * object being returned. The following code takes care of the recursive
  * re-coloring.
  */
 static void
-UnmarkGrayChildren(JSTracer *trc, void *thing, uint32 kind)
+UnmarkGrayChildren(JSTracer *trc, void *thing, JSGCTraceKind kind)
 {
     int stackDummy;
     if (!JS_CHECK_STACK_SIZE(trc->context->stackLimit, &stackDummy)) {
         /*
          * If we run out of stack, we take a more drastic measure: require that
          * we GC again before the next CC.
          */
         nsXPConnect* xpc = nsXPConnect::GetXPConnect();
@@ -670,17 +670,17 @@ struct TraversalTracer : public JSTracer
 {
     TraversalTracer(nsCycleCollectionTraversalCallback &aCb) : cb(aCb)
     {
     }
     nsCycleCollectionTraversalCallback &cb;
 };
 
 static void
-NoteJSChild(JSTracer *trc, void *thing, uint32 kind)
+NoteJSChild(JSTracer *trc, void *thing, JSGCTraceKind kind)
 {
     if(AddToCCKind(kind))
     {
         TraversalTracer *tracer = static_cast<TraversalTracer*>(trc);
 
         // There's no point in further traversing a non-gray object here unless
         // we explicitly want to see all traces.
         if(!xpc_IsGrayGCThing(thing) && !tracer->cb.WantAllTraces())
@@ -727,17 +727,17 @@ WrapperIsNotMainThreadOnly(XPCWrappedNat
     return NS_FAILED(CallQueryInterface(wrapper->Native(), &participant));
 }
 
 NS_IMETHODIMP
 nsXPConnect::Traverse(void *p, nsCycleCollectionTraversalCallback &cb)
 {
     JSContext *cx = mCycleCollectionContext->GetJSContext();
 
-    uint32 traceKind = js_GetGCThingTraceKind(p);
+    JSGCTraceKind traceKind = js_GetGCThingTraceKind(p);
     JSObject *obj;
     js::Class *clazz;
 
     // We do not want to add wrappers to the cycle collector if they're not
     // explicitly marked as main thread only, because the cycle collector isn't
     // able to deal with objects that might be used off of the main thread. We
     // do want to explicitly mark them for cycle collection if the wrapper has
     // an external reference, because the wrapper would mark the JS object if