Chromium Code Reviews| Index: src/heap/mark-compact.cc |
| diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc |
| index 90fc13616c65f750b974ce58ff821742603486f8..7ee78083ce049b7ecfb3ac6c37684f489c853cf0 100644 |
| --- a/src/heap/mark-compact.cc |
| +++ b/src/heap/mark-compact.cc |
| @@ -2468,25 +2468,39 @@ void MarkCompactCollector::ClearMapTransitions(Map* map, Map* dead_transition) { |
| int transition_index = 0; |
| - bool descriptors_owner_died = false; |
| + // This flag will be cleared if we find the live owner in the loop below. |
| + bool descriptors_owner_died = true; |
| // Compact all live descriptors to the left. |
| - for (int i = 0; i < num_transitions; ++i) { |
| - Map* target = TransitionArray::GetTarget(transitions, i); |
| - if (ClearMapBackPointer(target)) { |
| - if (target->instance_descriptors() == descriptors) { |
| - descriptors_owner_died = true; |
| + if (TransitionArray::IsFullTransitionArray(transitions)) { |
| + for (int i = 0; i < num_transitions; ++i) { |
| + WeakCell* target_cell = |
| + TransitionArray::cast(transitions)->GetTargetCell(i); |
| + if (!target_cell->cleared()) { |
| + if (Map::cast(target_cell->value())->instance_descriptors() == |
| + descriptors) { |
| + descriptors_owner_died = false; |
| + } |
| + if (i != transition_index) { |
| + TransitionArray* t = TransitionArray::cast(transitions); |
| + Name* key = t->GetKey(i); |
| + t->SetKey(transition_index, key); |
| + Object** key_slot = t->GetKeySlot(transition_index); |
| + RecordSlot(key_slot, key_slot, key); |
| + WeakCell* target_cell = t->GetTargetCell(i); |
|
brucedawson
2015/06/20 00:08:03
This variable declaration shadows the target_cell
|
| + t->SetTargetCell(transition_index, target_cell); |
| + Object** target_slot = t->GetTargetSlot(transition_index); |
| + RecordSlot(target_slot, target_slot, target_cell); |
| + } |
| + transition_index++; |
| } |
| - } else { |
| - if (i != transition_index) { |
| - DCHECK(TransitionArray::IsFullTransitionArray(transitions)); |
| - TransitionArray* t = TransitionArray::cast(transitions); |
| - Name* key = t->GetKey(i); |
| - t->SetKey(transition_index, key); |
| - Object** key_slot = t->GetKeySlot(transition_index); |
| - RecordSlot(key_slot, key_slot, key); |
| - // Target slots do not need to be recorded since maps are not compacted. |
| - t->SetTarget(transition_index, t->GetTarget(i)); |
| + } |
| + } else if (transitions->IsWeakCell()) { |
| + WeakCell* target_cell = WeakCell::cast(transitions); |
| + if (!target_cell->cleared()) { |
| + if (Map::cast(target_cell->value())->instance_descriptors() == |
| + descriptors) { |
| + descriptors_owner_died = false; |
| } |
| transition_index++; |
| } |