Bug 945846 - Stop barriers firing during store buffer marking for XPConnect r=terrence
authorJon Coppeard <jcoppeard@mozilla.com>
Thu, 05 Dec 2013 11:15:51 +0000
changeset 174587 66bd8afba72543581b300396c1145fbee5a61911
parent 174586 27dd92819372e46131d22751bbdf2686fe08a869
child 174588 f6b0c6073f4f8fe114f23f6a197d6af3de0490bf
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs945846
milestone28.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 945846 - Stop barriers firing during store buffer marking for XPConnect r=terrence
js/xpconnect/src/XPCMaps.h
--- a/js/xpconnect/src/XPCMaps.h
+++ b/js/xpconnect/src/XPCMaps.h
@@ -690,19 +690,28 @@ public:
 private:
     JSObject2JSObjectMap() {}
 
     /*
      * This function is called during minor GCs for each key in the HashMap that
      * has been moved.
      */
     static void KeyMarkCallback(JSTracer *trc, void *k, void *d) {
+        /*
+         * To stop the barriers on the values of mTable firing while we are
+         * marking the store buffer, we cast the table to one that is
+         * binary-equivatlent but without the barriers, and update that.
+         */
+        typedef js::HashMap<JSObject *, JSObject *, js::PointerHasher<JSObject *, 3>,
+                            js::SystemAllocPolicy> UnbarrieredMap;
+        JSObject2JSObjectMap *self = static_cast<JSObject2JSObjectMap *>(d);
+        UnbarrieredMap &table = reinterpret_cast<UnbarrieredMap &>(self->mTable);
+
         JSObject *key = static_cast<JSObject*>(k);
-        JSObject2JSObjectMap *self = static_cast<JSObject2JSObjectMap *>(d);
         JSObject *prior = key;
         JS_CallObjectTracer(trc, &key, "XPCWrappedNativeScope::mWaiverWrapperMap key");
-        self->mTable.rekeyIfMoved(prior, key);
+        table.rekeyIfMoved(prior, key);
     }
 
     Map mTable;
 };
 
 #endif /* xpcmaps_h___ */