Index: src/heap/mark-compact.cc |
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc |
index cbdfadc2b5341161e2617021fb38b7ccb68b8276..f0483c95615063b8b9954c979e565adfd628562e 100644 |
--- a/src/heap/mark-compact.cc |
+++ b/src/heap/mark-compact.cc |
@@ -2153,7 +2153,16 @@ void MarkCompactCollector::RetainMaps() { |
// be created. Do not retain this map. |
continue; |
} |
- new_age = age - 1; |
+ Object* prototype = map->prototype(); |
+ if (prototype->IsHeapObject() && |
+ !Marking::MarkBitFrom(HeapObject::cast(prototype)).Get()) { |
+ // The prototype is not marked, age the map. |
+ new_age = age - 1; |
+ } else { |
+ // The prototype and the constructor are marked, this map keeps only |
+ // transition tree alive, not JSObjects. Do not age the map. |
+ new_age = age; |
+ } |
MarkObject(map, map_mark); |
} else { |
new_age = FLAG_retain_maps_for_n_gc; |