⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 155484 in webkit


Ignore:
Timestamp:
Sep 10, 2013, 3:36:23 PM (13 years ago)
Author:
andersca@apple.com
Message:

More WTF/Alignment.h removal
https://bugs.webkit.org/show_bug.cgi?id=121125

Reviewed by Andreas Kling.

Source/WebCore:

  • platform/PODArena.h:

Source/WTF:

  • wtf/Alignment.h:
  • wtf/Vector.h:

(WTF::VectorBuffer::swap):
(WTF::VectorBuffer::inlineBuffer):

  • wtf/text/ASCIIFastPath.h:

(WTF::isAlignedTo):
(WTF::isAlignedToMachineWord):

Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r155483 r155484  
     12013-09-10  Anders Carlsson  <andersca@apple.com>
     2
     3        More WTF/Alignment.h removal
     4        https://bugs.webkit.org/show_bug.cgi?id=121125
     5
     6        Reviewed by Andreas Kling.
     7
     8        * wtf/Alignment.h:
     9        * wtf/Vector.h:
     10        (WTF::VectorBuffer::swap):
     11        (WTF::VectorBuffer::inlineBuffer):
     12        * wtf/text/ASCIIFastPath.h:
     13        (WTF::isAlignedTo):
     14        (WTF::isAlignedToMachineWord):
     15
    1162013-09-10  Brent Fulgham  <bfulgham@apple.com>
    217
  • trunk/Source/WTF/wtf/Alignment.h

    r150134 r155484  
    6161    }
    6262
    63     template <uintptr_t mask>
    64     inline bool isAlignedTo(const void* pointer)
    65     {
    66         return !(reinterpret_cast<uintptr_t>(pointer) & mask);
    67     }
    6863}
    6964
  • trunk/Source/WTF/wtf/Vector.h

    r155308 r155484  
    2222#define WTF_Vector_h
    2323
    24 #include <wtf/Alignment.h>
     24#include <limits>
     25#include <string.h>
     26#include <type_traits>
     27#include <utility>
    2528#include <wtf/CheckedArithmetic.h>
    2629#include <wtf/FastMalloc.h>
     
    3134#include <wtf/ValueCheck.h>
    3235#include <wtf/VectorTraits.h>
    33 #include <limits>
    34 #include <string.h>
    35 #include <utility>
    3636
    3737namespace WTF {
     
    456456    }
    457457
    458     void swap(VectorBuffer<T, inlineCapacity>& other)
     458    void swap(VectorBuffer& other)
    459459    {
    460460        if (buffer() == inlineBuffer() && other.buffer() == other.inlineBuffer()) {
    461             WTF::swap(m_inlineBuffer, other.m_inlineBuffer);
     461            std::swap_ranges(m_inlineBuffer, m_inlineBuffer + inlineCapacity, other.m_inlineBuffer);
    462462            std::swap(m_capacity, other.m_capacity);
    463463        } else if (buffer() == inlineBuffer()) {
    464464            m_buffer = other.m_buffer;
    465465            other.m_buffer = other.inlineBuffer();
    466             WTF::swap(m_inlineBuffer, other.m_inlineBuffer);
     466            std::swap_ranges(m_inlineBuffer, m_inlineBuffer + inlineCapacity, other.m_inlineBuffer);
    467467            std::swap(m_capacity, other.m_capacity);
    468468        } else if (other.buffer() == other.inlineBuffer()) {
    469469            other.m_buffer = m_buffer;
    470470            m_buffer = inlineBuffer();
    471             WTF::swap(m_inlineBuffer, other.m_inlineBuffer);
     471            std::swap_ranges(m_inlineBuffer, m_inlineBuffer + inlineCapacity, other.m_inlineBuffer);
    472472            std::swap(m_capacity, other.m_capacity);
    473473        } else {
     
    502502    using Base::m_capacity;
    503503
    504     static const size_t m_inlineBufferSize = inlineCapacity * sizeof(T);
    505     T* inlineBuffer() { return reinterpret_cast_ptr<T*>(m_inlineBuffer.buffer); }
    506     const T* inlineBuffer() const { return reinterpret_cast_ptr<const T*>(m_inlineBuffer.buffer); }
    507 
    508     AlignedBuffer<m_inlineBufferSize, WTF_ALIGN_OF(T)> m_inlineBuffer;
     504    T* inlineBuffer() { return reinterpret_cast_ptr<T*>(m_inlineBuffer); }
     505    const T* inlineBuffer() const { return reinterpret_cast_ptr<const T*>(m_inlineBuffer); }
     506
     507    typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type m_inlineBuffer[inlineCapacity];
    509508};
    510509
  • trunk/Source/WTF/wtf/text/ASCIIFastPath.h

    r144811 r155484  
    3333namespace WTF {
    3434
     35template <uintptr_t mask>
     36inline bool isAlignedTo(const void* pointer)
     37{
     38    return !(reinterpret_cast<uintptr_t>(pointer) & mask);
     39}
     40
    3541// Assuming that a pointer is the size of a "machine word", then
    3642// uintptr_t is an integer type that is also a machine word.
     
    4046inline bool isAlignedToMachineWord(const void* pointer)
    4147{
    42     return !(reinterpret_cast<uintptr_t>(pointer) & machineWordAlignmentMask);
     48    return isAlignedTo<machineWordAlignmentMask>(pointer);
    4349}
    4450
  • trunk/Source/WebCore/ChangeLog

    r155478 r155484  
     12013-09-10  Anders Carlsson  <andersca@apple.com>
     2
     3        More WTF/Alignment.h removal
     4        https://bugs.webkit.org/show_bug.cgi?id=121125
     5
     6        Reviewed by Andreas Kling.
     7
     8        * platform/PODArena.h:
     9
    1102013-09-10  Eric Carlson  <eric.carlson@apple.com>
    211
  • trunk/Source/WebCore/platform/PODArena.h

    r150932 r155484  
    2828
    2929#include <stdint.h>
     30#include <wtf/Alignment.h>
    3031#include <wtf/Assertions.h>
    3132#include <wtf/FastMalloc.h>
Note: See TracChangeset for help on using the changeset viewer.