| Index: Source/wtf/HashTable.h
|
| diff --git a/Source/wtf/HashTable.h b/Source/wtf/HashTable.h
|
| index ba73d847e928a918327f17c1d82cc7d3a5838e49..4e30b610ea93554a10575a9da6268111a7584b3e 100644
|
| --- a/Source/wtf/HashTable.h
|
| +++ b/Source/wtf/HashTable.h
|
| @@ -69,6 +69,9 @@
|
|
|
| namespace WTF {
|
|
|
| +// Custom secondary hash function.
|
| +unsigned doubleHash(unsigned key);
|
| +
|
| #if DUMP_HASHTABLE_STATS
|
|
|
| struct HashTableStats {
|
| @@ -246,12 +249,12 @@ namespace WTF {
|
| using std::swap;
|
|
|
| // Work around MSVC's standard library, whose swap for pairs does not swap by component.
|
| - template<typename T> inline void hashTableSwap(T& a, T& b)
|
| + template<typename T> void hashTableSwap(T& a, T& b)
|
| {
|
| swap(a, b);
|
| }
|
|
|
| - template<typename T, typename U> inline void hashTableSwap(KeyValuePair<T, U>& a, KeyValuePair<T, U>& b)
|
| + template<typename T, typename U> void hashTableSwap(KeyValuePair<T, U>& a, KeyValuePair<T, U>& b)
|
| {
|
| swap(a.key, b.key);
|
| swap(a.value, b.value);
|
| @@ -606,7 +609,7 @@ namespace WTF {
|
| };
|
|
|
| template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits, typename Allocator>
|
| - inline HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::HashTable()
|
| + HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::HashTable()
|
| : m_table(0)
|
| , m_tableSize(0)
|
| , m_keyCount(0)
|
| @@ -621,26 +624,16 @@ namespace WTF {
|
| {
|
| }
|
|
|
| - inline unsigned doubleHash(unsigned key)
|
| - {
|
| - key = ~key + (key >> 23);
|
| - key ^= (key << 12);
|
| - key ^= (key >> 7);
|
| - key ^= (key << 2);
|
| - key ^= (key >> 20);
|
| - return key;
|
| - }
|
| -
|
| template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits, typename Allocator>
|
| template<typename HashTranslator, typename T>
|
| - inline Value* HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::lookup(T key)
|
| + Value* HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::lookup(T key)
|
| {
|
| return const_cast<Value*>(const_cast<const HashTable*>(this)->lookup<HashTranslator, T>(key));
|
| }
|
|
|
| template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits, typename Allocator>
|
| template<typename HashTranslator, typename T>
|
| - inline const Value* HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::lookup(T key) const
|
| + const Value* HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::lookup(T key) const
|
| {
|
| ASSERT((HashTableKeyChecker<HashTranslator, KeyTraits, HashFunctions::safeToCompareToEmptyOrDeleted>::checkKey(key)));
|
| const ValueType* table = m_table;
|
| @@ -679,7 +672,7 @@ namespace WTF {
|
|
|
| template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits, typename Allocator>
|
| template<typename HashTranslator, typename T>
|
| - inline typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::LookupType HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::lookupForWriting(const T& key)
|
| + typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::LookupType HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::lookupForWriting(const T& key)
|
| {
|
| ASSERT(m_table);
|
| registerModification();
|
| @@ -721,7 +714,7 @@ namespace WTF {
|
|
|
| template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits, typename Allocator>
|
| template<typename HashTranslator, typename T>
|
| - inline typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::FullLookupType HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::fullLookupForWriting(const T& key)
|
| + typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::FullLookupType HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::fullLookupForWriting(const T& key)
|
| {
|
| ASSERT(m_table);
|
| registerModification();
|
| @@ -781,7 +774,7 @@ namespace WTF {
|
| };
|
|
|
| template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits, typename Allocator>
|
| - inline void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::initializeBucket(ValueType& bucket)
|
| + void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::initializeBucket(ValueType& bucket)
|
| {
|
| // For hash maps the key and value cannot be initialied simultaneously,
|
| // and it would be wrong to have a GC when only one was initialized and
|
| @@ -913,7 +906,7 @@ namespace WTF {
|
|
|
| template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits, typename Allocator>
|
| template <typename HashTranslator, typename T>
|
| - inline typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::iterator HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::find(const T& key)
|
| + typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::iterator HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::find(const T& key)
|
| {
|
| ValueType* entry = lookup<HashTranslator>(key);
|
| if (!entry)
|
| @@ -924,7 +917,7 @@ namespace WTF {
|
|
|
| template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits, typename Allocator>
|
| template <typename HashTranslator, typename T>
|
| - inline typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::const_iterator HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::find(const T& key) const
|
| + typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::const_iterator HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::find(const T& key) const
|
| {
|
| ValueType* entry = const_cast<HashTable*>(this)->lookup<HashTranslator>(key);
|
| if (!entry)
|
| @@ -960,7 +953,7 @@ namespace WTF {
|
| }
|
|
|
| template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits, typename Allocator>
|
| - inline void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::remove(iterator it)
|
| + void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::remove(iterator it)
|
| {
|
| if (it == end())
|
| return;
|
| @@ -969,7 +962,7 @@ namespace WTF {
|
| }
|
|
|
| template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits, typename Allocator>
|
| - inline void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::remove(const_iterator it)
|
| + void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::remove(const_iterator it)
|
| {
|
| if (it == end())
|
| return;
|
| @@ -978,7 +971,7 @@ namespace WTF {
|
| }
|
|
|
| template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits, typename Allocator>
|
| - inline void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::remove(KeyPeekInType key)
|
| + void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::remove(KeyPeekInType key)
|
| {
|
| remove(find(key));
|
| }
|
| @@ -1323,56 +1316,56 @@ namespace WTF {
|
| };
|
|
|
| template<typename T, typename U>
|
| - inline bool operator==(const HashTableConstIteratorAdapter<T, U>& a, const HashTableConstIteratorAdapter<T, U>& b)
|
| + bool operator==(const HashTableConstIteratorAdapter<T, U>& a, const HashTableConstIteratorAdapter<T, U>& b)
|
| {
|
| return a.m_impl == b.m_impl;
|
| }
|
|
|
| template<typename T, typename U>
|
| - inline bool operator!=(const HashTableConstIteratorAdapter<T, U>& a, const HashTableConstIteratorAdapter<T, U>& b)
|
| + bool operator!=(const HashTableConstIteratorAdapter<T, U>& a, const HashTableConstIteratorAdapter<T, U>& b)
|
| {
|
| return a.m_impl != b.m_impl;
|
| }
|
|
|
| template<typename T, typename U>
|
| - inline bool operator==(const HashTableIteratorAdapter<T, U>& a, const HashTableIteratorAdapter<T, U>& b)
|
| + bool operator==(const HashTableIteratorAdapter<T, U>& a, const HashTableIteratorAdapter<T, U>& b)
|
| {
|
| return a.m_impl == b.m_impl;
|
| }
|
|
|
| template<typename T, typename U>
|
| - inline bool operator!=(const HashTableIteratorAdapter<T, U>& a, const HashTableIteratorAdapter<T, U>& b)
|
| + bool operator!=(const HashTableIteratorAdapter<T, U>& a, const HashTableIteratorAdapter<T, U>& b)
|
| {
|
| return a.m_impl != b.m_impl;
|
| }
|
|
|
| // All 4 combinations of ==, != and Const,non const.
|
| template<typename T, typename U>
|
| - inline bool operator==(const HashTableConstIteratorAdapter<T, U>& a, const HashTableIteratorAdapter<T, U>& b)
|
| + bool operator==(const HashTableConstIteratorAdapter<T, U>& a, const HashTableIteratorAdapter<T, U>& b)
|
| {
|
| return a.m_impl == b.m_impl;
|
| }
|
|
|
| template<typename T, typename U>
|
| - inline bool operator!=(const HashTableConstIteratorAdapter<T, U>& a, const HashTableIteratorAdapter<T, U>& b)
|
| + bool operator!=(const HashTableConstIteratorAdapter<T, U>& a, const HashTableIteratorAdapter<T, U>& b)
|
| {
|
| return a.m_impl != b.m_impl;
|
| }
|
|
|
| template<typename T, typename U>
|
| - inline bool operator==(const HashTableIteratorAdapter<T, U>& a, const HashTableConstIteratorAdapter<T, U>& b)
|
| + bool operator==(const HashTableIteratorAdapter<T, U>& a, const HashTableConstIteratorAdapter<T, U>& b)
|
| {
|
| return a.m_impl == b.m_impl;
|
| }
|
|
|
| template<typename T, typename U>
|
| - inline bool operator!=(const HashTableIteratorAdapter<T, U>& a, const HashTableConstIteratorAdapter<T, U>& b)
|
| + bool operator!=(const HashTableIteratorAdapter<T, U>& a, const HashTableConstIteratorAdapter<T, U>& b)
|
| {
|
| return a.m_impl != b.m_impl;
|
| }
|
|
|
| template<typename Collection1, typename Collection2>
|
| - inline void removeAll(Collection1& collection, const Collection2& toBeRemoved)
|
| + void removeAll(Collection1& collection, const Collection2& toBeRemoved)
|
| {
|
| if (collection.isEmpty() || toBeRemoved.isEmpty())
|
| return;
|
|
|