Bug 403678: GC thing callback is removed. r,a=brendan

This commit is contained in:
igor@mir2.org 2007-11-19 02:57:04 -08:00
parent b66ba0396a
commit 26b6e88b32
5 changed files with 0 additions and 45 deletions

View File

@ -2470,13 +2470,6 @@ JS_SetGCCallbackRT(JSRuntime *rt, JSGCCallback cb)
return oldcb; return oldcb;
} }
JS_PUBLIC_API(void)
JS_SetGCThingCallback(JSContext *cx, JSGCThingCallback cb, void *closure)
{
cx->runtime->gcThingCallback = cb;
cx->runtime->gcThingCallbackClosure = closure;
}
JS_PUBLIC_API(JSBool) JS_PUBLIC_API(JSBool)
JS_IsAboutToBeFinalized(JSContext *cx, void *thing) JS_IsAboutToBeFinalized(JSContext *cx, void *thing)
{ {

View File

@ -1094,9 +1094,6 @@ JS_SetGCCallbackRT(JSRuntime *rt, JSGCCallback cb);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_IsGCMarkingTracer(JSTracer *trc); JS_IsGCMarkingTracer(JSTracer *trc);
extern JS_PUBLIC_API(void)
JS_SetGCThingCallback(JSContext *cx, JSGCThingCallback cb, void *closure);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_IsAboutToBeFinalized(JSContext *cx, void *thing); JS_IsAboutToBeFinalized(JSContext *cx, void *thing);

View File

@ -198,8 +198,6 @@ struct JSRuntime {
#endif #endif
JSGCCallback gcCallback; JSGCCallback gcCallback;
JSGCThingCallback gcThingCallback;
void *gcThingCallbackClosure;
uint32 gcMallocBytes; uint32 gcMallocBytes;
JSGCArenaInfo *gcUntracedArenaStackTop; JSGCArenaInfo *gcUntracedArenaStackTop;
#ifdef DEBUG #ifdef DEBUG

View File

@ -1913,9 +1913,6 @@ JS_CallTracer(JSTracer *trc, void *thing, uint32 kind)
JS_ASSERT(rt->gcMarkingTracer == trc); JS_ASSERT(rt->gcMarkingTracer == trc);
JS_ASSERT(rt->gcLevel > 0); JS_ASSERT(rt->gcLevel > 0);
if (rt->gcThingCallback)
rt->gcThingCallback(thing, kind, rt->gcThingCallbackClosure);
/* /*
* Optimize for string and double as their size is known and their tracing * Optimize for string and double as their size is known and their tracing
* is not recursive. * is not recursive.
@ -1941,8 +1938,6 @@ JS_CallTracer(JSTracer *trc, void *thing, uint32 kind)
goto out; goto out;
*flagp |= GCF_MARK; *flagp |= GCF_MARK;
thing = JSSTRDEP_BASE((JSString *) thing); thing = JSSTRDEP_BASE((JSString *) thing);
if (rt->gcThingCallback)
rt->gcThingCallback(thing, kind, rt->gcThingCallbackClosure);
} }
/* NOTREACHED */ /* NOTREACHED */
} }
@ -2080,34 +2075,10 @@ gc_lock_traversal(JSDHashTable *table, JSDHashEntryHdr *hdr, uint32 num,
void *thing = (void *)lhe->thing; void *thing = (void *)lhe->thing;
JSTracer *trc = (JSTracer *)arg; JSTracer *trc = (JSTracer *)arg;
uint32 traceKind; uint32 traceKind;
JSRuntime *rt;
uint32 n;
JS_ASSERT(lhe->count >= 1); JS_ASSERT(lhe->count >= 1);
traceKind = js_GetGCThingTraceKind(thing); traceKind = js_GetGCThingTraceKind(thing);
JS_CALL_TRACER(trc, thing, traceKind, "locked object"); JS_CALL_TRACER(trc, thing, traceKind, "locked object");
/*
* Bug 379455: we called the tracer once, but to communicate the value of
* thing's lock count to the tracer, or to gcThingCallback when the tracer
* is the GC marking phase, we need to call an extra lhe->count - 1 times.
*/
n = lhe->count - 1;
if (n != 0) {
if (IS_GC_MARKING_TRACER(trc)) {
rt = trc->context->runtime;
if (rt->gcThingCallback) {
do {
rt->gcThingCallback(thing, traceKind,
rt->gcThingCallbackClosure);
} while (--n != 0);
}
} else {
do {
JS_CALL_TRACER(trc, thing, traceKind, "locked object");
} while (--n != 0);
}
}
return JS_DHASH_NEXT; return JS_DHASH_NEXT;
} }

View File

@ -636,10 +636,6 @@ typedef enum JSGCStatus {
typedef JSBool typedef JSBool
(* JS_DLL_CALLBACK JSGCCallback)(JSContext *cx, JSGCStatus status); (* JS_DLL_CALLBACK JSGCCallback)(JSContext *cx, JSGCStatus status);
typedef void
(* JS_DLL_CALLBACK JSGCThingCallback)(void *thing, uint32 traceKind,
void *closure);
/* /*
* Generic trace operation that calls JS_CallTracer on each traceable thing * Generic trace operation that calls JS_CallTracer on each traceable thing
* stored in data. * stored in data.