Bug 1238786 - Part 2: We no longer need to null check before using trace APIs; r=smaug

This commit is contained in:
Terrence Cole 2016-01-12 13:07:54 -08:00
parent 6a30234d33
commit f7571de4b9
6 changed files with 10 additions and 14 deletions

View File

@ -311,7 +311,7 @@ class ProtoAndIfaceCache
void Trace(JSTracer* aTracer) {
for (size_t i = 0; i < ArrayLength(*this); ++i) {
JS::TraceNullableEdge(aTracer, &(*this)[i], "protoAndIfaceCache[i]");
JS::TraceEdge(aTracer, &(*this)[i], "protoAndIfaceCache[i]");
}
}
@ -370,7 +370,7 @@ class ProtoAndIfaceCache
Page* p = mPages[i];
if (p) {
for (size_t j = 0; j < ArrayLength(*p); ++j) {
JS::TraceNullableEdge(trc, &(*p)[j], "protoAndIfaceCache[i]");
JS::TraceEdge(trc, &(*p)[j], "protoAndIfaceCache[i]");
}
}
}

View File

@ -44,12 +44,8 @@ protected:
public:
inline void TraceSelf(JSTracer* trc)
{
if (mTypedObj) {
JS::UnsafeTraceRoot(trc, &mTypedObj, "TypedArray.mTypedObj");
}
if (mWrappedObj) {
JS::UnsafeTraceRoot(trc, &mTypedObj, "TypedArray.mWrappedObj");
}
JS::UnsafeTraceRoot(trc, &mTypedObj, "TypedArray.mTypedObj");
JS::UnsafeTraceRoot(trc, &mTypedObj, "TypedArray.mWrappedObj");
}
private:

View File

@ -288,7 +288,7 @@ TraceJSObjWrappers(JSTracer *trc, void *data)
nsJSObjWrapperKey key = e.front().key();
JS::UnsafeTraceRoot(trc, &key.mJSObj, "sJSObjWrappers key object");
nsJSObjWrapper *wrapper = e.front().value();
JS::TraceNullableEdge(trc, &wrapper->mJSObj, "sJSObjWrappers wrapper object");
JS::TraceEdge(trc, &wrapper->mJSObj, "sJSObjWrappers wrapper object");
if (key != e.front().key()) {
e.rekeyFront(key);
}
@ -2266,8 +2266,8 @@ NPObjectMember_Trace(JSTracer *trc, JSObject *obj)
// There's no strong reference from our private data to the
// NPObject, so make sure to mark the NPObject wrapper to keep the
// NPObject alive as long as this NPObjectMember is alive.
JS::TraceNullableEdge(trc, &memberPrivate->npobjWrapper,
"NPObject Member => npobjWrapper");
JS::TraceEdge(trc, &memberPrivate->npobjWrapper,
"NPObject Member => npobjWrapper");
}
static bool

View File

@ -249,7 +249,7 @@ public:
void TraceScriptObject(JSTracer* aTrc)
{
JS::TraceNullableEdge(aTrc, &mScriptObject, "active window XUL prototype script");
JS::TraceEdge(aTrc, &mScriptObject, "active window XUL prototype script");
}
void Trace(const TraceCallbacks& aCallbacks, void* aClosure)

View File

@ -2196,7 +2196,7 @@ public:
// This is the only time we should be tracing our mFlatJSObject,
// normally somebody else is doing that. Be careful not to trace the
// bogus INVALID_OBJECT value we can have during init, though.
JS::TraceNullableEdge(trc, &mFlatJSObject, "XPCWrappedNative::mFlatJSObject");
JS::TraceEdge(trc, &mFlatJSObject, "XPCWrappedNative::mFlatJSObject");
}
static void Trace(JSTracer* trc, JSObject* obj);

View File

@ -801,7 +801,7 @@ struct JsGcTracer : public TraceCallbacks
virtual void Trace(JS::TenuredHeap<JSObject*>* aPtr, const char* aName,
void* aClosure) const override
{
JS::TraceNullableEdge(static_cast<JSTracer*>(aClosure), aPtr, aName);
JS::TraceEdge(static_cast<JSTracer*>(aClosure), aPtr, aName);
}
virtual void Trace(JS::Heap<JSString*>* aPtr, const char* aName,
void* aClosure) const override