Bug 701415 - Enable GC tracing info in opt builds. r=billm

This commit is contained in:
Andrew McCreight 2012-01-13 17:19:19 -08:00
Родитель 6de3cc03da
Коммит 9c7e486643
9 изменённых файлов: 13 добавлений и 37 удалений

Просмотреть файл

@ -114,10 +114,8 @@ MarkInternal(JSTracer *trc, T **thingp)
JS_SET_TRACING_LOCATION(trc, NULL);
}
#ifdef DEBUG
trc->debugPrinter = NULL;
trc->debugPrintArg = NULL;
#endif
}
#define JS_ROOT_MARKING_ASSERT(trc) \
@ -393,7 +391,7 @@ MarkObjectSlots(JSTracer *trc, JSObject *obj, uint32_t start, uint32_t nslots)
{
JS_ASSERT(obj->isNative());
for (uint32_t i = start; i < (start + nslots); ++i) {
JS_SET_TRACING_DETAILS(trc, js_PrintObjectSlotName, obj, i);
JS_SET_TRACING_DETAILS(trc, js_GetObjectSlotName, obj, i);
MarkValueInternal(trc, obj->nativeGetSlotRef(i).unsafeGet());
}
}

Просмотреть файл

@ -3385,18 +3385,12 @@ JS_CallTracer(JSTracer *trc, void *thing, JSGCTraceKind kind);
* The storage for name or callback's arguments needs to live only until
* the following call to JS_CallTracer returns.
*/
#ifdef DEBUG
# define JS_SET_TRACING_DETAILS(trc, printer, arg, index) \
JS_BEGIN_MACRO \
(trc)->debugPrinter = (printer); \
(trc)->debugPrintArg = (arg); \
(trc)->debugPrintIndex = (index); \
JS_END_MACRO
#else
# define JS_SET_TRACING_DETAILS(trc, printer, arg, index) \
JS_BEGIN_MACRO \
JS_END_MACRO
#endif
/*
* Sets the real location for a marked reference, when passing the address

Просмотреть файл

@ -5915,11 +5915,10 @@ js_ValueToNonNullObject(JSContext *cx, const Value &v)
return obj;
}
#ifdef DEBUG
void
js_PrintObjectSlotName(JSTracer *trc, char *buf, size_t bufsize)
js_GetObjectSlotName(JSTracer *trc, char *buf, size_t bufsize)
{
JS_ASSERT(trc->debugPrinter == js_PrintObjectSlotName);
JS_ASSERT(trc->debugPrinter == js_GetObjectSlotName);
JSObject *obj = (JSObject *)trc->debugPrintArg;
uint32_t slot = uint32_t(trc->debugPrintIndex);
@ -5957,7 +5956,6 @@ js_PrintObjectSlotName(JSTracer *trc, char *buf, size_t bufsize)
}
}
}
#endif
static const Shape *
LastConfigurableShape(JSObject *obj)

Просмотреть файл

@ -1362,7 +1362,7 @@ ValueToObject(JSContext *cx, const Value &v)
} /* namespace js */
extern void
js_PrintObjectSlotName(JSTracer *trc, char *buf, size_t bufsize);
js_GetObjectSlotName(JSTracer *trc, char *buf, size_t bufsize);
extern bool
js_ClearNative(JSContext *cx, JSObject *obj);

Просмотреть файл

@ -103,18 +103,16 @@ void XPCTraceableVariant::TraceJS(JSTracer* trc)
jsval val = GetJSValPreserveColor();
NS_ASSERTION(JSVAL_IS_TRACEABLE(val), "Must be traceable");
JS_SET_TRACING_DETAILS(trc, PrintTraceName, this, 0);
JS_SET_TRACING_DETAILS(trc, GetTraceName, this, 0);
JS_CallTracer(trc, JSVAL_TO_TRACEABLE(val), JSVAL_TRACE_KIND(val));
}
#ifdef DEBUG
// static
void
XPCTraceableVariant::PrintTraceName(JSTracer* trc, char *buf, size_t bufsize)
XPCTraceableVariant::GetTraceName(JSTracer* trc, char *buf, size_t bufsize)
{
JS_snprintf(buf, bufsize, "XPCVariant[0x%p].mJSVal", trc->debugPrintArg);
}
#endif
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(XPCVariant)
JS::Value val = tmp->GetJSValPreserveColor();

