Bug 379455: tracing API now let the tracer to know about the GC lock count.

This commit is contained in:
igor@mir2.org 2007-05-04 08:43:19 -07:00
parent 133a30de2e
commit 257bac3e47

View File

@ -2283,15 +2283,23 @@ gc_lock_traversal(JSDHashTable *table, JSDHashEntryHdr *hdr, uint32 num,
JS_CALL_TRACER(trc, thing, traceKind, "locked object"); JS_CALL_TRACER(trc, thing, traceKind, "locked object");
/* /*
* During GC marking JS_CALL_TRACER calls gcThingCallback once. But we need * Bug 379455: we called the tracer once, but to communicate the value of
* to call the callback extra lhe->count - 1 times to report an accurate * thing's lock count to the tracer, or to gcThingCallback when the tracer
* reference count there. * is the GC marking phase, we need to call an extra lhe->count - 1 times.
*/ */
if (IS_GC_MARKING_TRACER(trc) && (n = lhe->count - 1) != 0) { n = lhe->count - 1;
if (n != 0) {
if (IS_GC_MARKING_TRACER(trc)) {
rt = trc->context->runtime; rt = trc->context->runtime;
if (rt->gcThingCallback) { if (rt->gcThingCallback) {
do { do {
rt->gcThingCallback(thing, flags, rt->gcThingCallbackClosure); rt->gcThingCallback(thing, flags,
rt->gcThingCallbackClosure);
} while (--n != 0);
}
} else {
do {
JS_CALL_TRACER(trc, thing, traceKind, "locked object");
} while (--n != 0); } while (--n != 0);
} }
} }