Skip to content
  • akling@apple.com's avatar
    Vector should consult allocator about ideal size when choosing capacity. · ea09384f
    akling@apple.com authored
    <http://webkit.org/b/108410>
    <rdar://problem/13124002>
    
    Reviewed by Benjamin Poulain.
    
    Source/JavaScriptCore:
    
    Remove assertion about Vector capacity that won't hold anymore since capacity()
    may not be what you passed to reserveCapacity().
    Also export WTF::fastMallocGoodSize() for Windows builds.
    
    * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreExports.def:
    * bytecode/CodeBlock.cpp:
    (JSC::CodeBlock::CodeBlock):
    
    Source/WTF:
    
    Added WTF::fastMallocGoodSize(), a workalike/wrapper for OS X's malloc_good_size().
    It returns the actual size of the block that will get allocated for a given byte size.
    
    Vector's internal buffer now checks with the allocator if the resulting allocation
    could actually house more objects and updates its capacity to make use of the space.
    
    * wtf/Deque.h:
    (WTF::::expandCapacity):
    * wtf/FastMalloc.cpp:
    (WTF::fastMallocGoodSize):
    * wtf/FastMalloc.h:
    * wtf/Vector.h:
    (WTF::VectorBufferBase::allocateBuffer):
    (WTF::VectorBufferBase::tryAllocateBuffer):
    (WTF::VectorBufferBase::reallocateBuffer):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@141716 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    ea09384f