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

Unified Diff: src/heap/mark-compact.cc

Issue 1441633002: Optimize MarkCompactCollector::ClearNonLiveReferences. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Correctly fix assertion Created 5 years, 1 month 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 | « src/heap/mark-compact.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index ffda9f159d263d2c40e22c3c013881ef1be7f106..fd1adcdbc295dd6290328115842dc1588d591bd3 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -2198,14 +2198,13 @@ void MarkCompactCollector::ClearNonLiveReferences() {
for (HeapObject* obj = map_iterator.Next(); obj != NULL;
obj = map_iterator.Next()) {
Map* map = Map::cast(obj);
-
if (!map->CanTransition()) continue;
-
MarkBit map_mark = Marking::MarkBitFrom(map);
- ClearNonLivePrototypeTransitions(map);
- ClearNonLiveMapTransitions(map, map_mark);
-
- if (Marking::IsWhite(map_mark)) {
+ bool alive = Marking::IsBlackOrGrey(map_mark);
+ if (alive) {
+ ClearNonLivePrototypeTransitions(map);
+ } else {
+ ClearNonLiveMapTransitions(map);
have_code_to_deoptimize_ |=
map->dependent_code()->MarkCodeForDeoptimization(
isolate(), DependentCode::kWeakCodeGroup);
@@ -2267,17 +2266,16 @@ void MarkCompactCollector::ClearNonLivePrototypeTransitions(Map* map) {
}
-void MarkCompactCollector::ClearNonLiveMapTransitions(Map* map,
- MarkBit map_mark) {
+void MarkCompactCollector::ClearNonLiveMapTransitions(Map* map) {
Object* potential_parent = map->GetBackPointer();
if (!potential_parent->IsMap()) return;
Map* parent = Map::cast(potential_parent);
// Follow back pointer, check whether we are dealing with a map transition
// from a live map to a dead path and in case clear transitions of parent.
- bool current_is_alive = Marking::IsBlackOrGrey(map_mark);
+ DCHECK(!Marking::IsBlackOrGrey(Marking::MarkBitFrom(map)));
bool parent_is_alive = Marking::IsBlackOrGrey(Marking::MarkBitFrom(parent));
- if (!current_is_alive && parent_is_alive) {
+ if (parent_is_alive) {
ClearMapTransitions(parent, map);
}
}
« no previous file with comments | « src/heap/mark-compact.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698