From fd0fcea7036b384d4363e438f96811f50c6d051a Mon Sep 17 00:00:00 2001 From: Terrence Cole Date: Wed, 30 Dec 2015 11:31:16 -0800 Subject: [PATCH] Bug 1235923 - Part 2: Use new Root tracing APIs in Gecko; r=smaug --- dom/base/nsWrapperCache.h | 2 +- dom/bindings/BindingUtils.h | 4 ++-- dom/bindings/Codegen.py | 6 +++--- dom/bindings/TypedArray.h | 4 ++-- dom/plugins/base/nsJSNPRuntime.cpp | 4 ++-- js/xpconnect/src/xpcprivate.h | 5 +---- xpcom/base/CycleCollectedJSRuntime.cpp | 4 ++-- 7 files changed, 13 insertions(+), 16 deletions(-) diff --git a/dom/base/nsWrapperCache.h b/dom/base/nsWrapperCache.h index 0c8daaa35baa..c837e1e53450 100644 --- a/dom/base/nsWrapperCache.h +++ b/dom/base/nsWrapperCache.h @@ -258,7 +258,7 @@ protected: void TraceWrapper(JSTracer* aTrc, const char* name) { if (mWrapper) { - JS_CallUnbarrieredObjectTracer(aTrc, &mWrapper, name); + js::UnsafeTraceManuallyBarrieredEdge(aTrc, &mWrapper, name); } } diff --git a/dom/bindings/BindingUtils.h b/dom/bindings/BindingUtils.h index 55b4a6901a83..5747478acc22 100644 --- a/dom/bindings/BindingUtils.h +++ b/dom/bindings/BindingUtils.h @@ -2095,7 +2095,7 @@ class SequenceTracer public: static void TraceSequence(JSTracer* trc, JSObject** objp, JSObject** end) { for (; objp != end; ++objp) { - JS_CallUnbarrieredObjectTracer(trc, objp, "sequence"); + JS::UnsafeTraceRoot(trc, objp, "sequence"); } } }; @@ -2109,7 +2109,7 @@ class SequenceTracer public: static void TraceSequence(JSTracer* trc, JS::Value* valp, JS::Value* end) { for (; valp != end; ++valp) { - JS_CallUnbarrieredValueTracer(trc, valp, "sequence"); + JS::UnsafeTraceRoot(trc, valp, "sequence"); } } }; diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 6aaca494289d..d33973d97f9a 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -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()): diff --git a/dom/bindings/TypedArray.h b/dom/bindings/TypedArray.h index 8690d8b630e1..dd609aff5585 100644 --- a/dom/bindings/TypedArray.h +++ b/dom/bindings/TypedArray.h @@ -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"); } } diff --git a/dom/plugins/base/nsJSNPRuntime.cpp b/dom/plugins/base/nsJSNPRuntime.cpp index febfa3e1b08e..ec59de0f90a5 100644 --- a/dom/plugins/base/nsJSNPRuntime.cpp +++ b/dom/plugins/base/nsJSNPRuntime.cpp @@ -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); } diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h index 5a0554086299..915fa2bf24a6 100644 --- a/js/xpconnect/src/xpcprivate.h +++ b/js/xpconnect/src/xpcprivate.h @@ -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); diff --git a/xpcom/base/CycleCollectedJSRuntime.cpp b/xpcom/base/CycleCollectedJSRuntime.cpp index f2bd147a1777..6b923ff96b25 100644 --- a/xpcom/base/CycleCollectedJSRuntime.cpp +++ b/xpcom/base/CycleCollectedJSRuntime.cpp @@ -796,12 +796,12 @@ struct JsGcTracer : public TraceCallbacks virtual void Trace(JSObject** aPtr, const char* aName, void* aClosure) const override { - JS_CallUnbarrieredObjectTracer(static_cast(aClosure), aPtr, aName); + js::UnsafeTraceManuallyBarrieredEdge(static_cast(aClosure), aPtr, aName); } virtual void Trace(JS::TenuredHeap* aPtr, const char* aName, void* aClosure) const override { - JS_CallTenuredObjectTracer(static_cast(aClosure), aPtr, aName); + JS::TraceNullableEdge(static_cast(aClosure), aPtr, aName); } virtual void Trace(JS::Heap* aPtr, const char* aName, void* aClosure) const override