Backout Bug 1235598 Part 2 because of merge bustage on a CLOSED TREE
☠☠ backed out by c1b8d8e11880 ☠ ☠
authorTerrence Cole <terrence@mozilla.com>
Wed, 30 Dec 2015 15:05:24 -0800
changeset 315035 7da07459ce20c444c070ba8061c687c77bbc5400
parent 315034 e47415eaddef22a28f61b5aa780e96d85eaeeec9
child 315036 241e21132790a680412ae780900c029571c2878f
push id1079
push userjlund@mozilla.com
push dateFri, 15 Apr 2016 21:02:33 +0000
treeherdermozilla-release@575fbf6786d5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1235598
milestone46.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backout Bug 1235598 Part 2 because of merge bustage on a CLOSED TREE
dom/base/nsWrapperCache.h
dom/bindings/BindingUtils.h
dom/plugins/base/nsJSNPRuntime.cpp
dom/workers/XMLHttpRequest.cpp
dom/xul/nsXULElement.h
dom/xul/nsXULPrototypeCache.cpp
js/ipc/JavaScriptShared.cpp
js/xpconnect/src/XPCVariant.cpp
js/xpconnect/src/XPCWrappedJS.cpp
js/xpconnect/src/XPCWrappedNative.cpp
js/xpconnect/src/XPCWrappedNativeScope.cpp
xpcom/base/CycleCollectedJSRuntime.cpp
xpcom/glue/tests/gtest/TestGCPostBarriers.cpp
--- a/dom/base/nsWrapperCache.h
+++ b/dom/base/nsWrapperCache.h
@@ -253,17 +253,17 @@ public:
   }
 
   void ReleaseWrapper(void* aScriptObjectHolder);
 
 protected:
   void TraceWrapper(JSTracer* aTrc, const char* name)
   {
     if (mWrapper) {
-      js::UnsafeTraceManuallyBarrieredEdge(aTrc, &mWrapper, name);
+      JS_CallUnbarrieredObjectTracer(aTrc, &mWrapper, name);
     }
   }
 
   void PoisonWrapper()
   {
     if (mWrapper) {
       // See setToCrashOnTouch() in RootingAPI.h
       mWrapper = reinterpret_cast<JSObject*>(1);
--- a/dom/bindings/BindingUtils.h
+++ b/dom/bindings/BindingUtils.h
@@ -329,17 +329,19 @@ class ProtoAndIfaceCache
     }
 
     JS::Heap<JSObject*>& EntrySlotMustExist(size_t i) {
       return (*this)[i];
     }
 
     void Trace(JSTracer* aTracer) {
       for (size_t i = 0; i < ArrayLength(*this); ++i) {
-        JS::TraceNullableEdge(aTracer, &(*this)[i], "protoAndIfaceCache[i]");
+        if ((*this)[i]) {
+          JS_CallObjectTracer(aTracer, &(*this)[i], "protoAndIfaceCache[i]");
+        }
       }
     }
 
     size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) {
       return aMallocSizeOf(this);
     }
   };
 
@@ -388,17 +390,19 @@ class ProtoAndIfaceCache
       return (*p)[leafIndex];
     }
 
     void Trace(JSTracer* trc) {
       for (size_t i = 0; i < ArrayLength(mPages); ++i) {
         Page* p = mPages[i];
         if (p) {
           for (size_t j = 0; j < ArrayLength(*p); ++j) {
-            JS::TraceNullableEdge(trc, &(*p)[j], "protoAndIfaceCache[i]");
+            if ((*p)[j]) {
+              JS_CallObjectTracer(trc, &(*p)[j], "protoAndIfaceCache[i]");
+            }
           }
         }
       }
     }
 
     size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) {
       size_t n = aMallocSizeOf(this);
       for (size_t i = 0; i < ArrayLength(mPages); ++i) {
--- a/dom/plugins/base/nsJSNPRuntime.cpp
+++ b/dom/plugins/base/nsJSNPRuntime.cpp
@@ -283,17 +283,19 @@ TraceJSObjWrappers(JSTracer *trc, void *
   }
 
   // Trace all JSObjects in the sJSObjWrappers table and rekey the entries if
   // 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");
     nsJSObjWrapper *wrapper = e.front().value();
-    JS::TraceNullableEdge(trc, &wrapper->mJSObj, "sJSObjWrappers wrapper object");
+    if (wrapper->mJSObj) {
+      JS_CallObjectTracer(trc, &wrapper->mJSObj, "sJSObjWrappers wrapper object");
+    }
     if (key != e.front().key()) {
       e.rekeyFront(key);
     }
   }
 }
 
 static void
 DelayedReleaseGCCallback(JSGCStatus status)
