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, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABIL
ITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public L
icense for more details. | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABIL
ITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public L
icense for more details. |
12 * | 12 * |
13 * You should have received a copy of the GNU Library General Public License | 13 * You should have received a copy of the GNU Library General Public License |
14 * along with this library; see the file COPYING.LIB. If not, write to | 14 * along with this library; see the file COPYING.LIB. If not, write to |
15 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 15 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
16 * Boston, MA 02110-1301, USA. | 16 * Boston, MA 02110-1301, USA. |
17 * | 17 * |
18 */ | 18 */ |
19 | 19 |
20 #ifndef WTF_HashTable_h | 20 #ifndef WTF_HashTable_h |
21 #define WTF_HashTable_h | 21 #define WTF_HashTable_h |
22 | 22 |
23 #include "wtf/Alignment.h" | 23 #include "wtf/Alignment.h" |
24 #include "wtf/Assertions.h" | 24 #include "wtf/Assertions.h" |
25 #include "wtf/ConditionalDestructor.h" | 25 #include "wtf/ConditionalDestructor.h" |
26 #include "wtf/DefaultAllocator.h" | |
27 #include "wtf/HashTraits.h" | 26 #include "wtf/HashTraits.h" |
| 27 #include "wtf/PartitionAllocator.h" |
28 | 28 |
29 #define DUMP_HASHTABLE_STATS 0 | 29 #define DUMP_HASHTABLE_STATS 0 |
30 #define DUMP_HASHTABLE_STATS_PER_TABLE 0 | 30 #define DUMP_HASHTABLE_STATS_PER_TABLE 0 |
31 | 31 |
32 #if DUMP_HASHTABLE_STATS_PER_TABLE | 32 #if DUMP_HASHTABLE_STATS_PER_TABLE |
33 #include "wtf/DataLog.h" | 33 #include "wtf/DataLog.h" |
34 #endif | 34 #endif |
35 | 35 |
36 #if DUMP_HASHTABLE_STATS | 36 #if DUMP_HASHTABLE_STATS |
37 #if DUMP_HASHTABLE_STATS_PER_TABLE | 37 #if DUMP_HASHTABLE_STATS_PER_TABLE |
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 atomicIncrement(&HashTableStats::numRehashes); | 1155 atomicIncrement(&HashTableStats::numRehashes); |
1156 #endif | 1156 #endif |
1157 | 1157 |
1158 #if DUMP_HASHTABLE_STATS_PER_TABLE | 1158 #if DUMP_HASHTABLE_STATS_PER_TABLE |
1159 if (oldTableSize != 0) | 1159 if (oldTableSize != 0) |
1160 ++m_stats->numRehashes; | 1160 ++m_stats->numRehashes; |
1161 #endif | 1161 #endif |
1162 | 1162 |
1163 // The Allocator::isGarbageCollected check is not needed. The check is just | 1163 // The Allocator::isGarbageCollected check is not needed. The check is just |
1164 // a static hint for a compiler to indicate that Base::expandBuffer returns | 1164 // a static hint for a compiler to indicate that Base::expandBuffer returns |
1165 // false if Allocator is a DefaultAllocator. | 1165 // false if Allocator is a PartitionAllocator. |
1166 if (Allocator::isGarbageCollected && newTableSize > oldTableSize) { | 1166 if (Allocator::isGarbageCollected && newTableSize > oldTableSize) { |
1167 bool success; | 1167 bool success; |
1168 Value* newEntry = expandBuffer(newTableSize, entry, success); | 1168 Value* newEntry = expandBuffer(newTableSize, entry, success); |
1169 if (success) | 1169 if (success) |
1170 return newEntry; | 1170 return newEntry; |
1171 } | 1171 } |
1172 | 1172 |
1173 ValueType* newTable = allocateTable(newTableSize); | 1173 ValueType* newTable = allocateTable(newTableSize); |
1174 Value* newEntry = rehashTo(newTable, newTableSize, entry); | 1174 Value* newEntry = rehashTo(newTable, newTableSize, entry); |
1175 | 1175 |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1487 CollectionIterator end(toBeRemoved.end()); | 1487 CollectionIterator end(toBeRemoved.end()); |
1488 for (CollectionIterator it(toBeRemoved.begin()); it != end; ++it) | 1488 for (CollectionIterator it(toBeRemoved.begin()); it != end; ++it) |
1489 collection.remove(*it); | 1489 collection.remove(*it); |
1490 } | 1490 } |
1491 | 1491 |
1492 } // namespace WTF | 1492 } // namespace WTF |
1493 | 1493 |
1494 #include "wtf/HashIterators.h" | 1494 #include "wtf/HashIterators.h" |
1495 | 1495 |
1496 #endif // WTF_HashTable_h | 1496 #endif // WTF_HashTable_h |
OLD | NEW |