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

Changeset 155474 in webkit


Ignore:
Timestamp:
Sep 10, 2013, 2:18:53 PM (13 years ago)
Author:
andersca@apple.com
Message:

Remove more uses of WTF::AlignedBuffer
https://bugs.webkit.org/show_bug.cgi?id=121119

Reviewed by Andreas Kling.

  • wtf/HashTable.h:
  • wtf/SizeLimits.cpp:
Location:
trunk/Source/WTF
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r155470 r155474  
     12013-09-10  Anders Carlsson  <andersca@apple.com>
     2
     3        Remove more uses of WTF::AlignedBuffer
     4        https://bugs.webkit.org/show_bug.cgi?id=121119
     5
     6        Reviewed by Andreas Kling.
     7
     8        * wtf/HashTable.h:
     9        * wtf/SizeLimits.cpp:
     10
    1112013-09-10  Anders Carlsson  <andersca@apple.com>
    212
  • trunk/Source/WTF/wtf/HashTable.h

    r155407 r155474  
    2424
    2525#include <string.h>
    26 #include <wtf/Alignment.h>
     26#include <type_traits>
     27#include <utility>
    2728#include <wtf/Assertions.h>
    2829#include <wtf/FastMalloc.h>
     
    591592            return;
    592593        ASSERT(!HashTranslator::equal(KeyTraits::emptyValue(), key));
    593         AlignedBuffer<sizeof(ValueType), WTF_ALIGN_OF(ValueType)> deletedValueBuffer;
    594         ValueType* deletedValuePtr = reinterpret_cast_ptr<ValueType*>(deletedValueBuffer.buffer);
     594        typename std::aligned_storage<sizeof(ValueType), std::alignment_of<ValueType>::value>::type deletedValueBuffer;
     595        ValueType* deletedValuePtr = reinterpret_cast_ptr<ValueType*>(&deletedValueBuffer);
    595596        ValueType& deletedValue = *deletedValuePtr;
    596597        Traits::constructDeletedValue(deletedValue);
  • trunk/Source/WTF/wtf/SizeLimits.cpp

    r153638 r155474  
    3131#include "config.h"
    3232
     33#include <type_traits>
     34#include <utility>
    3335#include <wtf/Assertions.h>
    3436#include <wtf/OwnPtr.h>
     
    6870struct SameSizeAsVectorWithInlineCapacity {
    6971    SameSizeAsVectorWithInlineCapacity<T, 0> baseCapacity;
    70     AlignedBuffer<inlineCapacity * sizeof(T), WTF_ALIGN_OF(T)> inlineBuffer;
     72    typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type inlineBuffer[inlineCapacity];
    7173};
    7274
    73 COMPILE_ASSERT(sizeof(OwnPtr<int>) == sizeof(int*), OwnPtr_should_stay_small);
    74 COMPILE_ASSERT(sizeof(PassRefPtr<RefCounted<int> >) == sizeof(int*), PassRefPtr_should_stay_small);
    75 COMPILE_ASSERT(sizeof(RefCounted<int>) == sizeof(SameSizeAsRefCounted), RefCounted_should_stay_small);
    76 COMPILE_ASSERT(sizeof(RefCountedCustomAllocated<int>) == sizeof(SameSizeAsRefCounted), RefCountedCustomAllocated_should_stay_small);
    77 COMPILE_ASSERT(sizeof(RefPtr<RefCounted<int> >) == sizeof(int*), RefPtr_should_stay_small);
    78 COMPILE_ASSERT(sizeof(Vector<int>) == sizeof(SameSizeAsVectorWithInlineCapacity<int>), Vector_should_stay_small);
    79 COMPILE_ASSERT(sizeof(Vector<int, 1>) == sizeof(SameSizeAsVectorWithInlineCapacity<int, 1>), Vector_should_stay_small);
    80 COMPILE_ASSERT(sizeof(Vector<int, 2>) == sizeof(SameSizeAsVectorWithInlineCapacity<int, 2>), Vector_should_stay_small);
    81 COMPILE_ASSERT(sizeof(Vector<int, 3>) == sizeof(SameSizeAsVectorWithInlineCapacity<int, 3>), Vector_should_stay_small);
     75static_assert(sizeof(OwnPtr<int>) == sizeof(int*), "OwnPtr should stay small!");
     76static_assert(sizeof(PassRefPtr<RefCounted<int> >) == sizeof(int*), "PassRefPtr should stay small!");
     77static_assert(sizeof(RefCounted<int>) == sizeof(SameSizeAsRefCounted), "RefCounted should stay small!");
     78static_assert(sizeof(RefCountedCustomAllocated<int>) == sizeof(SameSizeAsRefCounted), "RefCountedCustomAllocated should stay small!");
     79static_assert(sizeof(RefPtr<RefCounted<int> >) == sizeof(int*), "RefPtr should stay small!");
     80static_assert(sizeof(Vector<int>) == sizeof(SameSizeAsVectorWithInlineCapacity<int>), "Vector should stay small!");
     81static_assert(sizeof(Vector<int, 1>) == sizeof(SameSizeAsVectorWithInlineCapacity<int, 1>), "Vector should stay small!");
     82static_assert(sizeof(Vector<int, 2>) == sizeof(SameSizeAsVectorWithInlineCapacity<int, 2>), "Vector should stay small!");
     83static_assert(sizeof(Vector<int, 3>) == sizeof(SameSizeAsVectorWithInlineCapacity<int, 3>), "Vector should stay small!");
    8284}
Note: See TracChangeset for help on using the changeset viewer.