Title: [166957] trunk/Source/WTF
Revision
166957
Author
gga...@apple.com
Date
2014-04-08 13:36:17 -0700 (Tue, 08 Apr 2014)

Log Message

Added a bmalloc back-end for FastMalloc
https://bugs.webkit.org/show_bug.cgi?id=131387

Reviewed by Andreas Kling.

We'll need to rethink some things if we adopt this back-end. For example,
fastMallocSize() and fastMallocGoodSize() are no longer real things. But,
this is enough to test for now.

* wtf/FastMalloc.cpp:
(WTF::fastMalloc):
(WTF::fastCalloc):
(WTF::fastRealloc):
(WTF::fastFree):
(WTF::fastMallocSize):
(WTF::fastMallocGoodSize):
(WTF::tryFastMalloc):
(WTF::tryFastRealloc):
(WTF::tryFastCalloc):
(WTF::releaseFastMallocFreeMemory):
(WTF::fastMallocStatistics):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (166956 => 166957)


--- trunk/Source/WTF/ChangeLog	2014-04-08 20:36:07 UTC (rev 166956)
+++ trunk/Source/WTF/ChangeLog	2014-04-08 20:36:17 UTC (rev 166957)
@@ -1,3 +1,27 @@
+2014-04-08  Geoffrey Garen  <gga...@apple.com>
+
+        Added a bmalloc back-end for FastMalloc
+        https://bugs.webkit.org/show_bug.cgi?id=131387
+
+        Reviewed by Andreas Kling.
+
+        We'll need to rethink some things if we adopt this back-end. For example,
+        fastMallocSize() and fastMallocGoodSize() are no longer real things. But,
+        this is enough to test for now.
+
+        * wtf/FastMalloc.cpp:
+        (WTF::fastMalloc):
+        (WTF::fastCalloc):
+        (WTF::fastRealloc):
+        (WTF::fastFree):
+        (WTF::fastMallocSize):
+        (WTF::fastMallocGoodSize):
+        (WTF::tryFastMalloc):
+        (WTF::tryFastRealloc):
+        (WTF::tryFastCalloc):
+        (WTF::releaseFastMallocFreeMemory):
+        (WTF::fastMallocStatistics):
+
 2014-04-08  Andres Gomez  <ago...@igalia.com>
 
         [GTK] [EFL] Build fails with GCC < 4.8.x

Modified: trunk/Source/WTF/wtf/FastMalloc.cpp (166956 => 166957)


--- trunk/Source/WTF/wtf/FastMalloc.cpp	2014-04-08 20:36:07 UTC (rev 166956)
+++ trunk/Source/WTF/wtf/FastMalloc.cpp	2014-04-08 20:36:17 UTC (rev 166957)
@@ -423,6 +423,68 @@
 extern "C" WTF_EXPORT_PRIVATE const int jscore_fastmalloc_introspection = 0;
 #endif
 
+#elif defined(USE_BMALLOC) && USE_BMALLOC // FORCE_SYSTEM_MALLOC
+
+#include "bmalloc.h"
+
+namespace WTF {
+
+void* fastMalloc(size_t size)
+{
+    ASSERT(!isForbidden());
+    return bmalloc::api::malloc(size);
+}
+
+void* fastCalloc(size_t numElements, size_t elementSize)
+{
+    return fastZeroedMalloc(numElements * elementSize);
+}
+    
+void* fastRealloc(void* object, size_t size)
+{
+    return bmalloc::api::realloc(object, size);
+}
+    
+void fastFree(void* object)
+{
+    bmalloc::api::free(object);
+}
+    
+size_t fastMallocSize(const void*)
+{
+    return 1;
+}
+    
+size_t fastMallocGoodSize(size_t size)
+{
+    return size;
+}
+    
+TryMallocReturnValue tryFastMalloc(size_t size)
+{
+    return fastMalloc(size);
+}
+    
+TryMallocReturnValue tryFastRealloc(void* p, size_t n)
+{
+    return fastRealloc(p, n);
+}
+    
+TryMallocReturnValue tryFastCalloc(size_t numElements, size_t elementSize)
+{
+    return fastCalloc(numElements, elementSize);
+}
+    
+void releaseFastMallocFreeMemory() { }
+
+FastMallocStatistics fastMallocStatistics()
+{
+    FastMallocStatistics statistics = { 0, 0, 0 };
+    return statistics;
+}
+
+} // namespace WTF
+
 #else // FORCE_SYSTEM_MALLOC
 
 #include "TCPackedCache.h"
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to