Title: [176290] trunk/Source
Revision
176290
Author
[email protected]
Date
2014-11-18 15:06:00 -0800 (Tue, 18 Nov 2014)

Log Message

Removed the custom allocator for ListHashSet nodes
https://bugs.webkit.org/show_bug.cgi?id=138841

Reviewed by Andreas Kling.

Source/WebCore:

Uses of ListHashSet no longer need to declare an inline capacity,
since that was only used to specify the capacity of the custom allocator.

* dom/DOMNamedFlowCollection.h:
* dom/DocumentEventQueue.h:
* dom/DocumentStyleSheetCollection.h:
* dom/NamedFlowCollection.h:
* html/FormController.h:
* rendering/FloatingObjects.h:
* rendering/RenderBlock.h:

Source/WebKit2:

Uses of ListHashSet no longer need to declare an inline capacity,
since that was only used to specify the capacity of the custom allocator.

* UIProcess/Plugins/PluginInfoStore.cpp:
(WebKit::PluginInfoStore::loadPluginsIfNecessary):

Source/WTF:

bmalloc is fast, so we don't need a custom allocator.

The MallocBench test for linked list node allocation (list_allocate) is
4.09X faster in bmalloc than TCMalloc. Also, I wrote a stress test to
add/remove link elements, which modify a ListHashSet on insertion and
removal, and it was 1% faster / in the noise with bmalloc enabled.

* wtf/ListHashSet.h:
(WTF::ListHashSetNode::ListHashSetNode):
(WTF::ListHashSetTranslator::translate):
(WTF::U>::ListHashSet):
(WTF::=):
(WTF::U>::swap):
(WTF::U>::~ListHashSet):
(WTF::U>::size):
(WTF::U>::capacity):
(WTF::U>::isEmpty):
(WTF::U>::first):
(WTF::U>::removeFirst):
(WTF::U>::takeFirst):
(WTF::U>::last):
(WTF::U>::removeLast):
(WTF::U>::takeLast):
(WTF::U>::contains):
(WTF::U>::remove):
(WTF::U>::clear):
(WTF::U>::unlink):
(WTF::U>::unlinkAndDelete):
(WTF::U>::appendNode):
(WTF::U>::prependNode):
(WTF::U>::insertNodeBefore):
(WTF::U>::deleteAllNodes):
(WTF::ListHashSetNodeAllocator::ListHashSetNodeAllocator): Deleted.
(WTF::ListHashSetNodeAllocator::allocate): Deleted.
(WTF::ListHashSetNodeAllocator::deallocate): Deleted.
(WTF::ListHashSetNodeAllocator::pool): Deleted.
(WTF::ListHashSetNodeAllocator::pastPool): Deleted.
(WTF::ListHashSetNodeAllocator::inPool): Deleted.
(WTF::ListHashSetNode::operator new): Deleted.
(WTF::ListHashSetNode::destroy): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (176289 => 176290)


--- trunk/Source/WTF/ChangeLog	2014-11-18 22:57:43 UTC (rev 176289)
+++ trunk/Source/WTF/ChangeLog	2014-11-18 23:06:00 UTC (rev 176290)
@@ -1,3 +1,51 @@
+2014-11-18  Geoffrey Garen  <[email protected]>
+
+        Removed the custom allocator for ListHashSet nodes
+        https://bugs.webkit.org/show_bug.cgi?id=138841
+
+        Reviewed by Andreas Kling.
+
+        bmalloc is fast, so we don't need a custom allocator.
+
+        The MallocBench test for linked list node allocation (list_allocate) is
+        4.09X faster in bmalloc than TCMalloc. Also, I wrote a stress test to
+        add/remove link elements, which modify a ListHashSet on insertion and
+        removal, and it was 1% faster / in the noise with bmalloc enabled.
+
+        * wtf/ListHashSet.h:
+        (WTF::ListHashSetNode::ListHashSetNode):
+        (WTF::ListHashSetTranslator::translate):
+        (WTF::U>::ListHashSet):
+        (WTF::=):
+        (WTF::U>::swap):
+        (WTF::U>::~ListHashSet):
+        (WTF::U>::size):
+        (WTF::U>::capacity):
+        (WTF::U>::isEmpty):
+        (WTF::U>::first):
+        (WTF::U>::removeFirst):
+        (WTF::U>::takeFirst):
+        (WTF::U>::last):
+        (WTF::U>::removeLast):
+        (WTF::U>::takeLast):
+        (WTF::U>::contains):
+        (WTF::U>::remove):
+        (WTF::U>::clear):
+        (WTF::U>::unlink):
+        (WTF::U>::unlinkAndDelete):
+        (WTF::U>::appendNode):
+        (WTF::U>::prependNode):
+        (WTF::U>::insertNodeBefore):
+        (WTF::U>::deleteAllNodes):
+        (WTF::ListHashSetNodeAllocator::ListHashSetNodeAllocator): Deleted.
+        (WTF::ListHashSetNodeAllocator::allocate): Deleted.
+        (WTF::ListHashSetNodeAllocator::deallocate): Deleted.
+        (WTF::ListHashSetNodeAllocator::pool): Deleted.
+        (WTF::ListHashSetNodeAllocator::pastPool): Deleted.
+        (WTF::ListHashSetNodeAllocator::inPool): Deleted.
+        (WTF::ListHashSetNode::operator new): Deleted.
+        (WTF::ListHashSetNode::destroy): Deleted.
+
 2014-11-18  Chris Dumez  <[email protected]>
 
         Update the Vector API to deal with unsigned types instead of size_t

