Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index f830b4dd1bcfaf26a5a743a250f9bdef2ed3c522..9a6b3229def2f1657f27dec9e666e07db5c1e7de 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -5610,6 +5610,25 @@ DependentCode* Heap::LookupWeakObjectToCodeDependency(Handle<HeapObject> obj) { |
return DependentCode::cast(empty_fixed_array()); |
} |
+void Heap::CompactWeakFixedArrays() { |
+ // Find known WeakFixedArrays and compact them. |
+ i::HeapIterator iterator(this); |
+ for (i::HeapObject* o = iterator.next(); o != NULL; o = iterator.next()) { |
+ if (o->IsPrototypeInfo()) { |
+ i::Object* prototype_users = i::PrototypeInfo::cast(o)->prototype_users(); |
+ if (prototype_users->IsWeakFixedArray()) { |
+ i::WeakFixedArray* array = i::WeakFixedArray::cast(prototype_users); |
+ array->Compact<i::JSObject::PrototypeRegistryCompactionCallback>(); |
+ } |
+ } else if (o->IsScript()) { |
+ i::Object* shared_list = i::Script::cast(o)->shared_function_infos(); |
+ if (shared_list->IsWeakFixedArray()) { |
+ i::WeakFixedArray* array = i::WeakFixedArray::cast(shared_list); |
+ array->Compact<i::WeakFixedArray::NullCallback>(); |
+ } |
+ } |
+ } |
+} |
void Heap::AddRetainedMap(Handle<Map> map) { |
Handle<WeakCell> cell = Map::WeakCellForMap(map); |