Bug 1237445 - Use GCHashMap for ICStubCodeMap, r=terrence
authorSteve Fink <sfink@mozilla.com>
Wed, 18 Nov 2015 17:52:34 -0800
changeset 278994 7a2a11b4cee1d85723fd5398de2105c4bcc72dc9
parent 278993 e003fb68a47c195dedc39a0ef4aec91f4eadd180
child 278995 28657e5774d031406f53fd4f5db9bbe45eb47474
push id69955
push usersfink@mozilla.com
push dateThu, 07 Jan 2016 20:36:58 +0000
treeherdermozilla-inbound@5d93baf4ff9c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs1237445
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
Bug 1237445 - Use GCHashMap for ICStubCodeMap, r=terrence
js/src/jit/Ion.cpp
js/src/jit/JitCompartment.h
--- a/js/src/jit/Ion.cpp
+++ b/js/src/jit/Ion.cpp
@@ -410,17 +410,17 @@ JitCompartment::JitCompartment()
 JitCompartment::~JitCompartment()
 {
     js_delete(stubCodes_);
 }
 
 bool
 JitCompartment::initialize(JSContext* cx)
 {
-    stubCodes_ = cx->new_<ICStubCodeMap>(cx);
+    stubCodes_ = cx->new_<ICStubCodeMap>(cx->runtime());
     if (!stubCodes_)
         return false;
 
     if (!stubCodes_->init()) {
         ReportOutOfMemory(cx);
         return false;
     }
 
@@ -725,17 +725,17 @@ JitCompartment::sweep(FreeOp* fop, JSCom
     // Cancel any active or pending off thread compilations. The MIR graph only
     // contains nursery pointers if cancelIonCompilations() is set on the store
     // buffer, in which case store buffer marking will take care of this during
     // minor GCs.
     MOZ_ASSERT(!fop->runtime()->isHeapMinorCollecting());
     CancelOffThreadIonCompile(compartment, nullptr);
     FinishAllOffThreadCompilations(compartment);
 
-    stubCodes_->sweep(fop);
+    stubCodes_->sweep();
 
     // If the sweep removed the ICCall_Fallback stub, nullptr the baselineCallReturnAddr_ field.
     if (!stubCodes_->lookup(ICCall_Fallback::Compiler::BASELINE_CALL_KEY))
         baselineCallReturnAddrs_[0] = nullptr;
     if (!stubCodes_->lookup(ICCall_Fallback::Compiler::BASELINE_CONSTRUCT_KEY))
         baselineCallReturnAddrs_[1] = nullptr;
 
     // Similarly for the ICGetProp_Fallback stub.
--- a/js/src/jit/JitCompartment.h
+++ b/js/src/jit/JitCompartment.h
@@ -379,18 +379,28 @@ class JitZone
         return &optimizedStubSpace_;
     }
 };
 
 class JitCompartment
 {
     friend class JitActivation;
 
+    struct IcStubCodeMapGCPolicy {
+        static bool needsSweep(uint32_t* key, ReadBarrieredJitCode* value) {
+            return IsAboutToBeFinalized(value);
+        }
+    };
+
     // Map ICStub keys to ICStub shared code objects.
-    typedef WeakValueCache<uint32_t, ReadBarrieredJitCode> ICStubCodeMap;
+    using ICStubCodeMap = GCHashMap<uint32_t,
+                                    ReadBarrieredJitCode,
+                                    DefaultHasher<uint32_t>,
+                                    RuntimeAllocPolicy,
+                                    IcStubCodeMapGCPolicy>;
     ICStubCodeMap* stubCodes_;
 
     // Keep track of offset into various baseline stubs' code at return
     // point from called script.
     void* baselineCallReturnAddrs_[2];
     void* baselineGetPropReturnAddr_;
     void* baselineSetPropReturnAddr_;