Index: src/runtime/runtime-collections.cc |
diff --git a/src/runtime/runtime-collections.cc b/src/runtime/runtime-collections.cc |
index c4f74183ce4a617f0bff2d5dfebd05812911f395..c1a63dc8b4373b115288801773479f8a3d1c9f75 100644 |
--- a/src/runtime/runtime-collections.cc |
+++ b/src/runtime/runtime-collections.cc |
@@ -288,6 +288,10 @@ RUNTIME_FUNCTION(Runtime_WeakCollectionDelete) { |
Handle<ObjectHashTable> new_table = |
ObjectHashTable::Remove(table, key, &was_present); |
weak_collection->set_table(*new_table); |
+ if (*table != *new_table) { |
+ // Zap the old table since we didn't record slots for its elements. |
+ table->FillWithHoles(0, table->length()); |
+ } |
return isolate->heap()->ToBoolean(was_present); |
} |
@@ -304,6 +308,10 @@ RUNTIME_FUNCTION(Runtime_WeakCollectionSet) { |
RUNTIME_ASSERT(table->IsKey(*key)); |
Handle<ObjectHashTable> new_table = ObjectHashTable::Put(table, key, value); |
weak_collection->set_table(*new_table); |
+ if (*table != *new_table) { |
+ // Zap the old table since we didn't record slots for its elements. |
+ table->FillWithHoles(0, table->length()); |
+ } |
return *weak_collection; |
} |