Changeset 179743 in webkit
- Timestamp:
- Feb 6, 2015 2:03:56 AM (9 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r179728 r179743 1 2015-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 1 12 2015-02-05 Michael Saboff <msaboff@apple.com> 2 13 -
trunk/Source/JavaScriptCore/assembler/AssemblerBuffer.h
r171123 r179743 69 69 70 70 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 { 74 74 } 75 75 … … 102 102 void grow(unsigned extraCapacity = 0) 103 103 { 104 m_capacity = fastMallocGoodSize(m_capacity + m_capacity / 2 + extraCapacity);104 m_capacity = m_capacity + m_capacity / 2 + extraCapacity; 105 105 m_buffer = static_cast<char*>(fastRealloc(m_buffer, m_capacity)); 106 106 } -
trunk/Source/WTF/ChangeLog
r179687 r179743 1 2015-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 1 24 2015-02-05 Youenn Fablet <youenn.fablet@crf.canon.fr> and Xabier Rodriguez Calvar <calvaris@igalia.com> 2 25 -
trunk/Source/WTF/wtf/Compression.cpp
r166482 r179743 70 70 71 71 size_t currentOffset = OBJECT_OFFSETOF(GenericCompressedData, m_data); 72 size_t currentCapacity = fastMallocGoodSize(MinimumSize);72 size_t currentCapacity = MinimumSize; 73 73 Bytef* compressedData = static_cast<Bytef*>(fastMalloc(currentCapacity)); 74 74 memset(compressedData, 0, sizeof(GenericCompressedData)); … … 95 95 newCapacity = std::max(static_cast<size_t>(expectedSize + 8), currentCapacity + 8); 96 96 } 97 newCapacity = fastMallocGoodSize(newCapacity);98 97 if (newCapacity >= dataLength) 99 98 goto fail; -
trunk/Source/WTF/wtf/FastMalloc.cpp
r179500 r179743 154 154 namespace WTF { 155 155 156 size_t fastMallocGoodSize(size_t bytes)157 {158 #if OS(DARWIN)159 return malloc_good_size(bytes);160 #else161 return bytes;162 #endif163 }164 165 156 #if OS(WINDOWS) 166 157 … … 296 287 return 1; 297 288 } 298 299 size_t fastMallocGoodSize(size_t size) 300 { 301 return size; 302 } 303 289 304 290 void* fastAlignedMalloc(size_t alignment, size_t size) 305 291 { … … 2767 2753 2768 2754 #define pageheap getPageHeap() 2769 2770 size_t fastMallocGoodSize(size_t bytes)2771 {2772 if (!phinited)2773 TCMalloc_ThreadCache::InitModule();2774 return AllocationSize(bytes);2775 }2776 2755 2777 2756 #if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY -
trunk/Source/WTF/wtf/FastMalloc.h
r179500 r179743 36 36 WTF_EXPORT_PRIVATE char* fastStrDup(const char*); 37 37 WTF_EXPORT_PRIVATE size_t fastMallocSize(const void*); 38 WTF_EXPORT_PRIVATE size_t fastMallocGoodSize(size_t);39 38 40 39 // Allocations from fastAlignedMalloc() must be freed using fastAlignedFree(). … … 100 99 using WTF::fastFree; 101 100 using WTF::fastMalloc; 102 using WTF::fastMallocGoodSize;103 101 using WTF::fastMallocSize; 104 102 using WTF::fastRealloc; -
trunk/Source/WTF/wtf/Vector.h
r179599 r179743 265 265 if (newCapacity > std::numeric_limits<unsigned>::max() / sizeof(T)) 266 266 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))); 270 269 } 271 270 … … 276 275 return false; 277 276 278 size_t sizeToAllocate = fastMallocGoodSize(newCapacity * sizeof(T));279 277 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; 282 280 m_buffer = newBuffer; 283 281 return true; … … 296 294 if (newCapacity > std::numeric_limits<size_t>::max() / sizeof(T)) 297 295 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))); 301 298 } 302 299
Note: See TracChangeset
for help on using the changeset viewer.