Changeset 179743 in webkit


Ignore:
Timestamp:
Feb 6, 2015 2:03:56 AM (9 years ago)
Author:
akling@apple.com
Message:

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

Reviewed by Anders Carlsson.

Source/JavaScriptCore:

  • 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):

Location:
trunk/Source
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r179728 r179743  
     12015-02-06  Andreas Kling  <akling@apple.com>
     2
     3        Remove WTF::fastMallocGoodSize().
     4        <https://webkit.org/b/141020>
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * assembler/AssemblerBuffer.h:
     9        (JSC::AssemblerData::AssemblerData):
     10        (JSC::AssemblerData::grow):
     11
    1122015-02-05  Michael Saboff  <msaboff@apple.com>
    213
  • trunk/Source/JavaScriptCore/assembler/AssemblerBuffer.h

    r171123 r179743  
    6969
    7070        AssemblerData(unsigned initialCapacity)
    71         {
    72             m_capacity = fastMallocGoodSize(initialCapacity);
    73             m_buffer = static_cast<char*>(fastMalloc(m_capacity));
     71            : m_buffer(static_cast<char*>(fastMalloc(initialCapacity)))
     72            , m_capacity(initialCapacity)
     73        {
    7474        }
    7575
     
    102102        void grow(unsigned extraCapacity = 0)
    103103        {
    104             m_capacity = fastMallocGoodSize(m_capacity + m_capacity / 2 + extraCapacity);
     104            m_capacity = m_capacity + m_capacity / 2 + extraCapacity;
    105105            m_buffer = static_cast<char*>(fastRealloc(m_buffer, m_capacity));
    106106        }
  • trunk/Source/WTF/ChangeLog

    r179687 r179743  
     12015-02-06  Andreas Kling  <akling@apple.com>
     2
     3        Remove WTF::fastMallocGoodSize().
     4        <https://webkit.org/b/141020>
     5
     6        Reviewed by Anders Carlsson.
     7
     8        bmalloc's good-size API just returns exactly whatever you pass it,
     9        so it's of no utility to us anymore.
     10
     11        This gets rid of a bunch of pointless out-of-line calls in Vector
     12        construction and growth.
     13
     14        * wtf/Compression.cpp:
     15        (WTF::GenericCompressedData::create):
     16        * wtf/FastMalloc.cpp:
     17        (WTF::fastMallocGoodSize): Deleted.
     18        * wtf/FastMalloc.h:
     19        * wtf/Vector.h:
     20        (WTF::VectorBufferBase::allocateBuffer):
     21        (WTF::VectorBufferBase::tryAllocateBuffer):
     22        (WTF::VectorBufferBase::reallocateBuffer):
     23
    1242015-02-05  Youenn Fablet  <youenn.fablet@crf.canon.fr> and Xabier Rodriguez Calvar <calvaris@igalia.com>
    225
  • trunk/Source/WTF/wtf/Compression.cpp

    r166482 r179743  
    7070
    7171    size_t currentOffset = OBJECT_OFFSETOF(GenericCompressedData, m_data);
    72     size_t currentCapacity = fastMallocGoodSize(MinimumSize);
     72    size_t currentCapacity = MinimumSize;
    7373    Bytef* compressedData = static_cast<Bytef*>(fastMalloc(currentCapacity));
    7474    memset(compressedData, 0, sizeof(GenericCompressedData));
     
    9595                newCapacity = std::max(static_cast<size_t>(expectedSize + 8), currentCapacity + 8);
    9696            }
    97             newCapacity = fastMallocGoodSize(newCapacity);
    9897            if (newCapacity >= dataLength)
    9998                goto fail;
  • trunk/Source/WTF/wtf/FastMalloc.cpp

    r179500 r179743  
    154154namespace WTF {
    155155
    156 size_t fastMallocGoodSize(size_t bytes)
    157 {
    158 #if OS(DARWIN)
    159     return malloc_good_size(bytes);
    160 #else
    161     return bytes;
    162 #endif
    163 }
    164 
    165156#if OS(WINDOWS)
    166157
     
    296287    return 1;
    297288}
    298    
    299 size_t fastMallocGoodSize(size_t size)
    300 {
    301     return size;
    302 }
    303    
     289
    304290void* fastAlignedMalloc(size_t alignment, size_t size)
    305291{
     
    27672753
    27682754#define pageheap getPageHeap()
    2769 
    2770 size_t fastMallocGoodSize(size_t bytes)
    2771 {
    2772     if (!phinited)
    2773         TCMalloc_ThreadCache::InitModule();
    2774     return AllocationSize(bytes);
    2775 }
    27762755
    27772756#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
  • trunk/Source/WTF/wtf/FastMalloc.h

    r179500 r179743  
    3636    WTF_EXPORT_PRIVATE char* fastStrDup(const char*);
    3737    WTF_EXPORT_PRIVATE size_t fastMallocSize(const void*);
    38     WTF_EXPORT_PRIVATE size_t fastMallocGoodSize(size_t);
    3938
    4039    // Allocations from fastAlignedMalloc() must be freed using fastAlignedFree().
     
    10099using WTF::fastFree;
    101100using WTF::fastMalloc;
    102 using WTF::fastMallocGoodSize;
    103101using WTF::fastMallocSize;
    104102using WTF::fastRealloc;
  • trunk/Source/WTF/wtf/Vector.h

    r179599 r179743  
    265265        if (newCapacity > std::numeric_limits<unsigned>::max() / sizeof(T))
    266266            CRASH();
    267         size_t sizeToAllocate = fastMallocGoodSize(newCapacity * sizeof(T));
    268         m_capacity = sizeToAllocate / sizeof(T);
    269         m_buffer = static_cast<T*>(fastMalloc(sizeToAllocate));
     267        m_capacity = newCapacity;
     268        m_buffer = static_cast<T*>(fastMalloc(newCapacity * sizeof(T)));
    270269    }
    271270
     
    276275            return false;
    277276
    278         size_t sizeToAllocate = fastMallocGoodSize(newCapacity * sizeof(T));
    279277        T* newBuffer;
    280         if (tryFastMalloc(sizeToAllocate).getValue(newBuffer)) {
    281             m_capacity = sizeToAllocate / sizeof(T);
     278        if (tryFastMalloc(newCapacity * sizeof(T)).getValue(newBuffer)) {
     279            m_capacity = newCapacity;
    282280            m_buffer = newBuffer;
    283281            return true;
     
    296294        if (newCapacity > std::numeric_limits<size_t>::max() / sizeof(T))
    297295            CRASH();
    298         size_t sizeToAllocate = fastMallocGoodSize(newCapacity * sizeof(T));
    299         m_capacity = sizeToAllocate / sizeof(T);
    300         m_buffer = static_cast<T*>(fastRealloc(m_buffer, sizeToAllocate));
     296        m_capacity = newCapacity;
     297        m_buffer = static_cast<T*>(fastRealloc(m_buffer, newCapacity * sizeof(T)));
    301298    }
    302299
Note: See TracChangeset for help on using the changeset viewer.