diff options
author | Jocelyn Turcotte <jocelyn.turcotte@nokia.com> | 2010-04-06 10:36:47 (GMT) |
---|---|---|
committer | Jocelyn Turcotte <jocelyn.turcotte@nokia.com> | 2010-04-06 10:36:47 (GMT) |
commit | bb35b65bbfba82e0dd0ac306d3dab54436cdaff6 (patch) | |
tree | 8174cb262a960ff7b2e4aa8f1aaf154db71d2636 /src/3rdparty/webkit/JavaScriptCore/wtf/HashTable.h | |
parent | 4b27d0d887269583a0f76e922948f8c25e96ab88 (diff) | |
download | Qt-bb35b65bbfba82e0dd0ac306d3dab54436cdaff6.zip Qt-bb35b65bbfba82e0dd0ac306d3dab54436cdaff6.tar.gz Qt-bb35b65bbfba82e0dd0ac306d3dab54436cdaff6.tar.bz2 |
Update src/3rdparty/webkit from trunk.
Imported from 839d8709327f925aacb3b6362c06152594def97e
in branch qtwebkit-2.0 of repository
git://gitorious.org/+qtwebkit-developers/webkit/qtwebkit.git
Rubber-stamped-by: Simon Hausmann
Diffstat (limited to 'src/3rdparty/webkit/JavaScriptCore/wtf/HashTable.h')
-rw-r--r-- | src/3rdparty/webkit/JavaScriptCore/wtf/HashTable.h | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/HashTable.h b/src/3rdparty/webkit/JavaScriptCore/wtf/HashTable.h index 3b283f8..ceb8963 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/HashTable.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/HashTable.h @@ -24,12 +24,14 @@ #include "FastMalloc.h" #include "HashTraits.h" +#include "ValueCheck.h" #include <wtf/Assertions.h> #include <wtf/Threading.h> namespace WTF { #define DUMP_HASHTABLE_STATS 0 +// Enables internal WTF consistency checks that are invoked automatically. Non-WTF callers can call checkTableConsistency() even if internal checks are disabled. #define CHECK_HASHTABLE_CONSISTENCY 0 #ifdef NDEBUG @@ -197,7 +199,7 @@ namespace WTF { void checkValidity(const const_iterator& other) const { ASSERT(m_table); - ASSERT(other.m_table); + ASSERT_UNUSED(other, other.m_table); ASSERT(m_table == other.m_table); } #else @@ -340,11 +342,18 @@ namespace WTF { ValueType* lookup(const Key& key) { return lookup<Key, IdentityTranslatorType>(key); } template<typename T, typename HashTranslator> ValueType* lookup(const T&); -#if CHECK_HASHTABLE_CONSISTENCY +#if !ASSERT_DISABLED void checkTableConsistency() const; #else static void checkTableConsistency() { } #endif +#if CHECK_HASHTABLE_CONSISTENCY + void internalCheckTableConsistency() const { checkTableConsistency(); } + void internalCheckTableConsistencyExceptSize() const { checkTableConsistencyExceptSize(); } +#else + static void internalCheckTableConsistencyExceptSize() { } + static void internalCheckTableConsistency() { } +#endif private: static ValueType* allocateTable(int size); @@ -383,7 +392,7 @@ namespace WTF { iterator makeKnownGoodIterator(ValueType* pos) { return iterator(this, pos, m_table + m_tableSize, HashItemKnownGood); } const_iterator makeKnownGoodConstIterator(ValueType* pos) const { return const_iterator(this, pos, m_table + m_tableSize, HashItemKnownGood); } -#if CHECK_HASHTABLE_CONSISTENCY +#if !ASSERT_DISABLED void checkTableConsistencyExceptSize() const; #else static void checkTableConsistencyExceptSize() { } @@ -624,7 +633,7 @@ namespace WTF { if (!m_table) expand(); - checkTableConsistency(); + internalCheckTableConsistency(); ASSERT(m_table); @@ -693,7 +702,7 @@ namespace WTF { return p; } - checkTableConsistency(); + internalCheckTableConsistency(); return std::make_pair(makeKnownGoodIterator(entry), true); } @@ -709,7 +718,7 @@ namespace WTF { if (!m_table) expand(); - checkTableConsistency(); + internalCheckTableConsistency(); FullLookupType lookupResult = fullLookupForWriting<T, HashTranslator>(key); @@ -738,7 +747,7 @@ namespace WTF { return p; } - checkTableConsistency(); + internalCheckTableConsistency(); return std::make_pair(makeKnownGoodIterator(entry), true); } @@ -805,7 +814,7 @@ namespace WTF { void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::removeAndInvalidate(ValueType* pos) { invalidateIterators(); - checkTableConsistency(); + internalCheckTableConsistency(); remove(pos); } @@ -823,7 +832,7 @@ namespace WTF { if (shouldShrink()) shrink(); - checkTableConsistency(); + internalCheckTableConsistency(); } template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits> @@ -892,7 +901,7 @@ namespace WTF { template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits> void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::rehash(int newTableSize) { - checkTableConsistencyExceptSize(); + internalCheckTableConsistencyExceptSize(); int oldTableSize = m_tableSize; ValueType* oldTable = m_table; @@ -914,7 +923,7 @@ namespace WTF { deallocateTable(oldTable, oldTableSize); - checkTableConsistency(); + internalCheckTableConsistency(); } template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits> @@ -981,13 +990,13 @@ namespace WTF { return *this; } -#if CHECK_HASHTABLE_CONSISTENCY +#if !ASSERT_DISABLED template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits> void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::checkTableConsistency() const { checkTableConsistencyExceptSize(); - ASSERT(!shouldExpand()); + ASSERT(!m_table || !shouldExpand()); ASSERT(!shouldShrink()); } @@ -1012,6 +1021,8 @@ namespace WTF { const_iterator it = find(Extractor::extract(*entry)); ASSERT(entry == it.m_position); ++count; + + ValueCheck<Key>::checkConsistency(it->first); } ASSERT(count == m_keyCount); @@ -1021,7 +1032,7 @@ namespace WTF { ASSERT(m_tableSize == m_tableSizeMask + 1); } -#endif // CHECK_HASHTABLE_CONSISTENCY +#endif // ASSERT_DISABLED #if CHECK_HASHTABLE_ITERATORS |