Title: [225180] trunk/Source/bmalloc
Revision
225180
Author
[email protected]
Date
2017-11-27 10:24:56 -0800 (Mon, 27 Nov 2017)

Log Message

Don't crash in forEachEntry when DebugHeap is enabled.

Unreviewed, fixing crashes on leaks bots by removing an assertion.

* bmalloc/IsoTLS.cpp:
(bmalloc::IsoTLS::forEachEntry):
* test/testbmalloc.cpp: Make this test work with DebugHeap so I can catch this kind of problem in the future.

Modified Paths

Diff

Modified: trunk/Source/bmalloc/ChangeLog (225179 => 225180)


--- trunk/Source/bmalloc/ChangeLog	2017-11-27 17:59:07 UTC (rev 225179)
+++ trunk/Source/bmalloc/ChangeLog	2017-11-27 18:24:56 UTC (rev 225180)
@@ -1,3 +1,13 @@
+2017-11-27  Filip Pizlo  <[email protected]>
+
+        Don't crash in forEachEntry when DebugHeap is enabled.
+
+        Unreviewed, fixing crashes on leaks bots by removing an assertion.
+
+        * bmalloc/IsoTLS.cpp:
+        (bmalloc::IsoTLS::forEachEntry):
+        * test/testbmalloc.cpp: Make this test work with DebugHeap so I can catch this kind of problem in the future.
+
 2017-11-16  Filip Pizlo  <[email protected]>
 
         Isolated Heaps caused an increase in reported leaks on the bots

Modified: trunk/Source/bmalloc/bmalloc/IsoTLS.cpp (225179 => 225180)


--- trunk/Source/bmalloc/bmalloc/IsoTLS.cpp	2017-11-27 17:59:07 UTC (rev 225179)
+++ trunk/Source/bmalloc/bmalloc/IsoTLS.cpp	2017-11-27 18:24:56 UTC (rev 225180)
@@ -167,7 +167,8 @@
 template<typename Func>
 void IsoTLS::forEachEntry(const Func& func)
 {
-    RELEASE_BASSERT(m_lastEntry);
+    if (!m_lastEntry)
+        return;
     PerProcess<IsoTLSLayout>::get()->head()->walkUpToInclusive(
         m_lastEntry,
         [&] (IsoTLSEntry* entry) {

Modified: trunk/Source/bmalloc/test/testbmalloc.cpp (225179 => 225180)


--- trunk/Source/bmalloc/test/testbmalloc.cpp	2017-11-27 17:59:07 UTC (rev 225179)
+++ trunk/Source/bmalloc/test/testbmalloc.cpp	2017-11-27 18:24:56 UTC (rev 225180)
@@ -24,6 +24,7 @@
  */
 
 #include <bmalloc/bmalloc.h>
+#include <bmalloc/Environment.h>
 #include <bmalloc/IsoHeapInlines.h>
 #include <cmath>
 #include <cstdlib>
@@ -72,6 +73,10 @@
 
 static void assertEmptyPointerSet(const std::set<void*>& pointers)
 {
+    if (PerProcess<Environment>::get()->isDebugHeapEnabled()) {
+        printf("    skipping checks because DebugHeap.\n");
+        return;
+    }
     if (pointers.empty())
         return;
     printf("Pointer set not empty!\n");
@@ -85,6 +90,10 @@
 template<typename heapType>
 static void assertHasObjects(IsoHeap<heapType>& heap, std::set<void*> pointers)
 {
+    if (PerProcess<Environment>::get()->isDebugHeapEnabled()) {
+        printf("    skipping checks because DebugHeap.\n");
+        return;
+    }
     auto& impl = heap.impl();
     std::lock_guard<Mutex> locker(impl.lock);
     impl.forEachLiveObject(
@@ -97,6 +106,10 @@
 template<typename heapType>
 static void assertHasOnlyObjects(IsoHeap<heapType>& heap, std::set<void*> pointers)
 {
+    if (PerProcess<Environment>::get()->isDebugHeapEnabled()) {
+        printf("    skipping checks because DebugHeap.\n");
+        return;
+    }
     auto& impl = heap.impl();
     std::lock_guard<Mutex> locker(impl.lock);
     impl.forEachLiveObject(
@@ -110,13 +123,16 @@
 static void assertClean(IsoHeap<heapType>& heap)
 {
     scavengeThisThread();
-    auto& impl = heap.impl();
-    {
-        std::lock_guard<Mutex> locker(impl.lock);
-        CHECK(!impl.numLiveObjects());
+    if (!PerProcess<Environment>::get()->isDebugHeapEnabled()) {
+        auto& impl = heap.impl();
+        {
+            std::lock_guard<Mutex> locker(impl.lock);
+            CHECK(!impl.numLiveObjects());
+        }
     }
     heap.scavenge();
-    {
+    if (!PerProcess<Environment>::get()->isDebugHeapEnabled()) {
+        auto& impl = heap.impl();
         std::lock_guard<Mutex> locker(impl.lock);
         CHECK(!impl.numCommittedPages());
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to