Index: src/mark-compact.cc |
diff --git a/src/mark-compact.cc b/src/mark-compact.cc |
index ba7fcf0b32fde861d6bf94fc0e7d176aa98f19a2..77edbf27352e9c298331575401cb58bcf7e6632e 100644 |
--- a/src/mark-compact.cc |
+++ b/src/mark-compact.cc |
@@ -1853,14 +1853,19 @@ void Marker<T>::MarkMapContents(Map* map) { |
// array as weak and also mark that array to prevent visiting it later. |
Michael Starzinger
2012/08/07 13:55:04
These comments are completely outdated.
// Make s
Toon Verwaest
2012/08/10 12:32:52
Done.
|
base_marker()->MarkObjectAndPush(HeapObject::cast(map->GetBackPointer())); |
- Object** descriptor_array_slot = |
- HeapObject::RawField(map, Map::kInstanceDescriptorsOrBackPointerOffset); |
- Object* descriptor_array = *descriptor_array_slot; |
- if (descriptor_array->IsDescriptorArray()) { |
- MarkDescriptorArray(reinterpret_cast<DescriptorArray*>(descriptor_array)); |
+ Object** start_slot = |
+ HeapObject::RawField(map, Map::kPointerFieldsBeginOffset); |
Michael Starzinger
2012/08/07 13:55:04
Move this down to the main marking loop again.
Toon Verwaest
2012/08/10 12:32:52
Done.
|
+ |
+ Object** transitions_slot = |
+ HeapObject::RawField(map, Map::kTransitionsOrBackPointerOffset); |
+ Object* transitions = *transitions_slot; |
+ if (transitions->IsTransitionArray()) { |
+ mark_compact_collector()->RecordSlot( |
Michael Starzinger
2012/08/07 13:55:05
This slot is actually recorded in the main marking
Toon Verwaest
2012/08/10 12:32:52
Done.
|
+ start_slot, transitions_slot, transitions); |
+ MarkTransitionArray(reinterpret_cast<TransitionArray*>(transitions)); |
} else { |
// Already marked by marking map->GetBackPointer(). |
- ASSERT(descriptor_array->IsMap() || descriptor_array->IsUndefined()); |
+ ASSERT(transitions->IsMap() || transitions->IsUndefined()); |
} |
// Mark the Object* fields of the Map. Since the descriptor array has been |
@@ -1868,8 +1873,6 @@ void Marker<T>::MarkMapContents(Map* map) { |
// to it. But make sure to skip back pointer. |
Michael Starzinger
2012/08/07 13:55:05
These comments are completely outdated.
// Mark t
Toon Verwaest
2012/08/10 12:32:52
Done.
|
STATIC_ASSERT(Map::kPointerFieldsEndOffset == |
Map::kBitField3Offset + kPointerSize); |
Michael Starzinger
2012/08/07 13:55:05
This assert is no longer necessary, because we no
Toon Verwaest
2012/08/10 12:32:52
Done.
|
- Object** start_slot = |
- HeapObject::RawField(map, Map::kPointerFieldsBeginOffset); |
Object** end_slot = HeapObject::RawField(map, Map::kBitField3Offset); |
Michael Starzinger
2012/08/07 13:55:05
We can use Map::kPointerFieldsEndOffset here.
Toon Verwaest
2012/08/10 12:32:52
Done.
|
for (Object** slot = start_slot; slot < end_slot; slot++) { |
Object* obj = *slot; |
@@ -1881,77 +1884,15 @@ void Marker<T>::MarkMapContents(Map* map) { |
template <class T> |
-void Marker<T>::MarkDescriptorArray(DescriptorArray* descriptors) { |
- // Empty descriptor array is marked as a root before any maps are marked. |
- ASSERT(descriptors != descriptors->GetHeap()->empty_descriptor_array()); |
- |
- if (!base_marker()->MarkObjectWithoutPush(descriptors)) return; |
- Object** descriptor_start = descriptors->data_start(); |
- |
- // Since the descriptor array itself is not pushed for scanning, all fields |
- // that point to objects manually have to be pushed, marked, and their slots |
- // recorded. |
- if (descriptors->HasEnumCache()) { |
- Object** enum_cache_slot = descriptors->GetEnumCacheSlot(); |
- Object* enum_cache = *enum_cache_slot; |
- base_marker()->MarkObjectAndPush( |
- reinterpret_cast<HeapObject*>(enum_cache)); |
- mark_compact_collector()->RecordSlot(descriptor_start, |
- enum_cache_slot, |
- enum_cache); |
- } |
- |
- 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 |
- // value as live. It might be removed by ClearNonLiveTransitions later. |
- for (int i = 0; i < descriptors->number_of_descriptors(); ++i) { |
- Object** key_slot = descriptors->GetKeySlot(i); |
- Object* key = *key_slot; |
- if (key->IsHeapObject()) { |
- base_marker()->MarkObjectAndPush(HeapObject::cast(key)); |
- mark_compact_collector()->RecordSlot(descriptor_start, key_slot, key); |
- } |
- |
- Object** value_slot = descriptors->GetValueSlot(i); |
- if (!(*value_slot)->IsHeapObject()) continue; |
- HeapObject* value = HeapObject::cast(*value_slot); |
- |
- mark_compact_collector()->RecordSlot(descriptor_start, |
- value_slot, |
- value); |
- |
- PropertyDetails details(descriptors->GetDetails(i)); |
- |
- switch (details.type()) { |
- case NORMAL: |
- case FIELD: |
- case CONSTANT_FUNCTION: |
- case HANDLER: |
- case INTERCEPTOR: |
- case CALLBACKS: |
- base_marker()->MarkObjectAndPush(value); |
- break; |
- case TRANSITION: |
- case NONEXISTENT: |
- UNREACHABLE(); |
- break; |
- } |
- } |
-} |
- |
-template <class T> |
void Marker<T>::MarkTransitionArray(TransitionArray* transitions) { |
if (!base_marker()->MarkObjectWithoutPush(transitions)) return; |
Object** transitions_start = transitions->data_start(); |
+ DescriptorArray* descriptors = transitions->descriptors(); |
+ base_marker()->MarkObjectAndPush(descriptors); |
+ mark_compact_collector()->RecordSlot( |
+ transitions_start, transitions->GetDescriptorsSlot(), descriptors); |
+ |
if (transitions->HasPrototypeTransitions()) { |
// Mark prototype transitions array but don't push it into marking stack. |
// This will make references from it weak. We will clean dead prototype |