Fix for bug 804732 (Remove mCachedDOMPrototypes). r=bz.
authorPeter Van der Beken <peterv@propagandism.org>
Tue, 23 Oct 2012 22:11:58 +0200
changeset 111665 a18076dda6c8c89ba9772bbad05a5c1fa1ea0e6b
parent 111664 a3dcaf02c5e5eb047d0ea6b75b3c619987c6c955
child 111666 f0482b2db8223faef5cd88b196efec7d6ea8812b
push id23765
push userphilringnalda@gmail.com
push dateMon, 29 Oct 2012 20:48:54 +0000
treeherdermozilla-central@f677f91c89c0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs804732
milestone19.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
Fix for bug 804732 (Remove mCachedDOMPrototypes). r=bz.
js/xpconnect/src/XPCWrappedNativeScope.cpp
js/xpconnect/src/nsXPConnect.cpp
js/xpconnect/src/xpcprivate.h
--- a/js/xpconnect/src/XPCWrappedNativeScope.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeScope.cpp
@@ -379,18 +379,16 @@ XPCWrappedNativeScope::StartFinalization
         if (cur->mWaiverWrapperMap)
             cur->mWaiverWrapperMap->Sweep();
 
         XPCWrappedNativeScope* next = cur->mNext;
 
         if (cur->mGlobalJSObject &&
             JS_IsAboutToBeFinalized(cur->mGlobalJSObject)) {
             cur->mGlobalJSObject.finalize(fop->runtime());
-            if (cur->GetCachedDOMPrototypes().IsInitialized())
-                 cur->GetCachedDOMPrototypes().Clear();
             // Move this scope from the live list to the dying list.
             if (prev)
                 prev->mNext = next;
             else
                 gScopes = next;
             cur->mNext = gDyingScopes;
             gDyingScopes = cur;
             cur = nullptr;
@@ -655,32 +653,16 @@ XPCWrappedNativeScope::RemoveWrappedNati
     XPCAutoLock al(XPCJSRuntime::Get()->GetMapLock());
 
     mWrappedNativeProtoMap->Enumerate(WNProtoRemover,
                                       GetRuntime()->GetDetachedWrappedNativeProtoMap());
     mMainThreadWrappedNativeProtoMap->Enumerate(WNProtoRemover,
                                                 GetRuntime()->GetDetachedWrappedNativeProtoMap());
 }
 
-static PLDHashOperator
-TraceDOMPrototype(const char* aKey, JSObject* aData, void* aClosure)
-{
-    JSTracer *trc = static_cast<JSTracer*>(aClosure);
-    JS_CALL_OBJECT_TRACER(trc, aData, "DOM prototype");
-    return PL_DHASH_NEXT;
-}
-
-void
-XPCWrappedNativeScope::TraceDOMPrototypes(JSTracer *trc)
-{
-    if (mCachedDOMPrototypes.IsInitialized()) {
-        mCachedDOMPrototypes.EnumerateRead(TraceDOMPrototype, trc);
-    }
-}
-
 /***************************************************************************/
 
 // static
 void
 XPCWrappedNativeScope::DebugDumpAllScopes(int16_t depth)
 {
 #ifdef DEBUG
     depth-- ;
--- a/js/xpconnect/src/nsXPConnect.cpp
+++ b/js/xpconnect/src/nsXPConnect.cpp
@@ -1021,19 +1021,16 @@ TraceXPCGlobal(JSTracer *trc, JSObject *
     if (trc->callback == VerifyTraceXPCGlobalCalled) {
         // We don't do anything here, we only want to verify that TraceXPCGlobal
         // was called.
         reinterpret_cast<VerifyTraceXPCGlobalCalledTracer*>(trc)->ok = true;
         return;
     }
 #endif
 
-    if (XPCWrappedNativeScope *scope = GetObjectScope(obj))
-        scope->TraceDOMPrototypes(trc);
-
     if (js::GetObjectClass(obj)->flags & JSCLASS_DOM_GLOBAL)
         mozilla::dom::TraceProtoOrIfaceCache(trc, obj);
 }
 
 #ifdef DEBUG
 #include "mozilla/Preferences.h"
 #include "nsIXULRuntime.h"
 static void
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -1692,23 +1692,16 @@ public:
 
     void SetGlobal(JSContext *cx, JSObject* aGlobal);
 
     static void InitStatics() { gScopes = nullptr; gDyingScopes = nullptr; }
 
     XPCContext *GetContext() { return mContext; }
     void ClearContext() { mContext = nullptr; }
 
-    nsDataHashtable<nsDepCharHashKey, JSObject*>& GetCachedDOMPrototypes()
-    {
-        return mCachedDOMPrototypes;
-    }
-
-    void TraceDOMPrototypes(JSTracer *trc);
-
     JSBool ExperimentalBindingsEnabled()
     {
         return mExperimentalBindingsEnabled;
     }
 
     typedef nsTHashtable<nsPtrHashKey<JSObject> > DOMExpandoMap;
 
     bool RegisterDOMExpandoObject(JSObject *expando) {
@@ -1750,17 +1743,16 @@ private:
     // constructor).
     js::ObjectPtr                    mGlobalJSObject;
 
     // Prototype to use for wrappers with no helper.
     JSObject*                        mPrototypeNoHelper;
 
     XPCContext*                      mContext;
 
-    nsDataHashtable<nsDepCharHashKey, JSObject*> mCachedDOMPrototypes;
     nsAutoPtr<DOMExpandoMap> mDOMExpandoMap;
 
     JSBool mExperimentalBindingsEnabled;
 };
 
 /***************************************************************************/
 // XPCNativeMember represents a single idl declared method, attribute or
 // constant.