Fixed a bug that triggered the tracer at TRACE_THRESHOLD/2 already.
Fixed a bug that triggered the tracer at TRACE_THRESHOLD/2 already.
--- 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 {