Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index f57c569d09b36bf08bcdab3288dd552b85b960c6..9f2df206d86e2bffb5893c17529187dbfe636371 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -8295,6 +8295,19 @@ Handle<WeakFixedArray> WeakFixedArray::Add( |
} |
+void WeakFixedArray::Compact() { |
+ FixedArray* array = FixedArray::cast(this); |
+ int w = 0; |
ulan
2015/04/21 13:42:10
s/w/new_length/
|
+ for (int r = 0; r < array->length(); r++) { |
+ Object* item = array->get(r); |
+ if (item->IsSmi()) continue; |
+ if (WeakCell::cast(item)->cleared()) continue; |
+ array->set(w++, item); |
+ } |
+ array->Shrink(w); |
+} |
+ |
+ |
void WeakFixedArray::Remove(Handle<HeapObject> value) { |
// Optimize for the most recently added element to be removed again. |
int first_index = last_used_index(); |