Chromium Code Reviews| Index: src/mark-compact.cc |
| diff --git a/src/mark-compact.cc b/src/mark-compact.cc |
| index a9d0c166c8cc96fa440de8df46cc59ec99831cc9..92f1ab1abdf755e7ad240b4b55490a5b965635cd 100644 |
| --- a/src/mark-compact.cc |
| +++ b/src/mark-compact.cc |
| @@ -1823,24 +1823,6 @@ template void Marker<MarkCompactCollector>::MarkMapContents(Map* map); |
| template <class T> |
| void Marker<T>::MarkMapContents(Map* map) { |
| - // Mark prototype transitions array but don't push it into marking stack. |
| - // This will make references from it weak. We will clean dead prototype |
| - // transitions in ClearNonLiveTransitions. |
| - Object** proto_trans_slot = |
| - HeapObject::RawField(map, Map::kPrototypeTransitionsOrBackPointerOffset); |
| - HeapObject* prototype_transitions = HeapObject::cast(*proto_trans_slot); |
| - if (prototype_transitions->IsFixedArray()) { |
| - mark_compact_collector()->RecordSlot(proto_trans_slot, |
| - proto_trans_slot, |
| - prototype_transitions); |
| - MarkBit mark = Marking::MarkBitFrom(prototype_transitions); |
| - if (!mark.Get()) { |
| - mark.Set(); |
| - MemoryChunk::IncrementLiveBytesFromGC(prototype_transitions->address(), |
| - prototype_transitions->Size()); |
| - } |
| - } |
| - |
| // Make sure that the back pointer stored either in the map itself or inside |
| // its prototype transitions array is marked. Treat pointers in the descriptor |
| // array as weak and also mark that array to prevent visiting it later. |
| @@ -1857,11 +1839,10 @@ void Marker<T>::MarkMapContents(Map* map) { |
| // marked already, it is fine that one of these fields contains a pointer |
| // to it. But make sure to skip back pointer and prototype transitions. |
|
Michael Starzinger
2012/07/06 13:53:18
Comment no longer applies, drop the "and prototype
Toon Verwaest
2012/07/09 12:45:27
Done.
|
| STATIC_ASSERT(Map::kPointerFieldsEndOffset == |
| - Map::kPrototypeTransitionsOrBackPointerOffset + kPointerSize); |
| - Object** start_slot = HeapObject::RawField( |
| - map, Map::kPointerFieldsBeginOffset); |
| - Object** end_slot = HeapObject::RawField( |
| - map, Map::kPrototypeTransitionsOrBackPointerOffset); |
| + Map::kBackPointerOffset + kPointerSize); |
| + Object** start_slot = |
| + HeapObject::RawField(map, Map::kPointerFieldsBeginOffset); |
| + Object** end_slot = HeapObject::RawField(map, Map::kBackPointerOffset); |
| for (Object** slot = start_slot; slot < end_slot; slot++) { |
| Object* obj = *slot; |
| if (!obj->NonFailureIsHeapObject()) continue; |
| @@ -1957,6 +1938,17 @@ void Marker<T>::MarkTransitionArray(TransitionArray* transitions) { |
| transitions->elements_transition()); |
| } |
| + 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 |
| + // transitions in ClearNonLiveTransitions. |
| + Object** proto_trans_slot = transitions->GetPrototypeTransitionsSlot(); |
| + HeapObject* prototype_transitions = HeapObject::cast(*proto_trans_slot); |
| + base_marker()->MarkObjectWithoutPush(prototype_transitions); |
| + mark_compact_collector()->RecordSlot( |
| + transitions_start, proto_trans_slot, prototype_transitions); |
| + } |
| + |
| for (int i = 0; i < transitions->number_of_transitions(); ++i) { |
| Object** key_slot = transitions->GetKeySlot(i); |
| Object* key = *key_slot; |