Index: Source/wtf/HashTable.h |
diff --git a/Source/wtf/HashTable.h b/Source/wtf/HashTable.h |
index 40d57616b4d1fc2e4fc315c7d71174d774f49cbb..1924e891fddefb78e4ac17dc38bd6b038798148e 100644 |
--- a/Source/wtf/HashTable.h |
+++ b/Source/wtf/HashTable.h |
@@ -1256,7 +1256,19 @@ template<typename Key, typename Value, typename Extractor, typename HashFunction |
// At this stage calling trace can make no difference |
// (everything is already traced), but we use the |
// return value to remove things from the collection. |
- if (TraceInCollectionTrait<WeakHandlingInCollections, WeakPointersActWeak, ValueType, Traits>::trace(visitor, *element)) { |
+ |
+ // FIXME: This should be rewritten so that this can check |
+ // if the element is dead without calling trace, |
+ // which is semantically not correct to be called in |
+ // weak processing stage. |
+#if ENABLE(ASSERT) |
+ visitor->setAllowMarkingForHashTableWeakProcessing(true); |
+#endif |
+ bool elementIsDead = TraceInCollectionTrait<WeakHandlingInCollections, WeakPointersActWeak, ValueType, Traits>::trace(visitor, *element); |
+#if ENABLE(ASSERT) |
+ visitor->setAllowMarkingForHashTableWeakProcessing(false); |
+#endif |
+ if (elementIsDead) { |
table->registerModification(); |
HashTableType::deleteBucket(*element); // Also calls the destructor. |
table->m_deletedCount++; |