OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_OBJECTS_VISITING_INL_H_ | 5 #ifndef V8_OBJECTS_VISITING_INL_H_ |
6 #define V8_OBJECTS_VISITING_INL_H_ | 6 #define V8_OBJECTS_VISITING_INL_H_ |
7 | 7 |
8 #include "src/heap/objects-visiting.h" | 8 #include "src/heap/objects-visiting.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 HeapObject::RawField(map, Map::kPointerFieldsEndOffset)); | 594 HeapObject::RawField(map, Map::kPointerFieldsEndOffset)); |
595 } | 595 } |
596 | 596 |
597 | 597 |
598 template <typename StaticVisitor> | 598 template <typename StaticVisitor> |
599 void StaticMarkingVisitor<StaticVisitor>::MarkTransitionArray( | 599 void StaticMarkingVisitor<StaticVisitor>::MarkTransitionArray( |
600 Heap* heap, TransitionArray* transitions) { | 600 Heap* heap, TransitionArray* transitions) { |
601 if (!StaticVisitor::MarkObjectWithoutPush(heap, transitions)) return; | 601 if (!StaticVisitor::MarkObjectWithoutPush(heap, transitions)) return; |
602 | 602 |
603 if (transitions->HasPrototypeTransitions()) { | 603 if (transitions->HasPrototypeTransitions()) { |
604 StaticVisitor::VisitPointer(heap, | 604 // Mark prototype transitions array but do not push it onto marking |
605 transitions->GetPrototypeTransitionsSlot()); | 605 // stack, this will make references from it weak. We will clean dead |
| 606 // prototype transitions in ClearNonLiveReferences. |
| 607 Object** slot = transitions->GetPrototypeTransitionsSlot(); |
| 608 HeapObject* obj = HeapObject::cast(*slot); |
| 609 heap->mark_compact_collector()->RecordSlot(slot, slot, obj); |
| 610 StaticVisitor::MarkObjectWithoutPush(heap, obj); |
606 } | 611 } |
607 | 612 |
608 int num_transitions = TransitionArray::NumberOfTransitions(transitions); | 613 int num_transitions = TransitionArray::NumberOfTransitions(transitions); |
609 for (int i = 0; i < num_transitions; ++i) { | 614 for (int i = 0; i < num_transitions; ++i) { |
610 StaticVisitor::VisitPointer(heap, transitions->GetKeySlot(i)); | 615 StaticVisitor::VisitPointer(heap, transitions->GetKeySlot(i)); |
611 } | 616 } |
612 } | 617 } |
613 | 618 |
614 | 619 |
615 template <typename StaticVisitor> | 620 template <typename StaticVisitor> |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 | 869 |
865 RelocIterator it(this, mode_mask); | 870 RelocIterator it(this, mode_mask); |
866 for (; !it.done(); it.next()) { | 871 for (; !it.done(); it.next()) { |
867 it.rinfo()->template Visit<StaticVisitor>(heap); | 872 it.rinfo()->template Visit<StaticVisitor>(heap); |
868 } | 873 } |
869 } | 874 } |
870 } | 875 } |
871 } // namespace v8::internal | 876 } // namespace v8::internal |
872 | 877 |
873 #endif // V8_OBJECTS_VISITING_INL_H_ | 878 #endif // V8_OBJECTS_VISITING_INL_H_ |
OLD | NEW |