Bug 899367 - Add an API to determine if we're marking gray. r=billm

This allows us to assert that certain callbacks get invoked during the gray
phase of a marking GC.
This commit is contained in:
Bobby Holley 2013-09-04 14:06:54 -07:00
parent 59b924c116
commit bd532022b3
2 changed files with 15 additions and 0 deletions

View File

@ -2379,6 +2379,15 @@ JS_IsGCMarkingTracer(JSTracer *trc)
return IS_GC_MARKING_TRACER(trc);
}
#ifdef DEBUG
extern JS_PUBLIC_API(bool)
JS_IsMarkingGray(JSTracer *trc)
{
JS_ASSERT(JS_IsGCMarkingTracer(trc));
return trc->callback == GCMarker::GrayCallback;
}
#endif
JS_PUBLIC_API(void)
JS_GC(JSRuntime *rt)
{

View File

@ -2210,6 +2210,12 @@ JS_SetFinalizeCallback(JSRuntime *rt, JSFinalizeCallback cb);
extern JS_PUBLIC_API(bool)
JS_IsGCMarkingTracer(JSTracer *trc);
/* For assertions only. */
#ifdef DEBUG
extern JS_PUBLIC_API(bool)
JS_IsMarkingGray(JSTracer *trc);
#endif
/*
* JS_IsAboutToBeFinalized checks if the given object is going to be finalized
* at the end of the current GC. When called outside of the context of a GC,