Просмотреть файл

@ -249,21 +249,19 @@ void
nsXPCWrappedJS::TraceJS(JSTracer* trc)
{
NS_ASSERTION(mRefCnt >= 2 && IsValid(), "must be strongly referenced");
JS_SET_TRACING_DETAILS(trc, PrintTraceName, this, 0);
JS_SET_TRACING_DETAILS(trc, GetTraceName, this, 0);
JS_CallTracer(trc, GetJSObjectPreserveColor(), JSTRACE_OBJECT);
}
#ifdef DEBUG
// static
void
nsXPCWrappedJS::PrintTraceName(JSTracer* trc, char *buf, size_t bufsize)
nsXPCWrappedJS::GetTraceName(JSTracer* trc, char *buf, size_t bufsize)
{
const nsXPCWrappedJS* self = static_cast<const nsXPCWrappedJS*>
(trc->debugPrintArg);
JS_snprintf(buf, bufsize, "nsXPCWrappedJS[%s,0x%p:0x%p].mJSObj",
self->GetClass()->GetInterfaceName(), self, self->mXPTCStub);
}
#endif
NS_IMETHODIMP
nsXPCWrappedJS::GetWeakReference(nsIWeakReference** aInstancePtr)

Просмотреть файл

@ -3760,19 +3760,17 @@ XPCJSObjectHolder::~XPCJSObjectHolder()
void
XPCJSObjectHolder::TraceJS(JSTracer *trc)
{
JS_SET_TRACING_DETAILS(trc, PrintTraceName, this, 0);
JS_SET_TRACING_DETAILS(trc, GetTraceName, this, 0);
JS_CallTracer(trc, mJSObj, JSTRACE_OBJECT);
}
#ifdef DEBUG
// static
void
XPCJSObjectHolder::PrintTraceName(JSTracer* trc, char *buf, size_t bufsize)
XPCJSObjectHolder::GetTraceName(JSTracer* trc, char *buf, size_t bufsize)
{
JS_snprintf(buf, bufsize, "XPCJSObjectHolder[0x%p].mJSObj",
trc->debugPrintArg);
}
#endif
// static
XPCJSObjectHolder*

Просмотреть файл

@ -728,7 +728,6 @@ NoteJSChild(JSTracer *trc, void **thingp, JSGCTraceKind kind)
* parent pointers iteratively, rather than recursively, to avoid overflow.
*/
if (AddToCCKind(kind)) {
#if defined(DEBUG)
if (NS_UNLIKELY(tracer->cb.WantDebugInfo())) {
// based on DumpNotify in jsapi.c
if (tracer->debugPrinter) {
@ -745,7 +744,6 @@ NoteJSChild(JSTracer *trc, void **thingp, JSGCTraceKind kind)
tracer->cb.NoteNextEdgeName(static_cast<const char*>(tracer->debugPrintArg));
}
}
#endif
tracer->cb.NoteJSChild(thing);
} else if (kind == JSTRACE_SHAPE) {
JS_TraceShapeCycleCollectorChildren(trc, thing);

Просмотреть файл

@ -3150,9 +3150,7 @@ public:
bool IsMainThreadOnly() const {return mMainThreadOnly;}
void TraceJS(JSTracer* trc);
#ifdef DEBUG
static void PrintTraceName(JSTracer* trc, char *buf, size_t bufsize);
#endif
static void GetTraceName(JSTracer* trc, char *buf, size_t bufsize);
virtual ~nsXPCWrappedJS();
protected:
@ -3193,9 +3191,7 @@ public:
virtual ~XPCJSObjectHolder();
void TraceJS(JSTracer *trc);
#ifdef DEBUG
static void PrintTraceName(JSTracer* trc, char *buf, size_t bufsize);
#endif
static void GetTraceName(JSTracer* trc, char *buf, size_t bufsize);
private:
XPCJSObjectHolder(XPCCallContext& ccx, JSObject* obj);
@ -4413,9 +4409,7 @@ public:
virtual ~XPCTraceableVariant();
void TraceJS(JSTracer* trc);
#ifdef DEBUG
static void PrintTraceName(JSTracer* trc, char *buf, size_t bufsize);
#endif
static void GetTraceName(JSTracer* trc, char *buf, size_t bufsize);
};
/***************************************************************************/