IsoHeapImpl not IsoHeapImplBase should add itself to AllIsoHeaps
authorsbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Apr 2018 01:29:26 +0000 (01:29 +0000)
committersbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Apr 2018 01:29:26 +0000 (01:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=184174

Reviewed by Filip Pizlo.

Otherwise, another thread may see a non-fully formed IsoHeapImpl.

* bmalloc/IsoHeapImpl.cpp:
(bmalloc::IsoHeapImplBase::IsoHeapImplBase):
(bmalloc::IsoHeapImplBase::addToAllIsoHeaps):
* bmalloc/IsoHeapImpl.h:
* bmalloc/IsoHeapImplInlines.h:
(bmalloc::IsoHeapImpl<Config>::IsoHeapImpl):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230317 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/bmalloc/ChangeLog
Source/bmalloc/bmalloc/IsoHeapImpl.cpp
Source/bmalloc/bmalloc/IsoHeapImpl.h
Source/bmalloc/bmalloc/IsoHeapImplInlines.h

index d898957..812ca62 100644 (file)
@@ -1,3 +1,19 @@
+2018-04-05  Saam Barati  <sbarati@apple.com>
+
+        IsoHeapImpl not IsoHeapImplBase should add itself to AllIsoHeaps
+        https://bugs.webkit.org/show_bug.cgi?id=184174
+
+        Reviewed by Filip Pizlo.
+
+        Otherwise, another thread may see a non-fully formed IsoHeapImpl.
+
+        * bmalloc/IsoHeapImpl.cpp:
+        (bmalloc::IsoHeapImplBase::IsoHeapImplBase):
+        (bmalloc::IsoHeapImplBase::addToAllIsoHeaps):
+        * bmalloc/IsoHeapImpl.h:
+        * bmalloc/IsoHeapImplInlines.h:
+        (bmalloc::IsoHeapImpl<Config>::IsoHeapImpl):
+
 2018-04-05  Yusuke Suzuki  <utatane.tea@gmail.com>
 
         bmalloc StaticMutex's constructor should be constexpr
index 7466c48..9f39a75 100644 (file)
@@ -33,13 +33,17 @@ namespace bmalloc {
 
 IsoHeapImplBase::IsoHeapImplBase()
 {
-    PerProcess<AllIsoHeaps>::get()->add(this);
 }
 
 IsoHeapImplBase::~IsoHeapImplBase()
 {
 }
 
+void IsoHeapImplBase::addToAllIsoHeaps()
+{
+    PerProcess<AllIsoHeaps>::get()->add(this);
+}
+
 void IsoHeapImplBase::scavengeNow()
 {
     Vector<DeferredDecommit> deferredDecommits;
index a3275fc..1282623 100644 (file)
@@ -48,6 +48,7 @@ public:
     
 protected:
     IsoHeapImplBase();
+    void addToAllIsoHeaps();
 
 private:
     friend class AllIsoHeaps;
index bbdac92..9a11e9e 100644 (file)
@@ -36,6 +36,7 @@ IsoHeapImpl<Config>::IsoHeapImpl()
     , m_inlineDirectory(*this)
     , m_allocator(*this)
 {
+    addToAllIsoHeaps();
 }
 
 template<typename Config>