Store the recorder script in JSTraceMonitor and make sure its traced by the GC. Also clean up the tracing of JSTraceMonitor.

This commit is contained in:
Andreas Gal 2008-06-03 17:35:30 -07:00
parent 02b2fde780
commit be39054e45
2 changed files with 12 additions and 6 deletions

View File

@ -2860,6 +2860,14 @@ js_TraceContext(JSTracer *trc, JSContext *acx)
js_TraceSharpMap(trc, &acx->sharpObjectMap);
}
void
js_TraceTraceMonitor(JSTracer *trc, JSTraceMonitor *tm)
{
TRACE_JSVALS(trc, tm->loopTableSize, tm->loopTable, "loop table");
if (tm->recorderScriptObject)
JS_CALL_OBJECT_TRACER(trc, tm->recorderScriptObject, "recorder script object");
}
void
js_TraceRuntime(JSTracer *trc, JSBool allAtoms)
{
@ -2885,14 +2893,10 @@ js_TraceRuntime(JSTracer *trc, JSBool allAtoms)
while ((acx = js_ContextIterator(rt, JS_FALSE, &iter)) != NULL) {
if (!acx->thread)
continue;
JSTraceMonitor* tm = &acx->thread->traceMonitor;
TRACE_JSVALS(trc, tm->loopTableSize, tm->loopTable,
"thread->traceMonitor.loopTable");
js_TraceTraceMonitor(trc, &acx->thread->traceMonitor);
}
#else
JSTraceMonitor* tm = &rt->traceMonitor;
TRACE_JSVALS(trc, tm->loopTableSize, tm->loopTable,
"rt->traceMonitor.loopTable");
js_TraceTraceMonitor(trc, &rt->traceMonitor);
#endif
}

View File

@ -57,6 +57,8 @@
struct JSTraceMonitor {
jsval *loopTable;
uint32 loopTableSize;
JSScript *recorderScript;
JSObject *recorderScriptObject;
};
#define TRACE_THRESHOLD 10