Modified: trunk/Source/WTF/wtf/ListHashSet.h (176289 => 176290)


--- trunk/Source/WTF/wtf/ListHashSet.h	2014-11-18 22:57:43 UTC (rev 176289)
+++ trunk/Source/WTF/wtf/ListHashSet.h	2014-11-18 23:06:00 UTC (rev 176290)
@@ -38,22 +38,20 @@
 // guaranteed safe against mutation of the ListHashSet, except for
 // removal of the item currently pointed to by a given iterator.
 
-template<typename Value, size_t inlineCapacity, typename HashFunctions> class ListHashSet;
+template<typename Value, typename HashFunctions> class ListHashSet;
 
-template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetIterator;
-template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetConstIterator;
+template<typename ValueArg, typename HashArg> class ListHashSetIterator;
+template<typename ValueArg, typename HashArg> class ListHashSetConstIterator;
 
-template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNode;
-template<typename ValueArg, size_t inlineCapacity> class ListHashSetNodeAllocator;
+template<typename ValueArg> struct ListHashSetNode;
 
 template<typename HashArg> struct ListHashSetNodeHashFunctions;
 template<typename HashArg> struct ListHashSetTranslator;
 
-template<typename ValueArg, size_t inlineCapacity = 256, typename HashArg = typename DefaultHash<ValueArg>::Hash> class ListHashSet {
+template<typename ValueArg, typename HashArg = typename DefaultHash<ValueArg>::Hash> class ListHashSet {
     WTF_MAKE_FAST_ALLOCATED;
 private:
-    typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
-    typedef ListHashSetNodeAllocator<ValueArg, inlineCapacity> NodeAllocator;
+    typedef ListHashSetNode<ValueArg> Node;
 
     typedef HashTraits<Node*> NodeTraits;
     typedef ListHashSetNodeHashFunctions<HashArg> NodeHash;
@@ -64,9 +62,9 @@
 public:
     typedef ValueArg ValueType;
 
-    typedef ListHashSetIterator<ValueType, inlineCapacity, HashArg> iterator;
-    typedef ListHashSetConstIterator<ValueType, inlineCapacity, HashArg> const_iterator;
-    friend class ListHashSetConstIterator<ValueType, inlineCapacity, HashArg>;
+    typedef ListHashSetIterator<ValueType, HashArg> iterator;
+    typedef ListHashSetConstIterator<ValueType, HashArg> const_iterator;
+    friend class ListHashSetConstIterator<ValueType, HashArg>;
 
     typedef std::reverse_iterator<iterator> reverse_iterator;
     typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
@@ -155,111 +153,22 @@
     HashTable<Node*, Node*, IdentityExtractor, NodeHash, NodeTraits, NodeTraits> m_impl;
     Node* m_head;
     Node* m_tail;
-    std::unique_ptr<NodeAllocator> m_allocator;
 };
 
-template<typename ValueArg, size_t inlineCapacity> class ListHashSetNodeAllocator {
+template<typename ValueArg> struct ListHashSetNode {
     WTF_MAKE_FAST_ALLOCATED;
-
 public:
-    typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
-    typedef ListHashSetNodeAllocator<ValueArg, inlineCapacity> NodeAllocator;
-
-    ListHashSetNodeAllocator() 
-        : m_freeList(pool())
-        , m_isDoneWithInitialFreeList(false)
-    { 
-        memset(m_pool.pool, 0, sizeof(m_pool.pool));
-    }
-
-    Node* allocate()
-    { 
-        Node* result = m_freeList;
-
-        if (!result)
-            return static_cast<Node*>(fastMalloc(sizeof(Node)));
-
-        ASSERT(!result->m_isAllocated);
-
-        Node* next = result->m_next;
-        ASSERT(!next || !next->m_isAllocated);
-        if (!next && !m_isDoneWithInitialFreeList) {
-            next = result + 1;
-            if (next == pastPool()) {
-                m_isDoneWithInitialFreeList = true;
-                next = 0;
-            } else {
-                ASSERT(inPool(next));
-                ASSERT(!next->m_isAllocated);
-            }
-        }
-        m_freeList = next;
-
-        return result;
-    }
-
-    void deallocate(Node* node) 
-    {
-        if (inPool(node)) {
-#ifndef NDEBUG
-            node->m_isAllocated = false;
-#endif
-            node->m_next = m_freeList;
-            m_freeList = node;
-            return;
-        }
-
-        fastFree(node);
-    }
-
-private:
-    Node* pool() { return reinterpret_cast_ptr<Node*>(m_pool.pool); }
-    Node* pastPool() { return pool() + m_poolSize; }
-    bool inPool(Node* node)
-    {
-        return node >= pool() && node < pastPool();
-    }
-
-    Node* m_freeList;
-    bool m_isDoneWithInitialFreeList;
-    static const size_t m_poolSize = inlineCapacity;
-    union {
-        char pool[sizeof(Node) * m_poolSize];
-        double forAlignment;
-    } m_pool;
-};
-
-template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNode {
-    typedef ListHashSetNodeAllocator<ValueArg, inlineCapacity> NodeAllocator;
-
     template<typename T>
     ListHashSetNode(T&& value)
         : m_value(std::forward<T>(value))
         , m_prev(0)
         , m_next(0)
-#ifndef NDEBUG
-        , m_isAllocated(true)
-#endif
     {
     }
 
-    void* operator new(size_t, NodeAllocator* allocator)
-    {
-        return allocator->allocate();
-    }
-    void destroy(NodeAllocator* allocator)
-    {
-        this->~ListHashSetNode();
-        allocator->deallocate(this);
-    }
-
     ValueArg m_value;
     ListHashSetNode* m_prev;
     ListHashSetNode* m_next;
-
-#ifndef NDEBUG
-    bool m_isAllocated;
-#endif
 };
 
 template<typename HashArg> struct ListHashSetNodeHashFunctions {
@@ -268,15 +177,15 @@
     static const bool safeToCompareToEmptyOrDeleted = false;
 };
 
-template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetIterator {
+template<typename ValueArg, typename HashArg> class ListHashSetIterator {
 private:
-    typedef ListHashSet<ValueArg, inlineCapacity, HashArg> ListHashSetType;
-    typedef ListHashSetIterator<ValueArg, inlineCapacity, HashArg> iterator;
-    typedef ListHashSetConstIterator<ValueArg, inlineCapacity, HashArg> const_iterator;
-    typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
+    typedef ListHashSet<ValueArg, HashArg> ListHashSetType;
+    typedef ListHashSetIterator<ValueArg, HashArg> iterator;
+    typedef ListHashSetConstIterator<ValueArg, HashArg> const_iterator;
+    typedef ListHashSetNode<ValueArg> Node;
     typedef ValueArg ValueType;
 
-    friend class ListHashSet<ValueArg, inlineCapacity, HashArg>;
+    friend class ListHashSet<ValueArg, HashArg>;
 
     ListHashSetIterator(const ListHashSetType* set, Node* position) : m_iterator(set, position) { }
 
@@ -315,16 +224,16 @@
     const_iterator m_iterator;
 };
 
-template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetConstIterator {
+template<typename ValueArg, typename HashArg> class ListHashSetConstIterator {
 private:
-    typedef ListHashSet<ValueArg, inlineCapacity, HashArg> ListHashSetType;
-    typedef ListHashSetIterator<ValueArg, inlineCapacity, HashArg> iterator;
-    typedef ListHashSetConstIterator<ValueArg, inlineCapacity, HashArg> const_iterator;
-    typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
+    typedef ListHashSet<ValueArg, HashArg> ListHashSetType;
+    typedef ListHashSetIterator<ValueArg, HashArg> iterator;
+    typedef ListHashSetConstIterator<ValueArg, HashArg> const_iterator;
+    typedef ListHashSetNode<ValueArg> Node;
     typedef ValueArg ValueType;
 
-    friend class ListHashSet<ValueArg, inlineCapacity, HashArg>;
-    friend class ListHashSetIterator<ValueArg, inlineCapacity, HashArg>;
+    friend class ListHashSet<ValueArg, HashArg>;
+    friend class ListHashSetIterator<ValueArg, HashArg>;
 
     ListHashSetConstIterator(const ListHashSetType* set, Node* position)
         : m_set(set)
@@ -393,86 +302,83 @@
 struct ListHashSetTranslator {
     template<typename T> static unsigned hash(const T& key) { return HashFunctions::hash(key); }
     template<typename T, typename U> static bool equal(const T& a, const U& b) { return HashFunctions::equal(a->m_value, b); }
-    template<typename T, typename U, typename V> static void translate(T*& location, U&& key, const V& allocator)
+    template<typename T, typename U, typename V> static void translate(T*& location, U&& key, V&&)
     {
-        location = new (allocator) T(std::forward<U>(key));
+        location = new T(std::forward<U>(key));
     }
 };
 
-template<typename T, size_t inlineCapacity, typename U>
-inline ListHashSet<T, inlineCapacity, U>::ListHashSet()
+template<typename T, typename U>
+inline ListHashSet<T, U>::ListHashSet()
     : m_head(0)
     , m_tail(0)
-    , m_allocator(std::make_unique<NodeAllocator>())
 {
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-inline ListHashSet<T, inlineCapacity, U>::ListHashSet(const ListHashSet& other)
+template<typename T, typename U>
+inline ListHashSet<T, U>::ListHashSet(const ListHashSet& other)
     : m_head(0)
     , m_tail(0)
-    , m_allocator(std::make_unique<NodeAllocator>())
 {
     for (auto it = other.begin(), end = other.end(); it != end; ++it)
         add(*it);
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-inline ListHashSet<T, inlineCapacity, U>& ListHashSet<T, inlineCapacity, U>::operator=(const ListHashSet& other)
+template<typename T, typename U>
+inline ListHashSet<T, U>& ListHashSet<T, U>::operator=(const ListHashSet& other)
 {
     ListHashSet tmp(other);
     swap(tmp);
     return *this;
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-inline void ListHashSet<T, inlineCapacity, U>::swap(ListHashSet& other)
+template<typename T, typename U>
+inline void ListHashSet<T, U>::swap(ListHashSet& other)
 {
     m_impl.swap(other.m_impl);
     std::swap(m_head, other.m_head);
     std::swap(m_tail, other.m_tail);
-    m_allocator.swap(other.m_allocator);
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-inline ListHashSet<T, inlineCapacity, U>::~ListHashSet()
+template<typename T, typename U>
+inline ListHashSet<T, U>::~ListHashSet()
 {
     deleteAllNodes();
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-inline int ListHashSet<T, inlineCapacity, U>::size() const
+template<typename T, typename U>
+inline int ListHashSet<T, U>::size() const
 {
     return m_impl.size(); 
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-inline int ListHashSet<T, inlineCapacity, U>::capacity() const
+template<typename T, typename U>
+inline int ListHashSet<T, U>::capacity() const
 {
     return m_impl.capacity(); 
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-inline bool ListHashSet<T, inlineCapacity, U>::isEmpty() const
+template<typename T, typename U>
+inline bool ListHashSet<T, U>::isEmpty() const
 {
     return m_impl.isEmpty(); 
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-inline T& ListHashSet<T, inlineCapacity, U>::first()
+template<typename T, typename U>
+inline T& ListHashSet<T, U>::first()
 {
     ASSERT(!isEmpty());
     return m_head->m_value;
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-inline void ListHashSet<T, inlineCapacity, U>::removeFirst()
+template<typename T, typename U>
+inline void ListHashSet<T, U>::removeFirst()
 {
     takeFirst();
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-inline T ListHashSet<T, inlineCapacity, U>::takeFirst()
+template<typename T, typename U>
+inline T ListHashSet<T, U>::takeFirst()
 {
     ASSERT(!isEmpty());
     auto it = m_impl.find(m_head);
@@ -484,35 +390,35 @@
     return result;
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-inline const T& ListHashSet<T, inlineCapacity, U>::first() const
+template<typename T, typename U>
+inline const T& ListHashSet<T, U>::first() const
 {
     ASSERT(!isEmpty());
     return m_head->m_value;
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-inline T& ListHashSet<T, inlineCapacity, U>::last()
+template<typename T, typename U>
+inline T& ListHashSet<T, U>::last()
 {
     ASSERT(!isEmpty());
     return m_tail->m_value;
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-inline const T& ListHashSet<T, inlineCapacity, U>::last() const
+template<typename T, typename U>
+inline const T& ListHashSet<T, U>::last() const
 {
     ASSERT(!isEmpty());
     return m_tail->m_value;
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-inline void ListHashSet<T, inlineCapacity, U>::removeLast()
+template<typename T, typename U>
+inline void ListHashSet<T, U>::removeLast()
 {
     takeLast();
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-inline T ListHashSet<T, inlineCapacity, U>::takeLast()
+template<typename T, typename U>
+inline T ListHashSet<T, U>::takeLast()
 {
     ASSERT(!isEmpty());
     auto it = m_impl.find(m_tail);
@@ -524,8 +430,8 @@
     return result;
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-inline auto ListHashSet<T, inlineCapacity, U>::find(const ValueType& value) -> iterator
+template<typename T, typename U>
+inline auto ListHashSet<T, U>::find(const ValueType& value) -> iterator
 {
     auto it = m_impl.template find<BaseTranslator>(value);
     if (it == m_impl.end())
@@ -533,8 +439,8 @@
     return makeIterator(*it); 
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-inline auto ListHashSet<T, inlineCapacity, U>::find(const ValueType& value) const -> const_iterator
+template<typename T, typename U>
+inline auto ListHashSet<T, U>::find(const ValueType& value) const -> const_iterator
 {
     auto it = m_impl.template find<BaseTranslator>(value);
     if (it == m_impl.end())
@@ -548,9 +454,9 @@
     template<typename T, typename U> static bool equal(const T& a, const U& b) { return Translator::equal(a->m_value, b); }
 };
 
-template<typename ValueType, size_t inlineCapacity, typename U>
+template<typename ValueType, typename U>
 template<typename T, typename HashTranslator>
-inline auto ListHashSet<ValueType, inlineCapacity, U>::find(const T& value) -> iterator
+inline auto ListHashSet<ValueType, U>::find(const T& value) -> iterator
 {
     auto it = m_impl.template find<ListHashSetTranslatorAdapter<HashTranslator>>(value);
     if (it == m_impl.end())
@@ -558,9 +464,9 @@
     return makeIterator(*it);
 }
 
-template<typename ValueType, size_t inlineCapacity, typename U>
+template<typename ValueType, typename U>
 template<typename T, typename HashTranslator>
-inline auto ListHashSet<ValueType, inlineCapacity, U>::find(const T& value) const -> const_iterator
+inline auto ListHashSet<ValueType, U>::find(const T& value) const -> const_iterator
 {
     auto it = m_impl.template find<ListHashSetTranslatorAdapter<HashTranslator>>(value);
     if (it == m_impl.end())
@@ -568,41 +474,41 @@
     return makeConstIterator(*it);
 }
 
-template<typename ValueType, size_t inlineCapacity, typename U>
+template<typename ValueType, typename U>
 template<typename T, typename HashTranslator>
-inline bool ListHashSet<ValueType, inlineCapacity, U>::contains(const T& value) const
+inline bool ListHashSet<ValueType, U>::contains(const T& value) const
 {
     return m_impl.template contains<ListHashSetTranslatorAdapter<HashTranslator>>(value);
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-inline bool ListHashSet<T, inlineCapacity, U>::contains(const ValueType& value) const
+template<typename T, typename U>
+inline bool ListHashSet<T, U>::contains(const ValueType& value) const
 {
     return m_impl.template contains<BaseTranslator>(value);
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-auto ListHashSet<T, inlineCapacity, U>::add(const ValueType& value) -> AddResult
+template<typename T, typename U>
+auto ListHashSet<T, U>::add(const ValueType& value) -> AddResult
 {
-    auto result = m_impl.template add<BaseTranslator>(value, m_allocator.get());
+    auto result = m_impl.template add<BaseTranslator>(value, nullptr);
     if (result.isNewEntry)
         appendNode(*result.iterator);
     return AddResult(makeIterator(*result.iterator), result.isNewEntry);
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-auto ListHashSet<T, inlineCapacity, U>::add(ValueType&& value) -> AddResult
+template<typename T, typename U>
+auto ListHashSet<T, U>::add(ValueType&& value) -> AddResult
 {
-    auto result = m_impl.template add<BaseTranslator>(WTF::move(value), m_allocator.get());
+    auto result = m_impl.template add<BaseTranslator>(WTF::move(value), nullptr);
     if (result.isNewEntry)
         appendNode(*result.iterator);
     return AddResult(makeIterator(*result.iterator), result.isNewEntry);
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-auto ListHashSet<T, inlineCapacity, U>::appendOrMoveToLast(const ValueType& value) -> AddResult
+template<typename T, typename U>
+auto ListHashSet<T, U>::appendOrMoveToLast(const ValueType& value) -> AddResult
 {
-    auto result = m_impl.template add<BaseTranslator>(value, m_allocator.get());
+    auto result = m_impl.template add<BaseTranslator>(value, nullptr);
     Node* node = *result.iterator;
     if (!result.isNewEntry)
         unlink(node);
@@ -611,10 +517,10 @@
     return AddResult(makeIterator(*result.iterator), result.isNewEntry);
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-auto ListHashSet<T, inlineCapacity, U>::appendOrMoveToLast(ValueType&& value) -> AddResult
+template<typename T, typename U>
+auto ListHashSet<T, U>::appendOrMoveToLast(ValueType&& value) -> AddResult
 {
-    auto result = m_impl.template add<BaseTranslator>(WTF::move(value), m_allocator.get());
+    auto result = m_impl.template add<BaseTranslator>(WTF::move(value), nullptr);
     Node* node = *result.iterator;
     if (!result.isNewEntry)
         unlink(node);
@@ -623,10 +529,10 @@
     return AddResult(makeIterator(*result.iterator), result.isNewEntry);
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-auto ListHashSet<T, inlineCapacity, U>::prependOrMoveToFirst(const ValueType& value) -> AddResult
+template<typename T, typename U>
+auto ListHashSet<T, U>::prependOrMoveToFirst(const ValueType& value) -> AddResult
 {
-    auto result = m_impl.template add<BaseTranslator>(value, m_allocator.get());
+    auto result = m_impl.template add<BaseTranslator>(value, nullptr);
     Node* node = *result.iterator;
     if (!result.isNewEntry)
         unlink(node);
@@ -635,10 +541,10 @@
     return AddResult(makeIterator(*result.iterator), result.isNewEntry);
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-auto ListHashSet<T, inlineCapacity, U>::prependOrMoveToFirst(ValueType&& value) -> AddResult
+template<typename T, typename U>
+auto ListHashSet<T, U>::prependOrMoveToFirst(ValueType&& value) -> AddResult
 {
-    auto result = m_impl.template add<BaseTranslator>(WTF::move(value), m_allocator.get());
+    auto result = m_impl.template add<BaseTranslator>(WTF::move(value), nullptr);
     Node* node = *result.iterator;
     if (!result.isNewEntry)
         unlink(node);
@@ -647,38 +553,38 @@
     return AddResult(makeIterator(*result.iterator), result.isNewEntry);
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-auto ListHashSet<T, inlineCapacity, U>::insertBefore(const ValueType& beforeValue, const ValueType& newValue) -> AddResult
+template<typename T, typename U>
+auto ListHashSet<T, U>::insertBefore(const ValueType& beforeValue, const ValueType& newValue) -> AddResult
 {
     return insertBefore(find(beforeValue), newValue);
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-auto ListHashSet<T, inlineCapacity, U>::insertBefore(const ValueType& beforeValue, ValueType&& newValue) -> AddResult
+template<typename T, typename U>
+auto ListHashSet<T, U>::insertBefore(const ValueType& beforeValue, ValueType&& newValue) -> AddResult
 {
     return insertBefore(find(beforeValue), WTF::move(newValue));
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-auto ListHashSet<T, inlineCapacity, U>::insertBefore(iterator it, const ValueType& newValue) -> AddResult
+template<typename T, typename U>
+auto ListHashSet<T, U>::insertBefore(iterator it, const ValueType& newValue) -> AddResult
 {
-    auto result = m_impl.template add<BaseTranslator>(newValue, m_allocator.get());
+    auto result = m_impl.template add<BaseTranslator>(newValue, nullptr);
     if (result.isNewEntry)
         insertNodeBefore(it.node(), *result.iterator);
     return AddResult(makeIterator(*result.iterator), result.isNewEntry);
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-auto ListHashSet<T, inlineCapacity, U>::insertBefore(iterator it, ValueType&& newValue) -> AddResult
+template<typename T, typename U>
+auto ListHashSet<T, U>::insertBefore(iterator it, ValueType&& newValue) -> AddResult
 {
-    auto result = m_impl.template add<BaseTranslator>(WTF::move(newValue), m_allocator.get());
+    auto result = m_impl.template add<BaseTranslator>(WTF::move(newValue), nullptr);
     if (result.isNewEntry)
         insertNodeBefore(it.node(), *result.iterator);
     return AddResult(makeIterator(*result.iterator), result.isNewEntry);
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-inline bool ListHashSet<T, inlineCapacity, U>::remove(iterator it)
+template<typename T, typename U>
+inline bool ListHashSet<T, U>::remove(iterator it)
 {
     if (it == end())
         return false;
@@ -687,14 +593,14 @@
     return true;
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-inline bool ListHashSet<T, inlineCapacity, U>::remove(const ValueType& value)
+template<typename T, typename U>
+inline bool ListHashSet<T, U>::remove(const ValueType& value)
 {
     return remove(find(value));
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-inline void ListHashSet<T, inlineCapacity, U>::clear()
+template<typename T, typename U>
+inline void ListHashSet<T, U>::clear()
 {
     deleteAllNodes();
     m_impl.clear(); 
@@ -702,8 +608,8 @@
     m_tail = 0;
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-void ListHashSet<T, inlineCapacity, U>::unlink(Node* node)
+template<typename T, typename U>
+void ListHashSet<T, U>::unlink(Node* node)
 {
     if (!node->m_prev) {
         ASSERT(node == m_head);
@@ -722,15 +628,15 @@
     }
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-void ListHashSet<T, inlineCapacity, U>::unlinkAndDelete(Node* node)
+template<typename T, typename U>
+void ListHashSet<T, U>::unlinkAndDelete(Node* node)
 {
     unlink(node);
-    node->destroy(m_allocator.get());
+    delete node;
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-void ListHashSet<T, inlineCapacity, U>::appendNode(Node* node)
+template<typename T, typename U>
+void ListHashSet<T, U>::appendNode(Node* node)
 {
     node->m_prev = m_tail;
     node->m_next = 0;
@@ -746,8 +652,8 @@
     m_tail = node;
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-void ListHashSet<T, inlineCapacity, U>::prependNode(Node* node)
+template<typename T, typename U>
+void ListHashSet<T, U>::prependNode(Node* node)
 {
     node->m_prev = 0;
     node->m_next = m_head;
@@ -760,8 +666,8 @@
     m_head = node;
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-void ListHashSet<T, inlineCapacity, U>::insertNodeBefore(Node* beforeNode, Node* newNode)
+template<typename T, typename U>
+void ListHashSet<T, U>::insertNodeBefore(Node* beforeNode, Node* newNode)
 {
     if (!beforeNode)
         return appendNode(newNode);
@@ -776,24 +682,24 @@
         m_head = newNode;
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-void ListHashSet<T, inlineCapacity, U>::deleteAllNodes()
+template<typename T, typename U>
+void ListHashSet<T, U>::deleteAllNodes()
 {
     if (!m_head)
         return;
 
     for (Node* node = m_head, *next = m_head->m_next; node; node = next, next = node ? node->m_next : 0)
-        node->destroy(m_allocator.get());
+        delete node;
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-inline auto ListHashSet<T, inlineCapacity, U>::makeIterator(Node* position) -> iterator
+template<typename T, typename U>
+inline auto ListHashSet<T, U>::makeIterator(Node* position) -> iterator
 {
     return iterator(this, position);
 }
 
-template<typename T, size_t inlineCapacity, typename U>
-inline auto ListHashSet<T, inlineCapacity, U>::makeConstIterator(Node* position) const -> const_iterator
+template<typename T, typename U>
+inline auto ListHashSet<T, U>::makeConstIterator(Node* position) const -> const_iterator
 { 
     return const_iterator(this, position);
 }

Modified: trunk/Source/WebCore/ChangeLog (176289 => 176290)


--- trunk/Source/WebCore/ChangeLog	2014-11-18 22:57:43 UTC (rev 176289)
+++ trunk/Source/WebCore/ChangeLog	2014-11-18 23:06:00 UTC (rev 176290)
@@ -1,3 +1,21 @@
+2014-11-18  Geoffrey Garen  <[email protected]>
+
+        Removed the custom allocator for ListHashSet nodes
+        https://bugs.webkit.org/show_bug.cgi?id=138841
+
+        Reviewed by Andreas Kling.
+
+        Uses of ListHashSet no longer need to declare an inline capacity,
+        since that was only used to specify the capacity of the custom allocator.
+
+        * dom/DOMNamedFlowCollection.h:
+        * dom/DocumentEventQueue.h:
+        * dom/DocumentStyleSheetCollection.h:
+        * dom/NamedFlowCollection.h:
+        * html/FormController.h:
+        * rendering/FloatingObjects.h:
+        * rendering/RenderBlock.h:
+
 2014-11-18  David Hyatt  <[email protected]>
 
         REGRESSION(r152313): Inline-block element doesn't wrap properly

Modified: trunk/Source/WebCore/dom/DOMNamedFlowCollection.h (176289 => 176290)


--- trunk/Source/WebCore/dom/DOMNamedFlowCollection.h	2014-11-18 22:57:43 UTC (rev 176289)
+++ trunk/Source/WebCore/dom/DOMNamedFlowCollection.h	2014-11-18 23:06:00 UTC (rev 176290)
@@ -57,7 +57,7 @@
     struct DOMNamedFlowHashFunctions;
     struct DOMNamedFlowHashTranslator;
 
-    typedef ListHashSet<RefPtr<WebKitNamedFlow>, 1, DOMNamedFlowHashFunctions> DOMNamedFlowSet;
+    typedef ListHashSet<RefPtr<WebKitNamedFlow>, DOMNamedFlowHashFunctions> DOMNamedFlowSet;
     explicit DOMNamedFlowCollection(const Vector<WebKitNamedFlow*>&);
     DOMNamedFlowSet m_namedFlows;
 };

Modified: trunk/Source/WebCore/dom/DocumentEventQueue.h (176289 => 176290)


--- trunk/Source/WebCore/dom/DocumentEventQueue.h	2014-11-18 22:57:43 UTC (rev 176289)
+++ trunk/Source/WebCore/dom/DocumentEventQueue.h	2014-11-18 23:06:00 UTC (rev 176290)
@@ -58,7 +58,7 @@
 
     Document& m_document;
     std::unique_ptr<Timer> m_pendingEventTimer;
-    ListHashSet<RefPtr<Event>, 16> m_queuedEvents;
+    ListHashSet<RefPtr<Event>> m_queuedEvents;
     HashSet<Node*> m_nodesWithQueuedScrollEvents;
     bool m_isClosed;
 };

Modified: trunk/Source/WebCore/dom/DocumentStyleSheetCollection.h (176289 => 176290)


--- trunk/Source/WebCore/dom/DocumentStyleSheetCollection.h	2014-11-18 22:57:43 UTC (rev 176289)
+++ trunk/Source/WebCore/dom/DocumentStyleSheetCollection.h	2014-11-18 23:06:00 UTC (rev 176290)
@@ -152,7 +152,7 @@
     bool m_hadActiveLoadingStylesheet;
     UpdateFlag m_pendingUpdateType;
 
-    typedef ListHashSet<Node*, 32> StyleSheetCandidateListHashSet;
+    typedef ListHashSet<Node*> StyleSheetCandidateListHashSet;
     StyleSheetCandidateListHashSet m_styleSheetCandidateNodes;
 
     String m_preferredStylesheetSetName;

Modified: trunk/Source/WebCore/dom/NamedFlowCollection.h (176289 => 176290)


--- trunk/Source/WebCore/dom/NamedFlowCollection.h	2014-11-18 22:57:43 UTC (rev 176289)
+++ trunk/Source/WebCore/dom/NamedFlowCollection.h	2014-11-18 23:06:00 UTC (rev 176290)
@@ -63,7 +63,7 @@
     struct NamedFlowHashFunctions;
     struct NamedFlowHashTranslator;
 
-    typedef ListHashSet<WebKitNamedFlow*, 1, NamedFlowHashFunctions> NamedFlowSet;
+    typedef ListHashSet<WebKitNamedFlow*, NamedFlowHashFunctions> NamedFlowSet;
 
     explicit NamedFlowCollection(Document*);
 

Modified: trunk/Source/WebCore/html/FormController.h (176289 => 176290)


--- trunk/Source/WebCore/html/FormController.h	2014-11-18 22:57:43 UTC (rev 176289)
+++ trunk/Source/WebCore/html/FormController.h	2014-11-18 23:06:00 UTC (rev 176290)
@@ -95,7 +95,7 @@
     WEBCORE_EXPORT static Vector<String> getReferencedFilePaths(const Vector<String>& stateVector);
 
 private:
-    typedef ListHashSet<RefPtr<HTMLFormControlElementWithState>, 64> FormElementListHashSet;
+    typedef ListHashSet<RefPtr<HTMLFormControlElementWithState>> FormElementListHashSet;
     typedef HashMap<RefPtr<AtomicStringImpl>, std::unique_ptr<SavedFormState>> SavedFormStateMap;
 
     static std::unique_ptr<SavedFormStateMap> createSavedFormStateMap(const FormElementListHashSet&);

Modified: trunk/Source/WebCore/rendering/FloatingObjects.h (176289 => 176290)


--- trunk/Source/WebCore/rendering/FloatingObjects.h	2014-11-18 22:57:43 UTC (rev 176289)
+++ trunk/Source/WebCore/rendering/FloatingObjects.h	2014-11-18 23:06:00 UTC (rev 176290)
@@ -111,7 +111,7 @@
     static bool equal(const std::unique_ptr<FloatingObject>& a, const FloatingObject& b) { return &a->renderer() == &b.renderer(); }
 };
 
-typedef ListHashSet<std::unique_ptr<FloatingObject>, 4, FloatingObjectHashFunctions> FloatingObjectSet;
+typedef ListHashSet<std::unique_ptr<FloatingObject>, FloatingObjectHashFunctions> FloatingObjectSet;
 
 typedef PODInterval<LayoutUnit, FloatingObject*> FloatingObjectInterval;
 typedef PODIntervalTree<LayoutUnit, FloatingObject*> FloatingObjectTree;

Modified: trunk/Source/WebCore/rendering/RenderBlock.h (176289 => 176290)


--- trunk/Source/WebCore/rendering/RenderBlock.h	2014-11-18 22:57:43 UTC (rev 176289)
+++ trunk/Source/WebCore/rendering/RenderBlock.h	2014-11-18 23:06:00 UTC (rev 176290)
@@ -40,7 +40,7 @@
 struct BidiRun;
 struct PaintInfo;
 
-typedef WTF::ListHashSet<RenderBox*, 16> TrackedRendererListHashSet;
+typedef WTF::ListHashSet<RenderBox*> TrackedRendererListHashSet;
 typedef WTF::HashMap<const RenderBlock*, std::unique_ptr<TrackedRendererListHashSet>> TrackedDescendantsMap;
 typedef WTF::HashMap<const RenderBox*, std::unique_ptr<HashSet<RenderBlock*>>> TrackedContainerMap;
 

Modified: trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in (176289 => 176290)


--- trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in	2014-11-18 22:57:43 UTC (rev 176289)
+++ trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in	2014-11-18 23:06:00 UTC (rev 176290)
@@ -259,7 +259,7 @@
         symbolWithPointer(?pageNumberForElement@PrintContext@WebCore@@SAHPAVElement@2@ABVFloatSize@2@@Z, ?pageNumberForElement@PrintContext@WebCore@@SAHPEAVElement@2@AEBVFloatSize@2@@Z)
         symbolWithPointer(?paintControlTints@FrameView@WebCore@@AAEXXZ, ?paintControlTints@FrameView@WebCore@@AEAAXXZ)
         symbolWithPointer(?rangeFromLocationAndLength@TextIterator@WebCore@@SA?AV?$PassRefPtr@VRange@WebCore@@@WTF@@PAVContainerNode@2@HH_N@Z, ?rangeFromLocationAndLength@TextIterator@WebCore@@SA?AV?$PassRefPtr@VRange@WebCore@@@WTF@@PEAVContainerNode@2@HH_N@Z)
-        symbolWithPointer(?rectBasedTestResult@HitTestResult@WebCore@@QBEABV?$ListHashSet@V?$RefPtr@VNode@WebCore@@@WTF@@$0BAA@U?$PtrHash@V?$RefPtr@VNode@WebCore@@@WTF@@@2@@WTF@@XZ, ?rectBasedTestResult@HitTestResult@WebCore@@QEBAAEBV?$ListHashSet@V?$RefPtr@VNode@WebCore@@@WTF@@$0BAA@U?$PtrHash@V?$RefPtr@VNode@WebCore@@@WTF@@@2@@WTF@@XZ)
+        symbolWithPointer(?rectBasedTestResult@HitTestResult@WebCore@@QBEABV?$ListHashSet@V?$RefPtr@VNode@WebCore@@@WTF@@U?$PtrHash@V?$RefPtr@VNode@WebCore@@@WTF@@@2@@WTF@@XZ, )
         symbolWithPointer(?rectForPoint@HitTestLocation@WebCore@@SA?AVIntRect@2@ABVLayoutPoint@2@IIII@Z, ?rectForPoint@HitTestLocation@WebCore@@SA?AVIntRect@2@AEBVLayoutPoint@2@IIII@Z)
         symbolWithPointer(?reload@FrameLoader@WebCore@@QAEX_N@Z, ?reload@FrameLoader@WebCore@@QEAAX_N@Z)
         symbolWithPointer(?remove@String@WTF@@QAEXIH@Z, ?remove@String@WTF@@QEAAXIH@Z)

Modified: trunk/Source/WebKit2/ChangeLog (176289 => 176290)


--- trunk/Source/WebKit2/ChangeLog	2014-11-18 22:57:43 UTC (rev 176289)
+++ trunk/Source/WebKit2/ChangeLog	2014-11-18 23:06:00 UTC (rev 176290)
@@ -1,3 +1,16 @@
+2014-11-18  Geoffrey Garen  <[email protected]>
+
+        Removed the custom allocator for ListHashSet nodes
+        https://bugs.webkit.org/show_bug.cgi?id=138841
+
+        Reviewed by Andreas Kling.
+
+        Uses of ListHashSet no longer need to declare an inline capacity,
+        since that was only used to specify the capacity of the custom allocator.
+
+        * UIProcess/Plugins/PluginInfoStore.cpp:
+        (WebKit::PluginInfoStore::loadPluginsIfNecessary):
+
 2014-11-18  Eric Carlson  <[email protected]>
 
         Unreviewed build fix after r176283.

Modified: trunk/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp (176289 => 176290)


--- trunk/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp	2014-11-18 22:57:43 UTC (rev 176289)
+++ trunk/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp	2014-11-18 23:06:00 UTC (rev 176290)
@@ -68,7 +68,7 @@
     if (m_pluginListIsUpToDate)
         return;
 
-    ListHashSet<String, 32> uniquePluginPaths;
+    ListHashSet<String> uniquePluginPaths;
 
     // First, load plug-ins from the additional plug-ins directories specified.
     for (size_t i = 0; i < m_additionalPluginsDirectories.size(); ++i)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to