Title: [179743] trunk/Source
Revision
179743
Author
[email protected]
Date
2015-02-06 02:03:56 -0800 (Fri, 06 Feb 2015)

Log Message

Remove WTF::fastMallocGoodSize().
<https://webkit.org/b/141020>

Reviewed by Anders Carlsson.

Source/_javascript_Core:

* assembler/AssemblerBuffer.h:
(JSC::AssemblerData::AssemblerData):
(JSC::AssemblerData::grow):

Source/WTF:

bmalloc's good-size API just returns exactly whatever you pass it,
so it's of no utility to us anymore.

This gets rid of a bunch of pointless out-of-line calls in Vector
construction and growth.

* wtf/Compression.cpp:
(WTF::GenericCompressedData::create):
* wtf/FastMalloc.cpp:
(WTF::fastMallocGoodSize): Deleted.
* wtf/FastMalloc.h:
* wtf/Vector.h:
(WTF::VectorBufferBase::allocateBuffer):
(WTF::VectorBufferBase::tryAllocateBuffer):
(WTF::VectorBufferBase::reallocateBuffer):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (179742 => 179743)


--- trunk/Source/_javascript_Core/ChangeLog	2015-02-06 08:31:30 UTC (rev 179742)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-02-06 10:03:56 UTC (rev 179743)
@@ -1,3 +1,14 @@
+2015-02-06  Andreas Kling  <[email protected]>
+
+        Remove WTF::fastMallocGoodSize().
+        <https://webkit.org/b/141020>
+
+        Reviewed by Anders Carlsson.
+
+        * assembler/AssemblerBuffer.h:
+        (JSC::AssemblerData::AssemblerData):
+        (JSC::AssemblerData::grow):
+
 2015-02-05  Michael Saboff  <[email protected]>
 
         CodeCache is not thread safe when adding the same source from two different threads

Modified: trunk/Source/_javascript_Core/assembler/AssemblerBuffer.h (179742 => 179743)


--- trunk/Source/_javascript_Core/assembler/AssemblerBuffer.h	2015-02-06 08:31:30 UTC (rev 179742)
+++ trunk/Source/_javascript_Core/assembler/AssemblerBuffer.h	2015-02-06 10:03:56 UTC (rev 179743)
@@ -68,9 +68,9 @@
         }
 
         AssemblerData(unsigned initialCapacity)
+            : m_buffer(static_cast<char*>(fastMalloc(initialCapacity)))
+            , m_capacity(initialCapacity)
         {
-            m_capacity = fastMallocGoodSize(initialCapacity);
-            m_buffer = static_cast<char*>(fastMalloc(m_capacity));
         }
 
         AssemblerData(AssemblerData&& other)
@@ -101,7 +101,7 @@
 
         void grow(unsigned extraCapacity = 0)
         {
-            m_capacity = fastMallocGoodSize(m_capacity + m_capacity / 2 + extraCapacity);
+            m_capacity = m_capacity + m_capacity / 2 + extraCapacity;
             m_buffer = static_cast<char*>(fastRealloc(m_buffer, m_capacity));
         }
 

Modified: trunk/Source/WTF/ChangeLog (179742 => 179743)


--- trunk/Source/WTF/ChangeLog	2015-02-06 08:31:30 UTC (rev 179742)
+++ trunk/Source/WTF/ChangeLog	2015-02-06 10:03:56 UTC (rev 179743)
@@ -1,3 +1,26 @@
+2015-02-06  Andreas Kling  <[email protected]>
+
+        Remove WTF::fastMallocGoodSize().
+        <https://webkit.org/b/141020>
+
+        Reviewed by Anders Carlsson.
+
+        bmalloc's good-size API just returns exactly whatever you pass it,
+        so it's of no utility to us anymore.
+
+        This gets rid of a bunch of pointless out-of-line calls in Vector
+        construction and growth.
+
+        * wtf/Compression.cpp:
+        (WTF::GenericCompressedData::create):
+        * wtf/FastMalloc.cpp:
+        (WTF::fastMallocGoodSize): Deleted.
+        * wtf/FastMalloc.h:
+        * wtf/Vector.h:
+        (WTF::VectorBufferBase::allocateBuffer):
+        (WTF::VectorBufferBase::tryAllocateBuffer):
+        (WTF::VectorBufferBase::reallocateBuffer):
+
 2015-02-05  Youenn Fablet  <[email protected]> and Xabier Rodriguez Calvar <[email protected]>
 
         [Streams API] Implement a barebone ReadableStream interface

Modified: trunk/Source/WTF/wtf/Compression.cpp (179742 => 179743)


--- trunk/Source/WTF/wtf/Compression.cpp	2015-02-06 08:31:30 UTC (rev 179742)
+++ trunk/Source/WTF/wtf/Compression.cpp	2015-02-06 10:03:56 UTC (rev 179743)
@@ -69,7 +69,7 @@
     stream.next_in = const_cast<uint8_t*>(data);
 
     size_t currentOffset = OBJECT_OFFSETOF(GenericCompressedData, m_data);
-    size_t currentCapacity = fastMallocGoodSize(MinimumSize);
+    size_t currentCapacity = MinimumSize;
     Bytef* compressedData = static_cast<Bytef*>(fastMalloc(currentCapacity));
     memset(compressedData, 0, sizeof(GenericCompressedData));
     stream.next_out = compressedData + currentOffset;
