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 f32b16c6fe
commit 1831710dfa
5 changed files with 0 additions and 45 deletions

View File

@ -2470,13 +2470,6 @@ JS_SetGCCallbackRT(JSRuntime *rt, JSGCCallback cb)
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_IsAboutToBeFinalized(JSContext *cx, void *thing)
{

View File

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

View File

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

View File

@ -1913,9 +1913,6 @@ JS_CallTracer(JSTracer *trc, void *thing, uint32 kind)
JS_ASSERT(rt->gcMarkingTracer == trc);
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
* is not recursive.
@ -1941,8 +1938,6 @@ JS_CallTracer(JSTracer *trc, void *thing, uint32 kind)
goto out;
*flagp |= GCF_MARK;
thing = JSSTRDEP_BASE((JSString *) thing);
if (rt->gcThingCallback)
rt->gcThingCallback(thing, kind, rt->gcThingCallbackClosure);
}
/* NOTREACHED */
}
@ -2080,34 +2075,10 @@ gc_lock_traversal(JSDHashTable *table, JSDHashEntryHdr *hdr, uint32 num,
void *thing = (void *)lhe->thing;
JSTracer *trc = (JSTracer *)arg;
uint32 traceKind;
JSRuntime *rt;
uint32 n;
JS_ASSERT(lhe->count >= 1);
traceKind = js_GetGCThingTraceKind(thing);
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;
}

View File

@ -636,10 +636,6 @@ typedef enum JSGCStatus {
typedef JSBool
(* 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
* stored in data.