WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
the patch
blah.patch (text/plain), 3.86 KB, created by
Filip Pizlo
on 2014-02-14 20:36:22 PST
(
hide
)
Description:
the patch
Filename:
MIME Type:
Creator:
Filip Pizlo
Created:
2014-02-14 20:36:22 PST
Size:
3.86 KB
patch
obsolete
>Index: Source/WTF/ChangeLog >=================================================================== >--- Source/WTF/ChangeLog (revision 164155) >+++ Source/WTF/ChangeLog (working copy) >@@ -1,3 +1,19 @@ >+2014-02-14 Filip Pizlo <fpizlo@apple.com> >+ >+ Vector with inline capacity should work with non-PODs >+ https://bugs.webkit.org/show_bug.cgi?id=128864 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Previously it was swapping bits. That's bad if the element is not a POD and wants to be >+ notified when you relocated it. >+ >+ * wtf/Vector.h: >+ (WTF::VectorBuffer::swap): >+ (WTF::VectorBuffer::swapInlineBuffer): >+ (WTF::VectorBuffer::swapInlineBuffers): >+ (WTF::Vector::swap): >+ > 2014-02-14 Benjamin Poulain <bpoulain@apple.com> > > Improve the performance on mobile of FTPDirectoryDocument >Index: Source/WTF/wtf/Vector.h >=================================================================== >--- Source/WTF/wtf/Vector.h (revision 164141) >+++ Source/WTF/wtf/Vector.h (working copy) >@@ -374,7 +374,7 @@ public: > deallocateBuffer(buffer()); > } > >- void swap(VectorBuffer<T, 0>& other) >+ void swap(VectorBuffer<T, 0>& other, size_t, size_t) > { > std::swap(m_buffer, other.m_buffer); > std::swap(m_capacity, other.m_capacity); >@@ -464,20 +464,20 @@ public: > Base::reallocateBuffer(newCapacity); > } > >- void swap(VectorBuffer& other) >+ void swap(VectorBuffer& other, size_t mySize, size_t otherSize) > { > if (buffer() == inlineBuffer() && other.buffer() == other.inlineBuffer()) { >- std::swap(m_inlineBuffer, other.m_inlineBuffer); >+ swapInlineBuffer(other, mySize, otherSize); > std::swap(m_capacity, other.m_capacity); > } else if (buffer() == inlineBuffer()) { > m_buffer = other.m_buffer; > other.m_buffer = other.inlineBuffer(); >- std::swap(m_inlineBuffer, other.m_inlineBuffer); >+ swapInlineBuffer(other, mySize, otherSize); > std::swap(m_capacity, other.m_capacity); > } else if (other.buffer() == other.inlineBuffer()) { > other.m_buffer = m_buffer; > m_buffer = inlineBuffer(); >- std::swap(m_inlineBuffer, other.m_inlineBuffer); >+ swapInlineBuffer(other, mySize, otherSize); > std::swap(m_capacity, other.m_capacity); > } else { > std::swap(m_buffer, other.m_buffer); >@@ -510,6 +510,29 @@ protected: > private: > using Base::m_buffer; > using Base::m_capacity; >+ >+ void swapInlineBuffer(VectorBuffer& other, size_t mySize, size_t otherSize) >+ { >+ // FIXME: We could make swap part of VectorTypeOperations >+ // https://bugs.webkit.org/show_bug.cgi?id=128863 >+ >+ if (std::is_pod<T>::value) >+ std::swap(m_inlineBuffer, other.m_inlineBuffer); >+ else >+ swapInlineBuffers(inlineBuffer(), other.inlineBuffer(), mySize, otherSize); >+ } >+ >+ static void swapInlineBuffers(T* left, T* right, size_t leftSize, size_t rightSize) >+ { >+ if (left == right) >+ return; >+ >+ size_t swapBound = std::min(leftSize, rightSize); >+ for (unsigned i = 0; i < swapBound; ++i) >+ std::swap(left[i], right[i]); >+ VectorTypeOperations<T>::move(left + swapBound, left + leftSize, right + swapBound); >+ VectorTypeOperations<T>::move(right + swapBound, right + rightSize, left + swapBound); >+ } > > T* inlineBuffer() { return reinterpret_cast_ptr<T*>(m_inlineBuffer); } > const T* inlineBuffer() const { return reinterpret_cast_ptr<const T*>(m_inlineBuffer); } >@@ -686,8 +709,8 @@ public: > > void swap(Vector<T, inlineCapacity, OverflowHandler>& other) > { >+ Base::swap(other, m_size, other.m_size); > std::swap(m_size, other.m_size); >- Base::swap(other); > } > > void reverse();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 128864
:
224279
|
224280
|
224281
|
224302