Bug 1235923 - Part 2: Use new Root tracing APIs in Gecko; r=smaug

This commit is contained in:
Terrence Cole 2015-12-30 11:31:16 -08:00
parent 38d2805997
commit b973cdd50c
7 changed files with 13 additions and 16 deletions

View File

@ -258,7 +258,7 @@ protected:
void TraceWrapper(JSTracer* aTrc, const char* name)
{
if (mWrapper) {
JS_CallUnbarrieredObjectTracer(aTrc, &mWrapper, name);
js::UnsafeTraceManuallyBarrieredEdge(aTrc, &mWrapper, name);
}
}

View File

@ -2095,7 +2095,7 @@ class SequenceTracer<JSObject*, false, false, false>
public:
static void TraceSequence(JSTracer* trc, JSObject** objp, JSObject** end) {
for (; objp != end; ++objp) {
JS_CallUnbarrieredObjectTracer(trc, objp, "sequence<object>");
JS::UnsafeTraceRoot(trc, objp, "sequence<object>");
}
}
};
@ -2109,7 +2109,7 @@ class SequenceTracer<JS::Value, false, false, false>
public:
static void TraceSequence(JSTracer* trc, JS::Value* valp, JS::Value* end) {
for (; valp != end; ++valp) {
JS_CallUnbarrieredValueTracer(trc, valp, "sequence<any>");
JS::UnsafeTraceRoot(trc, valp, "sequence<any>");
}
}
};

View File

@ -9620,7 +9620,7 @@ class CGUnionStruct(CGThing):
if t.isObject():
traceCases.append(
CGCase("e" + vars["name"],
CGGeneric('JS_CallUnbarrieredObjectTracer(trc, %s, "%s");\n' %
CGGeneric('JS::UnsafeTraceRoot(trc, %s, "%s");\n' %
("&mValue.m" + vars["name"] + ".Value()",
"mValue.m" + vars["name"]))))
elif t.isDictionary():
@ -12603,12 +12603,12 @@ class CGDictionary(CGThing):
memberLoc)
if type.isObject():
trace = CGGeneric('JS_CallUnbarrieredObjectTracer(trc, %s, "%s");\n' %
trace = CGGeneric('JS::UnsafeTraceRoot(trc, %s, "%s");\n' %
("&"+memberData, memberName))
if type.nullable():
trace = CGIfWrapper(trace, memberData)
elif type.isAny():
trace = CGGeneric('JS_CallUnbarrieredValueTracer(trc, %s, "%s");\n' %
trace = CGGeneric('JS::UnsafeTraceRoot(trc, %s, "%s");\n' %
("&"+memberData, memberName))
elif (type.isSequence() or type.isDictionary() or
type.isSpiderMonkeyInterface() or type.isUnion()):

View File

@ -45,10 +45,10 @@ public:
inline void TraceSelf(JSTracer* trc)
{
if (mTypedObj) {
JS_CallUnbarrieredObjectTracer(trc, &mTypedObj, "TypedArray.mTypedObj");
JS::UnsafeTraceRoot(trc, &mTypedObj, "TypedArray.mTypedObj");
}
if (mWrappedObj) {
JS_CallUnbarrieredObjectTracer(trc, &mTypedObj, "TypedArray.mWrappedObj");
JS::UnsafeTraceRoot(trc, &mTypedObj, "TypedArray.mWrappedObj");
}
}

View File

@ -286,7 +286,7 @@ TraceJSObjWrappers(JSTracer *trc, void *data)
// any of them moved.
for (JSObjWrapperTable::Enum e(sJSObjWrappers); !e.empty(); e.popFront()) {
nsJSObjWrapperKey key = e.front().key();
JS_CallUnbarrieredObjectTracer(trc, &key.mJSObj, "sJSObjWrappers key object");
JS::UnsafeTraceRoot(trc, &key.mJSObj, "sJSObjWrappers key object");
nsJSObjWrapper *wrapper = e.front().value();
JS::TraceNullableEdge(trc, &wrapper->mJSObj, "sJSObjWrappers wrapper object");
if (key != e.front().key()) {
@ -1101,7 +1101,7 @@ JSObjWrapperKeyMarkCallback(JSTracer *trc, JSObject *obj, void *data) {
if (!p)
return;
JS_CallUnbarrieredObjectTracer(trc, &obj, "sJSObjWrappers key object");
js::UnsafeTraceManuallyBarrieredEdge(trc, &obj, "sJSObjWrappers key object");
nsJSObjWrapperKey newKey(obj, npp);
sJSObjWrappers.rekeyIfMoved(oldKey, newKey);
}

View File

@ -2196,10 +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.
if (mFlatJSObject) {
JS_CallTenuredObjectTracer(trc, &mFlatJSObject,
"XPCWrappedNative::mFlatJSObject");
}
JS::TraceNullableEdge(trc, &mFlatJSObject, "XPCWrappedNative::mFlatJSObject");
}
static void Trace(JSTracer* trc, JSObject* obj);

View File

@ -796,12 +796,12 @@ struct JsGcTracer : public TraceCallbacks
virtual void Trace(JSObject** aPtr, const char* aName,
void* aClosure) const override
{
JS_CallUnbarrieredObjectTracer(static_cast<JSTracer*>(aClosure), aPtr, aName);
js::UnsafeTraceManuallyBarrieredEdge(static_cast<JSTracer*>(aClosure), aPtr, aName);
}
virtual void Trace(JS::TenuredHeap<JSObject*>* aPtr, const char* aName,
void* aClosure) const override
{
JS_CallTenuredObjectTracer(static_cast<JSTracer*>(aClosure), aPtr, aName);
JS::TraceNullableEdge(static_cast<JSTracer*>(aClosure), aPtr, aName);
}
virtual void Trace(JS::Heap<JSString*>* aPtr, const char* aName,
void* aClosure) const override