Chromium Code Reviews| Index: src/mark-compact.cc |
| diff --git a/src/mark-compact.cc b/src/mark-compact.cc |
| index d0b4ae48b8446815c415b68a98975f302064e03f..e0ea8a86c74c21ad287ea9dd0a2c981b91f42dc4 100644 |
| --- a/src/mark-compact.cc |
| +++ b/src/mark-compact.cc |
| @@ -1892,12 +1892,13 @@ void Marker<T>::MarkDescriptorArray(DescriptorArray* descriptors) { |
| enum_cache); |
| } |
| - if (descriptors->elements_transition_map() != NULL) { |
| + if (descriptors->HasTransitionArray()) { |
| Object** transitions_slot = descriptors->GetTransitionsSlot(); |
| Object* transitions = *transitions_slot; |
| mark_compact_collector()->RecordSlot(descriptor_start, |
| transitions_slot, |
| transitions); |
| + MarkTransitionArray(reinterpret_cast<TransitionArray*>(transitions)); |
| } |
| // If the descriptor contains a transition (value is a Map), we don't mark the |
| @@ -1937,9 +1938,7 @@ void Marker<T>::MarkDescriptorArray(DescriptorArray* descriptors) { |
| MarkAccessorPairSlot(accessors, AccessorPair::kSetterOffset); |
| } |
| break; |
| - case MAP_TRANSITION: |
| - case CONSTANT_TRANSITION: |
| - break; |
| + case TRANSITION: |
| case NONEXISTENT: |
| UNREACHABLE(); |
| break; |
| @@ -1947,6 +1946,43 @@ void Marker<T>::MarkDescriptorArray(DescriptorArray* descriptors) { |
| } |
| } |
| +template <class T> |
| +void Marker<T>::MarkTransitionArray(TransitionArray* transitions) { |
| + ASSERT(transitions != NULL); |
| + if (!base_marker()->MarkObjectWithoutPush(transitions)) return; |
| + Object** transitions_start = transitions->data_start(); |
| + |
| + if (transitions->elements() != NULL) { |
| + mark_compact_collector()->RecordSlot(transitions_start, |
| + transitions->GetElementsSlot(), |
| + transitions->elements()); |
| + } |
| + |
| + for (int i = 0; i < transitions->number_of_transitions(); ++i) { |
| + Object** key_slot = transitions->GetKeySlot(i); |
| + Object* key = *key_slot; |
| + if (key->IsHeapObject()) { |
| + base_marker()->MarkObjectAndPush(reinterpret_cast<HeapObject*>(key)); |
|
Michael Starzinger
2012/06/28 16:02:12
Use HeapObject::cast() here.
Toon Verwaest
2012/06/29 08:14:55
Done.
|
| + mark_compact_collector()->RecordSlot(transitions_start, key_slot, key); |
| + } |
| + |
| + Object** value_slot = transitions->GetValueSlot(i); |
| + if (!(*value_slot)->IsHeapObject()) continue; |
| + HeapObject* value = HeapObject::cast(*value_slot); |
| + |
| + mark_compact_collector()->RecordSlot(transitions_start, |
| + value_slot, |
| + value); |
| + |
| + if (value->IsAccessorPair()) { |
| + base_marker()->MarkObjectWithoutPush(value); |
|
Michael Starzinger
2012/06/28 16:02:12
We only need to mark the slots if the pair itself
Toon Verwaest
2012/06/29 08:14:55
Done.
|
| + AccessorPair* accessors = AccessorPair::cast(value); |
| + MarkAccessorPairSlot(accessors, AccessorPair::kGetterOffset); |
| + MarkAccessorPairSlot(accessors, AccessorPair::kSetterOffset); |
| + } |
| + } |
| +} |
| + |
| template <class T> |
| void Marker<T>::MarkAccessorPairSlot(AccessorPair* accessors, int offset) { |