author | Terrence Cole <terrence@mozilla.com> |
Tue, 17 Nov 2015 13:40:55 -0800 | |
changeset 277899 | 3119ae778211ff35d5a8c3d5bdc26589bf8a9452 |
parent 277898 | 5075dc8f0dfa20f8fa0b7ab3d7c5e8db7ff774d0 |
child 277900 | e7a9bcc4b922cfb1d8d87f299dda9ee4f492ef24 |
push id | 69639 |
push user | tcole@mozilla.com |
push date | Wed, 30 Dec 2015 18:56:22 +0000 |
treeherder | mozilla-inbound@3119ae778211 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jonco |
bugs | 1225650 |
milestone | 46.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
|
js/xpconnect/src/XPCMaps.cpp | file | annotate | diff | comparison | revisions | |
js/xpconnect/src/XPCMaps.h | file | annotate | diff | comparison | revisions |
--- a/js/xpconnect/src/XPCMaps.cpp +++ b/js/xpconnect/src/XPCMaps.cpp @@ -114,22 +114,21 @@ JSObject2WrappedJSMap::UpdateWeakPointer if (!wrapper->GetJSObjectPreserveColor()) dying.AppendElement(dont_AddRef(wrapper)); } wrapper = wrapper->GetNextWrapper(); } // Remove or update the JSObject key in the table if necessary. JSObject* obj = e.front().key(); - JSObject* prior = obj; JS_UpdateWeakPointerAfterGCUnbarriered(&obj); if (!obj) e.removeFront(); - else if (obj != prior) - e.rekeyFront(obj); + else + e.front().mutableKey() = obj; } } void JSObject2WrappedJSMap::ShutdownMarker() { for (Map::Range r = mTable.all(); !r.empty(); r.popFront()) { nsXPCWrappedJS* wrapper = r.front().value();
--- a/js/xpconnect/src/XPCMaps.h +++ b/js/xpconnect/src/XPCMaps.h @@ -22,18 +22,20 @@ // no virtuals in the maps - all the common stuff inlined // templates could be used to good effect here. /*************************/ class JSObject2WrappedJSMap { - typedef js::HashMap<JSObject*, nsXPCWrappedJS*, js::PointerHasher<JSObject*, 3>, - js::SystemAllocPolicy> Map; + using Map = js::HashMap<JS::Heap<JSObject*>, + nsXPCWrappedJS*, + js::MovableCellHasher<JS::Heap<JSObject*>>, + js::SystemAllocPolicy>; public: static JSObject2WrappedJSMap* newMap(int length) { JSObject2WrappedJSMap* map = new JSObject2WrappedJSMap(); if (!map->mTable.init(length)) { // This is a decent estimate of the size of the hash table's // entry storage. The |2| is because on average the capacity is // twice the requested length. @@ -61,17 +63,16 @@ public: inline nsXPCWrappedJS* Add(JSContext* cx, nsXPCWrappedJS* wrapper) { NS_PRECONDITION(wrapper,"bad param"); JSObject* obj = wrapper->GetJSObjectPreserveColor(); Map::AddPtr p = mTable.lookupForAdd(obj); if (p) return p->value(); if (!mTable.add(p, obj, wrapper)) return nullptr; - JS_StoreObjectPostBarrierCallback(cx, KeyMarkCallback, obj, this); return wrapper; } inline void Remove(nsXPCWrappedJS* wrapper) { NS_PRECONDITION(wrapper,"bad param"); mTable.remove(wrapper->GetJSObjectPreserveColor()); } @@ -90,27 +91,16 @@ public: // Report the sum of SizeOfIncludingThis() for all wrapped JS in the map. // Each wrapped JS is only in one map. size_t SizeOfWrappedJS(mozilla::MallocSizeOf mallocSizeOf) const; private: JSObject2WrappedJSMap() {} - /* - * This function is called during minor GCs for each key in the HashMap that - * has been moved. - */ - static void KeyMarkCallback(JSTracer* trc, JSObject* key, void* data) { - JSObject2WrappedJSMap* self = static_cast<JSObject2WrappedJSMap*>(data); - JSObject* prior = key; - JS_CallUnbarrieredObjectTracer(trc, &key, "XPCJSRuntime::mWrappedJSMap key"); - self->mTable.rekeyIfMoved(prior, key); - } - Map mTable; }; /*************************/ class Native2WrappedNativeMap { public: