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 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1249 ASSERT(visitor->isAlive(table->m_table)); | 1249 ASSERT(visitor->isAlive(table->m_table)); |
1250 // Now perform weak processing (this is a no-op if the backing | 1250 // Now perform weak processing (this is a no-op if the backing |
1251 // was accessible through an iterator and was already marked | 1251 // was accessible through an iterator and was already marked |
1252 // strongly). | 1252 // strongly). |
1253 typedef typename HashTableType::ValueType ValueType; | 1253 typedef typename HashTableType::ValueType ValueType; |
1254 for (ValueType* element = table->m_table + table->m_tableSize - 1; element >= table->m_table; element--) { | 1254 for (ValueType* element = table->m_table + table->m_tableSize - 1; element >= table->m_table; element--) { |
1255 if (!HashTableType::isEmptyOrDeletedBucket(*element)) { | 1255 if (!HashTableType::isEmptyOrDeletedBucket(*element)) { |
1256 // At this stage calling trace can make no difference | 1256 // At this stage calling trace can make no difference |
1257 // (everything is already traced), but we use the | 1257 // (everything is already traced), but we use the |
1258 // return value to remove things from the collection. | 1258 // return value to remove things from the collection. |
1259 if (TraceInCollectionTrait<WeakHandlingInCollections, We akPointersActWeak, ValueType, Traits>::trace(visitor, *element)) { | 1259 #if ENABLE(ASSERT) |
1260 visitor->setAllowTraceForHashTableWeakProcessing(true); | |
haraken
2015/01/13 07:55:53
Add a FIXME to remove this.
BTW, do you really ne
kouhei (in TOK)
2015/01/14 02:10:05
Done.
| |
1261 #endif | |
1262 bool elementIsDead = TraceInCollectionTrait<WeakHandling InCollections, WeakPointersActWeak, ValueType, Traits>::trace(visitor, *element) ; | |
1263 #if ENABLE(ASSERT) | |
1264 visitor->setAllowTraceForHashTableWeakProcessing(false); | |
1265 #endif | |
1266 if (elementIsDead) { | |
1260 table->registerModification(); | 1267 table->registerModification(); |
1261 HashTableType::deleteBucket(*element); // Also calls the destructor. | 1268 HashTableType::deleteBucket(*element); // Also calls the destructor. |
1262 table->m_deletedCount++; | 1269 table->m_deletedCount++; |
1263 table->m_keyCount--; | 1270 table->m_keyCount--; |
1264 // We don't rehash the backing until the next add | 1271 // We don't rehash the backing until the next add |
1265 // or delete, because that would cause allocation | 1272 // or delete, because that would cause allocation |
1266 // during GC. | 1273 // during GC. |
1267 } | 1274 } |
1268 } | 1275 } |
1269 } | 1276 } |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1455 CollectionIterator end(toBeRemoved.end()); | 1462 CollectionIterator end(toBeRemoved.end()); |
1456 for (CollectionIterator it(toBeRemoved.begin()); it != end; ++it) | 1463 for (CollectionIterator it(toBeRemoved.begin()); it != end; ++it) |
1457 collection.remove(*it); | 1464 collection.remove(*it); |
1458 } | 1465 } |
1459 | 1466 |
1460 } // namespace WTF | 1467 } // namespace WTF |
1461 | 1468 |
1462 #include "wtf/HashIterators.h" | 1469 #include "wtf/HashIterators.h" |
1463 | 1470 |
1464 #endif // WTF_HashTable_h | 1471 #endif // WTF_HashTable_h |
OLD | NEW |