Do not use fastMallocGoodSize anywhere
authorbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 May 2015 06:26:10 +0000 (06:26 +0000)
committerbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 May 2015 06:26:10 +0000 (06:26 +0000)
https://bugs.webkit.org/show_bug.cgi?id=145103

Reviewed by Michael Saboff.

Source/JavaScriptCore:

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

Source/WTF:

It is silly we see fastMallocGoodSize in profiles, it does absolutely nothing.

This patch keeps fastMallocGoodSize() around for older code linking
with newer WebKit, but remove any use of it inside WebKit.

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

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

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/assembler/AssemblerBuffer.h
Source/WTF/ChangeLog
Source/WTF/wtf/FastMalloc.cpp
Source/WTF/wtf/FastMalloc.h
Source/WTF/wtf/Vector.h

index 2756e8e..6760a23 100644 (file)
@@ -1,5 +1,16 @@
 2015-05-17  Benjamin Poulain  <benjamin@webkit.org>
 
+        Do not use fastMallocGoodSize anywhere
+        https://bugs.webkit.org/show_bug.cgi?id=145103
+
+        Reviewed by Michael Saboff.
+
+        * assembler/AssemblerBuffer.h:
+        (JSC::AssemblerData::AssemblerData):
+        (JSC::AssemblerData::grow):
+
+2015-05-17  Benjamin Poulain  <benjamin@webkit.org>
+
         [JSC] Make StringRecursionChecker faster in the simple cases without any recursion
         https://bugs.webkit.org/show_bug.cgi?id=145102
 
index 1c33fe1..3632a5b 100644 (file)
@@ -69,7 +69,7 @@ namespace JSC {
 
         AssemblerData(unsigned initialCapacity)
         {
-            m_capacity = fastMallocGoodSize(initialCapacity);
+            m_capacity = initialCapacity;
             m_buffer = static_cast<char*>(fastMalloc(m_capacity));
         }
 
@@ -101,7 +101,7 @@ namespace JSC {
 
         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));
         }
 
index 3552627..71d9169 100644 (file)
@@ -1,3 +1,23 @@
+2015-05-17  Benjamin Poulain  <benjamin@webkit.org>
+
+        Do not use fastMallocGoodSize anywhere
+        https://bugs.webkit.org/show_bug.cgi?id=145103
+
+        Reviewed by Michael Saboff.
+
+        It is silly we see fastMallocGoodSize in profiles, it does absolutely nothing.
+
+        This patch keeps fastMallocGoodSize() around for older code linking
+        with newer WebKit, but remove any use of it inside WebKit.
+
+        * wtf/FastMalloc.cpp:
+        (WTF::fastMallocGoodSize):
+        * wtf/FastMalloc.h:
+        * wtf/Vector.h:
+        (WTF::VectorBufferBase::allocateBuffer):
+        (WTF::VectorBufferBase::tryAllocateBuffer):
+        (WTF::VectorBufferBase::reallocateBuffer):
+
 2015-05-15  Dan Bernstein  <mitz@apple.com>
 
         Build fix for some versions of clang.
index 2e8186c..e5526e8 100644 (file)
@@ -222,7 +222,6 @@ size_t fastMallocSize(const void*)
 
 size_t fastMallocGoodSize(size_t size)
 {
-    // FIXME: This is non-helpful; fastMallocGoodSize will be removed soon.
     return size;
 }
 
index 7151771..390c4df 100644 (file)
@@ -56,6 +56,8 @@ WTF_EXPORT_PRIVATE void* fastAlignedMalloc(size_t alignment, size_t);
 WTF_EXPORT_PRIVATE void fastAlignedFree(void*);
 
 WTF_EXPORT_PRIVATE size_t fastMallocSize(const void*);
+
+// FIXME: This is non-helpful; fastMallocGoodSize will be removed soon.
 WTF_EXPORT_PRIVATE size_t fastMallocGoodSize(size_t);
 
 WTF_EXPORT_PRIVATE void releaseFastMallocFreeMemory();
index b858a73..4257d8c 100644 (file)
@@ -264,7 +264,7 @@ public:
         ASSERT(newCapacity);
         if (newCapacity > std::numeric_limits<unsigned>::max() / sizeof(T))
             CRASH();
-        size_t sizeToAllocate = fastMallocGoodSize(newCapacity * sizeof(T));
+        size_t sizeToAllocate = newCapacity * sizeof(T);
         m_capacity = sizeToAllocate / sizeof(T);
         m_buffer = static_cast<T*>(fastMalloc(sizeToAllocate));
     }
@@ -275,7 +275,7 @@ public:
         if (newCapacity > std::numeric_limits<unsigned>::max() / sizeof(T))
             return false;
 
-        size_t sizeToAllocate = fastMallocGoodSize(newCapacity * sizeof(T));
+        size_t sizeToAllocate = newCapacity * sizeof(T);
         T* newBuffer;
         if (tryFastMalloc(sizeToAllocate).getValue(newBuffer)) {
             m_capacity = sizeToAllocate / sizeof(T);
@@ -295,7 +295,7 @@ public:
         ASSERT(shouldReallocateBuffer(newCapacity));
         if (newCapacity > std::numeric_limits<size_t>::max() / sizeof(T))
             CRASH();
-        size_t sizeToAllocate = fastMallocGoodSize(newCapacity * sizeof(T));
+        size_t sizeToAllocate = newCapacity * sizeof(T);
         m_capacity = sizeToAllocate / sizeof(T);
         m_buffer = static_cast<T*>(fastRealloc(m_buffer, sizeToAllocate));
     }