Changeset 31061 in webkit for trunk/JavaScriptCore/wtf/Vector.h
- Timestamp:
- Mar 14, 2008, 12:05:28 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/wtf/Vector.h
r31032 r31061 254 254 void deallocateBuffer(T* bufferToDeallocate) 255 255 { 256 if (m_buffer == bufferToDeallocate) 257 m_buffer = 0; 256 258 fastFree(bufferToDeallocate); 257 259 } … … 344 346 : Base(inlineBuffer(), inlineCapacity) 345 347 { 346 if (capacity > inlineCapacity) 347 allocateBuffer(capacity); 348 allocateBuffer(capacity); 348 349 } 349 350 … … 353 354 } 354 355 355 using Base::allocateBuffer; 356 void allocateBuffer(size_t newCapacity) 357 { 358 if (newCapacity > inlineCapacity) 359 Base::allocateBuffer(newCapacity); 360 } 356 361 357 362 void deallocateBuffer(T* bufferToDeallocate) … … 666 671 return; 667 672 673 resize(min(m_size, newCapacity)); 674 668 675 T* oldBuffer = begin(); 669 676 if (newCapacity > 0) { 670 677 T* oldEnd = end(); 671 678 m_buffer.allocateBuffer(newCapacity); 672 TypeOperations::move (oldBuffer, oldEnd, begin());673 } 674 m_size = min(m_size, newCapacity); 679 TypeOperations::moveOverlapping(oldBuffer, oldEnd, begin()); 680 } 681 675 682 m_buffer.deallocateBuffer(oldBuffer); 676 683 }
Note:
See TracChangeset
for help on using the changeset viewer.