Title: [204917] trunk/Source
Revision
204917
Author
[email protected]
Date
2016-08-24 12:23:47 -0700 (Wed, 24 Aug 2016)

Log Message

Source/bmalloc:
Add bmalloc::api::isEnabled().
<https://webkit.org/b/160534>

Reviewed by Joseph Pecoraro.

* bmalloc/bmalloc.h:
(bmalloc::api::isEnabled):

Source/WebCore:
Leaks bot hits an assertion in ResourceUsageThread::platformThreadBody
<https://webkit.org/b/160534>

Reviewed by Joseph Pecoraro.

Use the correct malloc bucket when bmalloc is disabled (which is the case on leaks bots.)

* page/cocoa/ResourceUsageThreadCocoa.mm:
(WebCore::ResourceUsageThread::platformThreadBody):

Source/WTF:
Add WTF::isFastMallocEnabled().
<https://webkit.org/b/160534>

Reviewed by Joseph Pecoraro.

* wtf/FastMalloc.cpp:
(WTF::isFastMallocEnabled):
* wtf/FastMalloc.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (204916 => 204917)


--- trunk/Source/WTF/ChangeLog	2016-08-24 19:14:28 UTC (rev 204916)
+++ trunk/Source/WTF/ChangeLog	2016-08-24 19:23:47 UTC (rev 204917)
@@ -1,3 +1,14 @@
+2016-08-24  Andreas Kling  <[email protected]>
+
+        Add WTF::isFastMallocEnabled().
+        <https://webkit.org/b/160534>
+
+        Reviewed by Joseph Pecoraro.
+
+        * wtf/FastMalloc.cpp:
+        (WTF::isFastMallocEnabled):
+        * wtf/FastMalloc.h:
+
 2016-08-23  Anders Carlsson  <[email protected]>
 
         Add enum traits and use them in the IPC::Decoder

Modified: trunk/Source/WTF/wtf/FastMalloc.cpp (204916 => 204917)