@@ -2253,26 +2255,31 @@ NPObjectMember_Call(JSContext *cx, unsig
 static void
 NPObjectMember_Trace(JSTracer *trc, JSObject *obj)
 {
   NPObjectMemberPrivate *memberPrivate =
     (NPObjectMemberPrivate *)::JS_GetPrivate(obj);
   if (!memberPrivate)
     return;
 
-  // Our NPIdentifier is not always interned, so we must trace it.
-  JS::TraceEdge(trc, &memberPrivate->methodName, "NPObjectMemberPrivate.methodName");
-
-  JS::TraceEdge(trc, &memberPrivate->fieldValue, "NPObject Member => fieldValue");
+  // Our NPIdentifier is not always interned, so we must root it explicitly.
+  JS_CallIdTracer(trc, &memberPrivate->methodName, "NPObjectMemberPrivate.methodName");
+
+  if (!memberPrivate->fieldValue.isPrimitive()) {
+    JS_CallValueTracer(trc, &memberPrivate->fieldValue,
+                       "NPObject Member => fieldValue");
+  }
 
   // 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,
+  if (memberPrivate->npobjWrapper) {
+    JS_CallObjectTracer(trc, &memberPrivate->npobjWrapper,
                         "NPObject Member => npobjWrapper");
+  }
 }
 
 static bool
 NPObjectMember_toPrimitive(JSContext *cx, unsigned argc, JS::Value *vp)
 {
   JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
   JS::RootedValue thisv(cx, args.thisv());
   if (thisv.isPrimitive()) {
--- a/dom/workers/XMLHttpRequest.cpp
+++ b/dom/workers/XMLHttpRequest.cpp
@@ -554,18 +554,18 @@ public:
     : CustomAutoRooter(aCx), mStateData(aData)
     {
       MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     }
 
   private:
     virtual void trace(JSTracer* aTrc)
     {
-      JS::TraceEdge(aTrc, &mStateData->mResponse,
-                    "XMLHttpRequest::StateData::mResponse");
+      JS_CallValueTracer(aTrc, &mStateData->mResponse,
+                         "XMLHttpRequest::StateData::mResponse");
     }
   };
 
   EventRunnable(Proxy* aProxy, bool aUploadEvent, const nsString& aType,
                 bool aLengthComputable, uint64_t aLoaded, uint64_t aTotal)
   : MainThreadProxyRunnable(aProxy->mWorkerPrivate, aProxy),
     StructuredCloneHolder(CloningSupported, TransferringNotSupported,
                           SameProcessDifferentThread),
--- a/dom/xul/nsXULElement.h
+++ b/dom/xul/nsXULElement.h
@@ -244,17 +244,19 @@ public:
         // Calling fromMarkedLocation() is safe because we trace mScriptObject in
         // TraceScriptObject() and because its value is never changed after it has
         // been set.
         return JS::Handle<JSScript*>::fromMarkedLocation(mScriptObject.address());
     }
 
     void TraceScriptObject(JSTracer* aTrc)
     {
-        JS::TraceNullableEdge(aTrc, &mScriptObject, "active window XUL prototype script");
+        if (mScriptObject) {
+            JS_CallScriptTracer(aTrc, &mScriptObject, "active window XUL prototype script");
+        }
     }
 
     void Trace(const TraceCallbacks& aCallbacks, void* aClosure)
     {
         if (mScriptObject) {
             aCallbacks.Trace(&mScriptObject, "mScriptObject", aClosure);
         }
     }
--- a/dom/xul/nsXULPrototypeCache.cpp
+++ b/dom/xul/nsXULPrototypeCache.cpp
@@ -625,17 +625,17 @@ nsXULPrototypeCache::MarkInCCGeneration(
     mXBLDocTable.Enumerate(MarkXBLInCCGeneration, &aGeneration);
     mPrototypeTable.Enumerate(MarkXULInCCGeneration, &aGeneration);
 }
 
 static PLDHashOperator
 MarkScriptsInGC(nsIURI* aKey, JS::Heap<JSScript*>& aScript, void* aClosure)
 {
     JSTracer* trc = static_cast<JSTracer*>(aClosure);
-    JS::TraceEdge(trc, &aScript, "nsXULPrototypeCache script");
+    JS_CallScriptTracer(trc, &aScript, "nsXULPrototypeCache script");
     return PL_DHASH_NEXT;
 }
 
 void
 nsXULPrototypeCache::MarkInGC(JSTracer* aTrc)
 {
     mScriptTable.Enumerate(MarkScriptsInGC, aTrc);
 }
--- a/js/ipc/JavaScriptShared.cpp
+++ b/js/ipc/JavaScriptShared.cpp
@@ -30,18 +30,20 @@ IdToObjectMap::init()
     if (table_.initialized())
         return true;
     return table_.init(32);
 }
 
 void
 IdToObjectMap::trace(JSTracer* trc)
 {
-    for (Table::Range r(table_.all()); !r.empty(); r.popFront())
-        JS::TraceEdge(trc, &r.front().value(), "ipc-object");
+    for (Table::Range r(table_.all()); !r.empty(); r.popFront()) {
+        DebugOnly<JSObject*> prior = r.front().value().get();
+        JS_CallObjectTracer(trc, &r.front().value(), "ipc-object");
+    }
 }
 
 void
 IdToObjectMap::sweep()
 {
     for (Table::Enum e(table_); !e.empty(); e.popFront()) {
         JS::Heap<JSObject*>* objp = &e.front().value();
         JS_UpdateWeakPointerAfterGC(objp);
--- a/js/xpconnect/src/XPCVariant.cpp
+++ b/js/xpconnect/src/XPCVariant.cpp
@@ -61,17 +61,17 @@ XPCTraceableVariant::~XPCTraceableVarian
 
     if (!val.isNull())
         RemoveFromRootSet();
 }
 
 void XPCTraceableVariant::TraceJS(JSTracer* trc)
 {
     MOZ_ASSERT(mJSVal.isMarkable());
-    JS::TraceEdge(trc, &mJSVal, "XPCTraceableVariant::mJSVal");
+    JS_CallValueTracer(trc, &mJSVal, "XPCTraceableVariant::mJSVal");
 }
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(XPCVariant)
 
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(XPCVariant)
     JS::Value val = tmp->GetJSValPreserveColor();
     if (val.isObject()) {
         NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mJSVal");
--- a/js/xpconnect/src/XPCWrappedJS.cpp
+++ b/js/xpconnect/src/XPCWrappedJS.cpp
@@ -286,17 +286,17 @@ nsXPCWrappedJS::DeleteCycleCollectable(v
 {
     delete this;
 }
 
 void
 nsXPCWrappedJS::TraceJS(JSTracer* trc)
 {
     MOZ_ASSERT(mRefCnt >= 2 && IsValid(), "must be strongly referenced");
-    JS::TraceEdge(trc, &mJSObj, "nsXPCWrappedJS::mJSObj");
+    JS_CallObjectTracer(trc, &mJSObj, "nsXPCWrappedJS::mJSObj");
 }
 
 NS_IMETHODIMP
 nsXPCWrappedJS::GetWeakReference(nsIWeakReference** aInstancePtr)
 {
     if (!IsRootWrapper())
         return mRoot->GetWeakReference(aInstancePtr);
 
--- a/js/xpconnect/src/XPCWrappedNative.cpp
+++ b/js/xpconnect/src/XPCWrappedNative.cpp
@@ -2355,10 +2355,10 @@ XPCJSObjectHolder::XPCJSObjectHolder(JSO
 XPCJSObjectHolder::~XPCJSObjectHolder()
 {
     RemoveFromRootSet();
 }
 
 void
 XPCJSObjectHolder::TraceJS(JSTracer* trc)
 {
-    JS::TraceEdge(trc, &mJSObj, "XPCJSObjectHolder::mJSObj");
+    JS_CallObjectTracer(trc, &mJSObj, "XPCJSObjectHolder::mJSObj");
 }
--- a/js/xpconnect/src/XPCWrappedNativeScope.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeScope.cpp
@@ -462,29 +462,29 @@ XPCWrappedNativeScope::~XPCWrappedNative
         mAddonScopes[i].finalize(rt);
     mGlobalJSObject.finalize(rt);
 }
 
 // static
 void
 XPCWrappedNativeScope::TraceWrappedNativesInAllScopes(JSTracer* trc, XPCJSRuntime* rt)
 {
-    // Do JS::TraceEdge for all wrapped natives with external references, as
+    // Do JS_CallTracer for all wrapped natives with external references, as
     // well as any DOM expando objects.
     for (XPCWrappedNativeScope* cur = gScopes; cur; cur = cur->mNext) {
         for (auto i = cur->mWrappedNativeMap->Iter(); !i.Done(); i.Next()) {
             auto entry = static_cast<Native2WrappedNativeMap::Entry*>(i.Get());
             XPCWrappedNative* wrapper = entry->value;
             if (wrapper->HasExternalReference() && !wrapper->IsWrapperExpired())
                 wrapper->TraceSelf(trc);
         }
 
         if (cur->mDOMExpandoSet) {
             for (DOMExpandoSet::Enum e(*cur->mDOMExpandoSet); !e.empty(); e.popFront())
-                JS::TraceEdge(trc, &e.mutableFront(), "DOM expando object");
+                JS_CallObjectTracer(trc, &e.mutableFront(), "DOM expando object");
         }
     }
 }
 
 static void
 SuspectDOMExpandos(JSObject* obj, nsCycleCollectionNoteRootCallback& cb)
 {
     MOZ_ASSERT(dom::GetDOMClass(obj) && dom::GetDOMClass(obj)->mDOMObjectIsISupports);
--- a/xpcom/base/CycleCollectedJSRuntime.cpp
+++ b/xpcom/base/CycleCollectedJSRuntime.cpp
@@ -776,52 +776,52 @@ CycleCollectedJSRuntime::ContextCallback
   return self->CustomContextCallback(aContext, aOperation);
 }
 
 struct JsGcTracer : public TraceCallbacks
 {
   virtual void Trace(JS::Heap<JS::Value>* aPtr, const char* aName,
                      void* aClosure) const override
   {
-    JS::TraceEdge(static_cast<JSTracer*>(aClosure), aPtr, aName);
+    JS_CallValueTracer(static_cast<JSTracer*>(aClosure), aPtr, aName);
   }
   virtual void Trace(JS::Heap<jsid>* aPtr, const char* aName,
                      void* aClosure) const override
   {
-    JS::TraceEdge(static_cast<JSTracer*>(aClosure), aPtr, aName);
+    JS_CallIdTracer(static_cast<JSTracer*>(aClosure), aPtr, aName);
   }
   virtual void Trace(JS::Heap<JSObject*>* aPtr, const char* aName,
                      void* aClosure) const override
   {
-    JS::TraceEdge(static_cast<JSTracer*>(aClosure), aPtr, aName);
+    JS_CallObjectTracer(static_cast<JSTracer*>(aClosure), aPtr, aName);
   }
   virtual void Trace(JSObject** aPtr, const char* aName,
                      void* aClosure) const override
   {
     JS_CallUnbarrieredObjectTracer(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);
   }
   virtual void Trace(JS::Heap<JSString*>* aPtr, const char* aName,
                      void* aClosure) const override
   {
-    JS::TraceEdge(static_cast<JSTracer*>(aClosure), aPtr, aName);
+    JS_CallStringTracer(static_cast<JSTracer*>(aClosure), aPtr, aName);
   }
   virtual void Trace(JS::Heap<JSScript*>* aPtr, const char* aName,
                      void* aClosure) const override
   {
-    JS::TraceEdge(static_cast<JSTracer*>(aClosure), aPtr, aName);
+    JS_CallScriptTracer(static_cast<JSTracer*>(aClosure), aPtr, aName);
   }
   virtual void Trace(JS::Heap<JSFunction*>* aPtr, const char* aName,
                      void* aClosure) const override
   {
-    JS::TraceEdge(static_cast<JSTracer*>(aClosure), aPtr, aName);
+    JS_CallFunctionTracer(static_cast<JSTracer*>(aClosure), aPtr, aName);
   }
 };
 
 void
 mozilla::TraceScriptHolder(nsISupports* aHolder, JSTracer* aTracer)
 {
   nsXPCOMCycleCollectionParticipant* participant = nullptr;
   CallQueryInterface(aHolder, &participant);
--- a/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp
+++ b/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp
@@ -23,17 +23,17 @@ using namespace JS;
 using namespace mozilla;
 
 template<class ArrayT>
 static void
 TraceArray(JSTracer* trc, void* data)
 {
   ArrayT* array = static_cast<ArrayT *>(data);
   for (unsigned i = 0; i < array->Length(); ++i)
-    JS::TraceEdge(trc, &array->ElementAt(i), "array-element");
+    JS_CallObjectTracer(trc, &array->ElementAt(i), "array-element");
 }
 
 /*
  * Use arrays with initial size much smaller than the final number of elements
  * to test that moving Heap<T> elements works correctly.
  */
 const size_t ElementCount = 100;
 const size_t InitialElements = ElementCount / 10;