@@ -94,7 +94,6 @@
                 // data in the future.
                 newCapacity = std::max(static_cast<size_t>(expectedSize + 8), currentCapacity + 8);
             }
-            newCapacity = fastMallocGoodSize(newCapacity);
             if (newCapacity >= dataLength)
                 goto fail;
             compressedData = static_cast<Bytef*>(fastRealloc(compressedData, newCapacity));

Modified: trunk/Source/WTF/wtf/FastMalloc.cpp (179742 => 179743)


--- trunk/Source/WTF/wtf/FastMalloc.cpp	2015-02-06 08:31:30 UTC (rev 179742)
+++ trunk/Source/WTF/wtf/FastMalloc.cpp	2015-02-06 10:03:56 UTC (rev 179743)
@@ -153,15 +153,6 @@
 
 namespace WTF {
 
-size_t fastMallocGoodSize(size_t bytes)
-{
-#if OS(DARWIN)
-    return malloc_good_size(bytes);
-#else
-    return bytes;
-#endif
-}
-
 #if OS(WINDOWS)
 
 void* fastAlignedMalloc(size_t alignment, size_t size) 
@@ -295,12 +286,7 @@
 {
     return 1;
 }
-    
-size_t fastMallocGoodSize(size_t size)
-{
-    return size;
-}
-    
+
 void* fastAlignedMalloc(size_t alignment, size_t size) 
 {
     return bmalloc::api::memalign(alignment, size);
@@ -2767,13 +2753,6 @@
 
 #define pageheap getPageHeap()
 
-size_t fastMallocGoodSize(size_t bytes)
-{
-    if (!phinited)
-        TCMalloc_ThreadCache::InitModule();
-    return AllocationSize(bytes);
-}
-
 #if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
 
 #if HAVE(DISPATCH_H) || OS(WINDOWS)

Modified: trunk/Source/WTF/wtf/FastMalloc.h (179742 => 179743)


--- trunk/Source/WTF/wtf/FastMalloc.h	2015-02-06 08:31:30 UTC (rev 179742)
+++ trunk/Source/WTF/wtf/FastMalloc.h	2015-02-06 10:03:56 UTC (rev 179743)
@@ -35,7 +35,6 @@
     WTF_EXPORT_PRIVATE void* fastRealloc(void*, size_t);
     WTF_EXPORT_PRIVATE char* fastStrDup(const char*);
     WTF_EXPORT_PRIVATE size_t fastMallocSize(const void*);
-    WTF_EXPORT_PRIVATE size_t fastMallocGoodSize(size_t);
 
     // Allocations from fastAlignedMalloc() must be freed using fastAlignedFree().
     WTF_EXPORT_PRIVATE void* fastAlignedMalloc(size_t alignment, size_t);
@@ -99,7 +98,6 @@
 using WTF::fastCalloc;
 using WTF::fastFree;
 using WTF::fastMalloc;
-using WTF::fastMallocGoodSize;
 using WTF::fastMallocSize;
 using WTF::fastRealloc;
 using WTF::fastStrDup;

Modified: trunk/Source/WTF/wtf/Vector.h (179742 => 179743)


--- trunk/Source/WTF/wtf/Vector.h	2015-02-06 08:31:30 UTC (rev 179742)
+++ trunk/Source/WTF/wtf/Vector.h	2015-02-06 10:03:56 UTC (rev 179743)
@@ -264,9 +264,8 @@
         ASSERT(newCapacity);
         if (newCapacity > std::numeric_limits<unsigned>::max() / sizeof(T))
             CRASH();
-        size_t sizeToAllocate = fastMallocGoodSize(newCapacity * sizeof(T));
-        m_capacity = sizeToAllocate / sizeof(T);
-        m_buffer = static_cast<T*>(fastMalloc(sizeToAllocate));
+        m_capacity = newCapacity;
+        m_buffer = static_cast<T*>(fastMalloc(newCapacity * sizeof(T)));
     }
 
     bool tryAllocateBuffer(size_t newCapacity)
@@ -275,10 +274,9 @@
         if (newCapacity > std::numeric_limits<unsigned>::max() / sizeof(T))
             return false;
 
-        size_t sizeToAllocate = fastMallocGoodSize(newCapacity * sizeof(T));
         T* newBuffer;
-        if (tryFastMalloc(sizeToAllocate).getValue(newBuffer)) {
-            m_capacity = sizeToAllocate / sizeof(T);
+        if (tryFastMalloc(newCapacity * sizeof(T)).getValue(newBuffer)) {
+            m_capacity = newCapacity;
             m_buffer = newBuffer;
             return true;
         }
@@ -295,9 +293,8 @@
         ASSERT(shouldReallocateBuffer(newCapacity));
         if (newCapacity > std::numeric_limits<size_t>::max() / sizeof(T))
             CRASH();
-        size_t sizeToAllocate = fastMallocGoodSize(newCapacity * sizeof(T));
-        m_capacity = sizeToAllocate / sizeof(T);
-        m_buffer = static_cast<T*>(fastRealloc(m_buffer, sizeToAllocate));
+        m_capacity = newCapacity;
+        m_buffer = static_cast<T*>(fastRealloc(m_buffer, newCapacity * sizeof(T)));
     }
 
     void deallocateBuffer(T* bufferToDeallocate)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to