Fixed a bug that triggered the tracer at TRACE_THRESHOLD/2 already.
authorAndreas Gal <gal@uci.edu>
Sat, 31 May 2008 09:53:16 -0700
changeset 17187 1805b63c9f77b324f91468614f00ee6b9e4a4d71
parent 17186 5e055a8c1fef2ef1038820bc2285eca4b53e14dd
child 17188 b46fcf1b955182486e98993738b5c9f1cf338099
child 17196 5c416b3706ae7db79a9bc27563cf03d383c32790
push id1452
push usershaver@mozilla.com
push dateFri, 22 Aug 2008 00:08:22 +0000
treeherderautoland@d13bb0868596 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone1.9.1a1pre
Fixed a bug that triggered the tracer at TRACE_THRESHOLD/2 already.
js/src/jsgc.cpp
js/src/jsinterp.cpp
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -2875,21 +2875,31 @@ js_TraceRuntime(JSTracer *trc, JSBool al
 
     iter = NULL;
     while ((acx = js_ContextIterator(rt, JS_TRUE, &iter)) != NULL)
         js_TraceContext(trc, acx);
 
     if (rt->gcExtraRootsTraceOp)
         rt->gcExtraRootsTraceOp(trc, rt->gcExtraRootsData);
 
-#ifndef JS_THREADSAFE
-    /* Trace the loop table which can contain pointers to code objects. */
-    JSTraceMonitor* tm = &rt->traceMonitor;
-    TRACE_JSVALS(trc, tm->loopTableSize, tm->loopTable, "rt->traceMonitor.loopTable");
+
+#ifdef JS_TRACER    
+#ifdef JS_THREADSAFE
+    /* Trace the loop table(s) which can contain pointers to code objects. */
+   while ((acx = js_ContextIterator(rt, JS_FALSE, &iter)) != NULL) {
+       if (!acx->thread || acx->thread == cx->thread)
+           continue;
+       JSTraceMonitor* tm = &acx->thread->traceMonitor;
+       TRACE_JSVALS(trc, tm->loopTableSize, tm->loopTable, "thread->traceMonitor.loopTable");
+   }
+#else
+   JSTraceMonitor* tm = &rt->traceMonitor;
+   TRACE_JSVALS(trc, tm->loopTableSize, tm->loopTable, "rt->traceMonitor.loopTable");
 #endif    
+#endif   
 }
 
 static void
 ProcessSetSlotRequest(JSContext *cx, JSSetSlotRequest *ssr)
 {
     JSObject *obj, *pobj;
     uint32 slot;
 
--- a/js/src/jsinterp.cpp
+++ b/js/src/jsinterp.cpp
@@ -2807,17 +2807,17 @@ JS_INTERPRET(JSContext *cx)
               js_GrowLoopTableIfNeeded(cx, i);
             vp = &rt->traceMonitor.loopTable[i];
             rval = *vp;
             if (JSVAL_IS_INT(rval)) {
                 /*
                  * There are no concurrent writes to slots. This point in
                  * the program is the only place a slot is updated from. 
                  */
-                if (rval >= TRACE_THRESHOLD) {
+                if (JSVAL_TO_INT(rval) >= TRACE_THRESHOLD) {
                     /*
                      * Once a thread hits the threshold, it should first consult
                      * (read) the other threads' loop tables to see if anyone
                      * already compiled a tree for us, and in that case reuse
                      * that tree instead of recording a new one.
                      */
                     *vp = OBJECT_TO_JSVAL(js_NewObject(cx, &js_ObjectClass, NULL, NULL, 0));
                 } else {