OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights reserv
ed. |
3 * Copyright (C) 2008 David Levin <levin@chromium.org> | 3 * Copyright (C) 2008 David Levin <levin@chromium.org> |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 HashTableType* table = reinterpret_cast<HashTableType*>(closure); | 1113 HashTableType* table = reinterpret_cast<HashTableType*>(closure); |
1114 if (table->m_table) { | 1114 if (table->m_table) { |
1115 // This just marks it live and does not push anything onto the | 1115 // This just marks it live and does not push anything onto the |
1116 // marking stack. | 1116 // marking stack. |
1117 Allocator::markNoTracing(visitor, table->m_table); | 1117 Allocator::markNoTracing(visitor, table->m_table); |
1118 // Now perform weak processing (this is a no-op if the backing | 1118 // Now perform weak processing (this is a no-op if the backing |
1119 // was accessible through an iterator and was already marked | 1119 // was accessible through an iterator and was already marked |
1120 // strongly). | 1120 // strongly). |
1121 for (typename HashTableType::ValueType* element = table->m_table
+ table->m_tableSize - 1; element >= table->m_table; element--) { | 1121 for (typename HashTableType::ValueType* element = table->m_table
+ table->m_tableSize - 1; element >= table->m_table; element--) { |
1122 if (!HashTableType::isEmptyOrDeletedBucket(*element)) { | 1122 if (!HashTableType::isEmptyOrDeletedBucket(*element)) { |
1123 if (Allocator::hasDeadMember(visitor, *element)) { | 1123 if (Traits::shouldRemoveFromCollection(visitor, *element
)) { |
1124 table->registerModification(); | 1124 table->registerModification(); |
1125 HashTableType::deleteBucket(*element); // Also calls
the destructor. | 1125 HashTableType::deleteBucket(*element); // Also calls
the destructor. |
1126 table->m_deletedCount++; | 1126 table->m_deletedCount++; |
1127 table->m_keyCount--; | 1127 table->m_keyCount--; |
1128 // We don't rehash the backing until the next add | 1128 // We don't rehash the backing until the next add |
1129 // or delete, because that would cause allocation | 1129 // or delete, because that would cause allocation |
1130 // during GC. | 1130 // during GC. |
1131 } | 1131 } |
1132 } | 1132 } |
1133 } | 1133 } |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1267 CollectionIterator end(toBeRemoved.end()); | 1267 CollectionIterator end(toBeRemoved.end()); |
1268 for (CollectionIterator it(toBeRemoved.begin()); it != end; ++it) | 1268 for (CollectionIterator it(toBeRemoved.begin()); it != end; ++it) |
1269 collection.remove(*it); | 1269 collection.remove(*it); |
1270 } | 1270 } |
1271 | 1271 |
1272 } // namespace WTF | 1272 } // namespace WTF |
1273 | 1273 |
1274 #include "wtf/HashIterators.h" | 1274 #include "wtf/HashIterators.h" |
1275 | 1275 |
1276 #endif // WTF_HashTable_h | 1276 #endif // WTF_HashTable_h |
OLD | NEW |