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

Unified Diff: src/heap/heap.cc

Issue 2087163002: [heap] compact more weak fixed arrays before serializing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 5605291a7dff5bf55c833a9491955c31313e2f56..278ace0a4fe8962aeda715ee6eecb0dde716f6aa 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -5582,24 +5582,32 @@ DependentCode* Heap::LookupWeakObjectToCodeDependency(Handle<HeapObject> obj) {
return DependentCode::cast(empty_fixed_array());
}
+namespace {
+void CompactWeakFixedArray(Object* object) {
+ if (object->IsWeakFixedArray()) {
+ WeakFixedArray* array = WeakFixedArray::cast(object);
+ array->Compact<WeakFixedArray::NullCallback>();
+ }
+}
+} // anonymous namespace
+
void Heap::CompactWeakFixedArrays() {
// Find known WeakFixedArrays and compact them.
- i::HeapIterator iterator(this);
- for (i::HeapObject* o = iterator.next(); o != NULL; o = iterator.next()) {
+ HeapIterator iterator(this);
+ for (HeapObject* o = iterator.next(); o != NULL; o = iterator.next()) {
if (o->IsPrototypeInfo()) {
- i::Object* prototype_users = i::PrototypeInfo::cast(o)->prototype_users();
+ Object* prototype_users = PrototypeInfo::cast(o)->prototype_users();
if (prototype_users->IsWeakFixedArray()) {
- i::WeakFixedArray* array = i::WeakFixedArray::cast(prototype_users);
- array->Compact<i::JSObject::PrototypeRegistryCompactionCallback>();
+ WeakFixedArray* array = WeakFixedArray::cast(prototype_users);
+ array->Compact<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>();
- }
+ CompactWeakFixedArray(Script::cast(o)->shared_function_infos());
}
}
+ CompactWeakFixedArray(noscript_shared_function_infos());
+ CompactWeakFixedArray(script_list());
+ CompactWeakFixedArray(weak_stack_trace_list());
}
void Heap::AddRetainedMap(Handle<Map> map) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698