Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index 26cffc8fb5524e51310776f74c2fbc3e0e7edf8b..978920ff01d8da694ae9fd37c11a5a9f0a9e3a58 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -915,6 +915,7 @@ int Heap::NotifyContextDisposed(bool dependant_context) { |
if (!dependant_context) { |
tracer()->ResetSurvivalEvents(); |
old_generation_size_configured_ = false; |
+ set_retained_maps(ArrayList::cast(empty_fixed_array())); |
} |
if (isolate()->concurrent_recompilation_enabled()) { |
// Flush the queued recompilation tasks. |
@@ -3107,6 +3108,7 @@ void Heap::CreateInitialObjects() { |
} |
set_detached_contexts(empty_fixed_array()); |
+ set_retained_maps(ArrayList::cast(empty_fixed_array())); |
set_weak_object_to_code_table( |
*WeakHashTable::New(isolate(), 16, USE_DEFAULT_MINIMUM_CAPACITY, |
@@ -5747,6 +5749,18 @@ DependentCode* Heap::LookupWeakObjectToCodeDependency(Handle<HeapObject> obj) { |
} |
+void Heap::AddRetainedMap(Handle<Map> map) { |
+ if (FLAG_retain_maps_for_n_gc == 0) return; |
+ Handle<WeakCell> cell = Map::WeakCellForMap(map); |
+ Handle<ArrayList> array(retained_maps(), isolate()); |
+ array = ArrayList::Add( |
+ array, cell, handle(Smi::FromInt(FLAG_retain_maps_for_n_gc), isolate())); |
+ if (*array != retained_maps()) { |
+ set_retained_maps(*array); |
+ } |
+} |
+ |
+ |
void Heap::FatalProcessOutOfMemory(const char* location, bool take_snapshot) { |
v8::internal::V8::FatalProcessOutOfMemory(location, take_snapshot); |
} |