--- trunk/Source/WTF/wtf/FastMalloc.cpp	2016-08-24 19:14:28 UTC (rev 204916)
+++ trunk/Source/WTF/wtf/FastMalloc.cpp	2016-08-24 19:23:47 UTC (rev 204917)
@@ -81,6 +81,11 @@
 
 namespace WTF {
 
+bool isFastMallocEnabled()
+{
+    return false;
+}
+
 size_t fastMallocGoodSize(size_t bytes)
 {
 #if OS(DARWIN)
@@ -188,6 +193,11 @@
 
 namespace WTF {
 
+bool isFastMallocEnabled()
+{
+    return bmalloc::api::isEnabled();
+}
+
 void* fastMalloc(size_t size)
 {
     return bmalloc::api::malloc(size);

Modified: trunk/Source/WTF/wtf/FastMalloc.h (204916 => 204917)


--- trunk/Source/WTF/wtf/FastMalloc.h	2016-08-24 19:14:28 UTC (rev 204916)
+++ trunk/Source/WTF/wtf/FastMalloc.h	2016-08-24 19:23:47 UTC (rev 204917)
@@ -38,6 +38,8 @@
     mutable void* m_data;
 };
 
+WTF_EXPORT_PRIVATE bool isFastMallocEnabled();
+
 // These functions call CRASH() if an allocation fails.
 WTF_EXPORT_PRIVATE void* fastMalloc(size_t);
 WTF_EXPORT_PRIVATE void* fastZeroedMalloc(size_t);
@@ -99,6 +101,7 @@
 
 } // namespace WTF
 
+using WTF::isFastMallocEnabled;
 using WTF::fastCalloc;
 using WTF::fastFree;
 using WTF::fastMalloc;

Modified: trunk/Source/WebCore/ChangeLog (204916 => 204917)


--- trunk/Source/WebCore/ChangeLog	2016-08-24 19:14:28 UTC (rev 204916)
+++ trunk/Source/WebCore/ChangeLog	2016-08-24 19:23:47 UTC (rev 204917)
@@ -1,3 +1,15 @@
+2016-08-24  Andreas Kling  <[email protected]>
+
+        Leaks bot hits an assertion in ResourceUsageThread::platformThreadBody
+        <https://webkit.org/b/160534>
+
+        Reviewed by Joseph Pecoraro.
+
+        Use the correct malloc bucket when bmalloc is disabled (which is the case on leaks bots.)
+
+        * page/cocoa/ResourceUsageThreadCocoa.mm:
+        (WebCore::ResourceUsageThread::platformThreadBody):
+
 2016-08-24  Filip Pizlo  <[email protected]>
 
         Unreviewed, roll out r204901, r204897, r204866, r204856, r204854.

Modified: trunk/Source/WebCore/page/cocoa/ResourceUsageThreadCocoa.mm (204916 => 204917)


--- trunk/Source/WebCore/page/cocoa/ResourceUsageThreadCocoa.mm	2016-08-24 19:14:28 UTC (rev 204916)
+++ trunk/Source/WebCore/page/cocoa/ResourceUsageThreadCocoa.mm	2016-08-24 19:23:47 UTC (rev 204917)
@@ -227,11 +227,15 @@
     data.categories[MemoryCategory::GCOwned].dirtySize = currentGCOwnedExtra - currentGCOwnedExternal;
     data.categories[MemoryCategory::GCOwned].externalSize = currentGCOwnedExternal;
 
-    // Subtract known subchunks from the bmalloc bucket.
-    // FIXME: Handle running with bmalloc disabled.
-    size_t currentGCOwnedGenerallyInBmalloc = currentGCOwnedExtra - currentGCOwnedExternal;
-    ASSERT(currentGCOwnedGenerallyInBmalloc < data.categories[MemoryCategory::bmalloc].dirtySize);
-    data.categories[MemoryCategory::bmalloc].dirtySize -= currentGCHeapCapacity + currentGCOwnedGenerallyInBmalloc;
+    // Subtract known subchunks from the appropriate malloc bucket.
+    size_t currentGCOwnedGenerallyInMalloc = currentGCOwnedExtra - currentGCOwnedExternal;
+    if (isFastMallocEnabled()) {
+        RELEASE_ASSERT(currentGCOwnedGenerallyInMalloc < data.categories[MemoryCategory::bmalloc].dirtySize);
+        data.categories[MemoryCategory::bmalloc].dirtySize -= currentGCHeapCapacity + currentGCOwnedGenerallyInMalloc;
+    } else {
+        RELEASE_ASSERT(currentGCOwnedGenerallyInMalloc < data.categories[MemoryCategory::LibcMalloc].dirtySize);
+        data.categories[MemoryCategory::LibcMalloc].dirtySize -= currentGCHeapCapacity + currentGCOwnedGenerallyInMalloc;
+    }
 
     data.totalExternalSize = currentGCOwnedExternal;
 

Modified: trunk/Source/bmalloc/ChangeLog (204916 => 204917)


--- trunk/Source/bmalloc/ChangeLog	2016-08-24 19:14:28 UTC (rev 204916)
+++ trunk/Source/bmalloc/ChangeLog	2016-08-24 19:23:47 UTC (rev 204917)
@@ -1,3 +1,13 @@
+2016-08-24  Andreas Kling  <[email protected]>
+
+        Add bmalloc::api::isEnabled().
+        <https://webkit.org/b/160534>
+
+        Reviewed by Joseph Pecoraro.
+
+        * bmalloc/bmalloc.h:
+        (bmalloc::api::isEnabled):
+
 2016-08-24  Filip Pizlo  <[email protected]>
 
         Unreviewed, roll out r204901, r204897, r204866, r204856, r204854.

Modified: trunk/Source/bmalloc/bmalloc/bmalloc.h (204916 => 204917)


--- trunk/Source/bmalloc/bmalloc/bmalloc.h	2016-08-24 19:14:28 UTC (rev 204916)
+++ trunk/Source/bmalloc/bmalloc/bmalloc.h	2016-08-24 19:23:47 UTC (rev 204917)
@@ -73,5 +73,11 @@
     PerProcess<Heap>::get()->scavenge(lock, std::chrono::milliseconds(0));
 }
 
+inline bool isEnabled()
+{
+    std::unique_lock<StaticMutex> lock(PerProcess<Heap>::mutex());
+    return PerProcess<Heap>::getFastCase()->environment().isBmallocEnabled();
+}
+
 } // namespace api
 } // namespace bmalloc
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to