Changeset 179751 in webkit
- Timestamp:
- Feb 6, 2015 12:25:05 PM (9 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r179746 r179751 1 2015-02-06 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r179743. 4 https://bugs.webkit.org/show_bug.cgi?id=141335 5 6 caused missing symbols in non-WebKit clients of WTF::Vector 7 (Requested by kling on #webkit). 8 9 Reverted changeset: 10 11 "Remove WTF::fastMallocGoodSize()." 12 https://bugs.webkit.org/show_bug.cgi?id=141020 13 http://trac.webkit.org/changeset/179743 14 1 15 2015-02-04 Filip Pizlo <fpizlo@apple.com> 2 16 -
trunk/Source/JavaScriptCore/assembler/AssemblerBuffer.h
r179743 r179751 69 69 70 70 AssemblerData(unsigned initialCapacity) 71 : m_buffer(static_cast<char*>(fastMalloc(initialCapacity)))72 , m_capacity(initialCapacity)73 {71 { 72 m_capacity = fastMallocGoodSize(initialCapacity); 73 m_buffer = static_cast<char*>(fastMalloc(m_capacity)); 74 74 } 75 75 … … 102 102 void grow(unsigned extraCapacity = 0) 103 103 { 104 m_capacity = m_capacity + m_capacity / 2 + extraCapacity;104 m_capacity = fastMallocGoodSize(m_capacity + m_capacity / 2 + extraCapacity); 105 105 m_buffer = static_cast<char*>(fastRealloc(m_buffer, m_capacity)); 106 106 } -
trunk/Source/WTF/ChangeLog
r179743 r179751 1 2015-02-06 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r179743. 4 https://bugs.webkit.org/show_bug.cgi?id=141335 5 6 caused missing symbols in non-WebKit clients of WTF::Vector 7 (Requested by kling on #webkit). 8 9 Reverted changeset: 10 11 "Remove WTF::fastMallocGoodSize()." 12 https://bugs.webkit.org/show_bug.cgi?id=141020 13 http://trac.webkit.org/changeset/179743 14 1 15 2015-02-06 Andreas Kling <akling@apple.com> 2 16 -
trunk/Source/WTF/wtf/Compression.cpp
r179743 r179751 70 70 71 71 size_t currentOffset = OBJECT_OFFSETOF(GenericCompressedData, m_data); 72 size_t currentCapacity = MinimumSize;72 size_t currentCapacity = fastMallocGoodSize(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); 97 98 if (newCapacity >= dataLength) 98 99 goto fail; -
trunk/Source/WTF/wtf/FastMalloc.cpp
r179743 r179751 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 #else 161 return bytes; 162 #endif 163 } 164 156 165 #if OS(WINDOWS) 157 166 … … 287 296 return 1; 288 297 } 289 298 299 size_t fastMallocGoodSize(size_t size) 300 { 301 return size; 302 } 303 290 304 void* fastAlignedMalloc(size_t alignment, size_t size) 291 305 { … … 2753 2767 2754 2768 #define pageheap getPageHeap() 2769 2770 size_t fastMallocGoodSize(size_t bytes) 2771 { 2772 if (!phinited) 2773 TCMalloc_ThreadCache::InitModule(); 2774 return AllocationSize(bytes); 2775 } 2755 2776 2756 2777 #if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY -
trunk/Source/WTF/wtf/FastMalloc.h
r179743 r179751 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); 38 39 39 40 // Allocations from fastAlignedMalloc() must be freed using fastAlignedFree(). … … 99 100 using WTF::fastFree; 100 101 using WTF::fastMalloc; 102 using WTF::fastMallocGoodSize; 101 103 using WTF::fastMallocSize; 102 104 using WTF::fastRealloc; -
trunk/Source/WTF/wtf/Vector.h
r179743 r179751 265 265 if (newCapacity > std::numeric_limits<unsigned>::max() / sizeof(T)) 266 266 CRASH(); 267 m_capacity = newCapacity; 268 m_buffer = static_cast<T*>(fastMalloc(newCapacity * sizeof(T))); 267 size_t sizeToAllocate = fastMallocGoodSize(newCapacity * sizeof(T)); 268 m_capacity = sizeToAllocate / sizeof(T); 269 m_buffer = static_cast<T*>(fastMalloc(sizeToAllocate)); 269 270 } 270 271 … … 275 276 return false; 276 277 278 size_t sizeToAllocate = fastMallocGoodSize(newCapacity * sizeof(T)); 277 279 T* newBuffer; 278 if (tryFastMalloc( newCapacity * sizeof(T)).getValue(newBuffer)) {279 m_capacity = newCapacity;280 if (tryFastMalloc(sizeToAllocate).getValue(newBuffer)) { 281 m_capacity = sizeToAllocate / sizeof(T); 280 282 m_buffer = newBuffer; 281 283 return true; … … 294 296 if (newCapacity > std::numeric_limits<size_t>::max() / sizeof(T)) 295 297 CRASH(); 296 m_capacity = newCapacity; 297 m_buffer = static_cast<T*>(fastRealloc(m_buffer, newCapacity * sizeof(T))); 298 size_t sizeToAllocate = fastMallocGoodSize(newCapacity * sizeof(T)); 299 m_capacity = sizeToAllocate / sizeof(T); 300 m_buffer = static_cast<T*>(fastRealloc(m_buffer, sizeToAllocate)); 298 301 } 299 302
Note: See TracChangeset
for help on using the changeset viewer.