Bug 1189822 part 2. Remove the DOM proxy expando object hashtable in xpconnect. r=peterv
authorBoris Zbarsky <bzbarsky@mit.edu>
Wed, 17 May 2017 00:52:53 -0400
changeset 358719 d820067e4d5f330adef3711126e93c0869ec9c65
parent 358718 810a380512e91c4586ec52d683fcbdce6be6c7ad
child 358720 5ccd27cf7166db5cdee297abcc8b5fd0ed4d81c6
push id31834
push usercbook@mozilla.com
push dateWed, 17 May 2017 09:17:05 +0000
treeherdermozilla-central@8601af413448 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv
bugs1189822
milestone55.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
Bug 1189822 part 2. Remove the DOM proxy expando object hashtable in xpconnect. r=peterv
js/xpconnect/src/XPCWrappedNativeScope.cpp
js/xpconnect/src/xpcprivate.h
--- a/js/xpconnect/src/XPCWrappedNativeScope.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeScope.cpp
@@ -490,45 +490,27 @@ XPCWrappedNativeScope::TraceWrappedNativ
     // 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");
-        }
     }
 }
 
-static void
-SuspectDOMExpandos(JSObject* obj, nsCycleCollectionNoteRootCallback& cb)
-{
-    MOZ_ASSERT(dom::GetDOMClass(obj) && dom::GetDOMClass(obj)->mDOMObjectIsISupports);
-    nsISupports* native = dom::UnwrapDOMObject<nsISupports>(obj);
-    cb.NoteXPCOMRoot(native);
-}
-
 // static
 void
 XPCWrappedNativeScope::SuspectAllWrappers(nsCycleCollectionNoteRootCallback& cb)
 {
     for (XPCWrappedNativeScope* cur = gScopes; cur; cur = cur->mNext) {
         for (auto i = cur->mWrappedNativeMap->Iter(); !i.Done(); i.Next()) {
             static_cast<Native2WrappedNativeMap::Entry*>(i.Get())->value->Suspect(cb);
         }
-
-        if (cur->mDOMExpandoSet) {
-            for (DOMExpandoSet::Range r = cur->mDOMExpandoSet->all(); !r.empty(); r.popFront())
-                SuspectDOMExpandos(r.front().unbarrieredGet(), cb);
-        }
     }
 }
 
 // static
 void
 XPCWrappedNativeScope::UpdateWeakPointersInAllScopesAfterGC()
 {
     // If this is called from the finalization callback in JSGC_MARK_END then
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -990,38 +990,16 @@ public:
     AddSizeOfAllScopesIncludingThis(ScopeSizeInfo* scopeSizeInfo);
 
     void
     AddSizeOfIncludingThis(ScopeSizeInfo* scopeSizeInfo);
 
     static bool
     IsDyingScope(XPCWrappedNativeScope* scope);
 
-    typedef js::HashSet<JS::Heap<JSObject*>,
-                        js::MovableCellHasher<JS::Heap<JSObject*>>,
-                        js::SystemAllocPolicy> DOMExpandoSet;
-
-    bool RegisterDOMExpandoObject(JSObject* expando) {
-        // Expandos are proxy objects, and proxies are always tenured.
-        JS::AssertGCThingMustBeTenured(expando);
-        if (!mDOMExpandoSet) {
-            mDOMExpandoSet = new DOMExpandoSet();
-            if (!mDOMExpandoSet->init(8))
-                return false;
-        }
-        return mDOMExpandoSet->put(JS::Heap<JSObject*>(expando));
-    }
-    void RemoveDOMExpandoObject(JSObject* expando) {
-        if (mDOMExpandoSet) {
-            DOMExpandoSet::Ptr p = mDOMExpandoSet->lookup(JS::Heap<JSObject*>(expando));
-            MOZ_ASSERT(p.found());
-            mDOMExpandoSet->remove(p);
-        }
-    }
-
     typedef js::HashMap<JSAddonId*,
                         nsCOMPtr<nsIAddonInterposition>,
                         js::PointerHasher<JSAddonId*, 3>,
                         js::SystemAllocPolicy> InterpositionMap;
 
     typedef js::HashSet<JSAddonId*,
                         js::PointerHasher<JSAddonId*, 3>,
                         js::SystemAllocPolicy> AddonSet;
@@ -1104,18 +1082,16 @@ private:
     // This is a service that will be use to interpose on some property accesses on
     // objects from other scope, for add-on compatibility reasons.
     nsCOMPtr<nsIAddonInterposition>  mInterposition;
 
     // If this flag is set, we intercept function calls on vanilla JS function objects
     // from this scope if the caller scope has mInterposition set.
     bool mHasCallInterpositions;
 
-    nsAutoPtr<DOMExpandoSet> mDOMExpandoSet;
-
     JS::WeakMapPtr<JSObject*, JSObject*> mXrayExpandos;
 
     bool mIsContentXBLScope;
     bool mIsAddonScope;
 
     // For remote XUL domains, we run all XBL in the content scope for compat
     // reasons (though we sometimes pref this off for automation). We separately
     // track the result of this decision (mAllowContentXBLScope), from the decision