Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index 20564482c8a764ab1045e02037fa919e1f7cb2ec..16d7f36c550f1e03109ea63e1bc53a376c279a14 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -1249,6 +1249,26 @@ |
} |
+void Heap::ClearNormalizedMapCaches() { |
+ if (isolate_->bootstrapper()->IsActive() && |
+ !incremental_marking()->IsMarking()) { |
+ return; |
+ } |
+ |
+ Object* context = native_contexts_list(); |
+ while (!context->IsUndefined(isolate())) { |
+ // GC can happen when the context is not fully initialized, |
+ // so the cache can be undefined. |
+ Object* cache = |
+ Context::cast(context)->get(Context::NORMALIZED_MAP_CACHE_INDEX); |
+ if (!cache->IsUndefined(isolate())) { |
+ NormalizedMapCache::cast(cache)->Clear(); |
+ } |
+ context = Context::cast(context)->next_context_link(); |
+ } |
+} |
+ |
+ |
void Heap::UpdateSurvivalStatistics(int start_new_space_size) { |
if (start_new_space_size == 0) return; |
@@ -1490,6 +1510,7 @@ |
CompletelyClearInstanceofCache(); |
FlushNumberStringCache(); |
+ ClearNormalizedMapCaches(); |
} |