Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Side by Side Diff: Source/wtf/HashTable.h

Issue 824513004: ASSERT that Visitor::mark is only called when inGC() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: m_visitor Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/platform/heap/Visitor.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
1260 // FIXME: This should be rewritten so that this can chec k
1261 // if the element is dead without calling trace,
1262 // which is semantically not correct to be called in
1263 // weak processing stage.
1264 #if ENABLE(ASSERT)
1265 visitor->setAllowMarkingForHashTableWeakProcessing(true) ;
1266 #endif
1267 bool elementIsDead = TraceInCollectionTrait<WeakHandling InCollections, WeakPointersActWeak, ValueType, Traits>::trace(visitor, *element) ;
1268 #if ENABLE(ASSERT)
1269 visitor->setAllowMarkingForHashTableWeakProcessing(false );
1270 #endif
1271 if (elementIsDead) {
1260 table->registerModification(); 1272 table->registerModification();
1261 HashTableType::deleteBucket(*element); // Also calls the destructor. 1273 HashTableType::deleteBucket(*element); // Also calls the destructor.
1262 table->m_deletedCount++; 1274 table->m_deletedCount++;
1263 table->m_keyCount--; 1275 table->m_keyCount--;
1264 // We don't rehash the backing until the next add 1276 // We don't rehash the backing until the next add
1265 // or delete, because that would cause allocation 1277 // or delete, because that would cause allocation
1266 // during GC. 1278 // during GC.
1267 } 1279 }
1268 } 1280 }
1269 } 1281 }
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 CollectionIterator end(toBeRemoved.end()); 1467 CollectionIterator end(toBeRemoved.end());
1456 for (CollectionIterator it(toBeRemoved.begin()); it != end; ++it) 1468 for (CollectionIterator it(toBeRemoved.begin()); it != end; ++it)
1457 collection.remove(*it); 1469 collection.remove(*it);
1458 } 1470 }
1459 1471
1460 } // namespace WTF 1472 } // namespace WTF
1461 1473
1462 #include "wtf/HashIterators.h" 1474 #include "wtf/HashIterators.h"
1463 1475
1464 #endif // WTF_HashTable_h 1476 #endif // WTF_HashTable_h
OLDNEW
« no previous file with comments | « Source/platform/heap/Visitor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698