Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Side by Side Diff: src/heap/objects-visiting-inl.h

Issue 982143002: Revert of Simplify and compact transitions storage (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/mark-compact.cc ('k') | src/hydrogen.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 StaticVisitor::VisitPointers( 577 StaticVisitor::VisitPointers(
578 map->GetHeap(), 578 map->GetHeap(),
579 HeapObject::RawField(object, JSDataView::kWeakNextOffset + kPointerSize), 579 HeapObject::RawField(object, JSDataView::kWeakNextOffset + kPointerSize),
580 HeapObject::RawField(object, JSDataView::kSizeWithInternalFields)); 580 HeapObject::RawField(object, JSDataView::kSizeWithInternalFields));
581 } 581 }
582 582
583 583
584 template <typename StaticVisitor> 584 template <typename StaticVisitor>
585 void StaticMarkingVisitor<StaticVisitor>::MarkMapContents(Heap* heap, 585 void StaticMarkingVisitor<StaticVisitor>::MarkMapContents(Heap* heap,
586 Map* map) { 586 Map* map) {
587 Object* raw_transitions = map->raw_transitions(); 587 // Make sure that the back pointer stored either in the map itself or
588 if (TransitionArray::IsSimpleTransition(raw_transitions)) { 588 // inside its transitions array is marked. Skip recording the back
589 StaticVisitor::VisitPointer( 589 // pointer slot since map space is not compacted.
590 heap, HeapObject::RawField(map, Map::kTransitionsOffset)); 590 StaticVisitor::MarkObject(heap, HeapObject::cast(map->GetBackPointer()));
591 } 591
592 if (TransitionArray::IsFullTransitionArray(raw_transitions)) { 592 // Treat pointers in the transitions array as weak and also mark that
593 MarkTransitionArray(heap, TransitionArray::cast(raw_transitions)); 593 // array to prevent visiting it later. Skip recording the transition
594 // array slot, since it will be implicitly recorded when the pointer
595 // fields of this map are visited.
596 if (map->HasTransitionArray()) {
597 TransitionArray* transitions = map->transitions();
598 MarkTransitionArray(heap, transitions);
594 } 599 }
595 600
596 // Since descriptor arrays are potentially shared, ensure that only the 601 // Since descriptor arrays are potentially shared, ensure that only the
597 // descriptors that belong to this map are marked. The first time a 602 // descriptors that belong to this map are marked. The first time a
598 // non-empty descriptor array is marked, its header is also visited. The slot 603 // non-empty descriptor array is marked, its header is also visited. The slot
599 // holding the descriptor array will be implicitly recorded when the pointer 604 // holding the descriptor array will be implicitly recorded when the pointer
600 // fields of this map are visited. 605 // fields of this map are visited.
601 DescriptorArray* descriptors = map->instance_descriptors(); 606 DescriptorArray* descriptors = map->instance_descriptors();
602 if (StaticVisitor::MarkObjectWithoutPush(heap, descriptors) && 607 if (StaticVisitor::MarkObjectWithoutPush(heap, descriptors) &&
603 descriptors->length() > 0) { 608 descriptors->length() > 0) {
(...skipping 15 matching lines...) Expand all
619 heap, HeapObject::RawField(map, Map::kPointerFieldsBeginOffset), 624 heap, HeapObject::RawField(map, Map::kPointerFieldsBeginOffset),
620 HeapObject::RawField(map, Map::kPointerFieldsEndOffset)); 625 HeapObject::RawField(map, Map::kPointerFieldsEndOffset));
621 } 626 }
622 627
623 628
624 template <typename StaticVisitor> 629 template <typename StaticVisitor>
625 void StaticMarkingVisitor<StaticVisitor>::MarkTransitionArray( 630 void StaticMarkingVisitor<StaticVisitor>::MarkTransitionArray(
626 Heap* heap, TransitionArray* transitions) { 631 Heap* heap, TransitionArray* transitions) {
627 if (!StaticVisitor::MarkObjectWithoutPush(heap, transitions)) return; 632 if (!StaticVisitor::MarkObjectWithoutPush(heap, transitions)) return;
628 633
634 // Simple transitions do not have keys nor prototype transitions.
635 if (transitions->IsSimpleTransition()) return;
636
629 if (transitions->HasPrototypeTransitions()) { 637 if (transitions->HasPrototypeTransitions()) {
630 // Mark prototype transitions array but do not push it onto marking 638 // Mark prototype transitions array but do not push it onto marking
631 // stack, this will make references from it weak. We will clean dead 639 // stack, this will make references from it weak. We will clean dead
632 // prototype transitions in ClearNonLiveReferences. 640 // prototype transitions in ClearNonLiveTransitions.
633 Object** slot = transitions->GetPrototypeTransitionsSlot(); 641 Object** slot = transitions->GetPrototypeTransitionsSlot();
634 HeapObject* obj = HeapObject::cast(*slot); 642 HeapObject* obj = HeapObject::cast(*slot);
635 heap->mark_compact_collector()->RecordSlot(slot, slot, obj); 643 heap->mark_compact_collector()->RecordSlot(slot, slot, obj);
636 StaticVisitor::MarkObjectWithoutPush(heap, obj); 644 StaticVisitor::MarkObjectWithoutPush(heap, obj);
637 } 645 }
638 646
639 int num_transitions = TransitionArray::NumberOfTransitions(transitions); 647 for (int i = 0; i < transitions->number_of_transitions(); ++i) {
640 for (int i = 0; i < num_transitions; ++i) {
641 StaticVisitor::VisitPointer(heap, transitions->GetKeySlot(i)); 648 StaticVisitor::VisitPointer(heap, transitions->GetKeySlot(i));
642 } 649 }
643 } 650 }
644 651
645 652
646 template <typename StaticVisitor> 653 template <typename StaticVisitor>
647 void StaticMarkingVisitor<StaticVisitor>::MarkInlinedFunctionsCode(Heap* heap, 654 void StaticMarkingVisitor<StaticVisitor>::MarkInlinedFunctionsCode(Heap* heap,
648 Code* code) { 655 Code* code) {
649 // Skip in absence of inlining. 656 // Skip in absence of inlining.
650 // TODO(turbofan): Revisit once we support inlining. 657 // TODO(turbofan): Revisit once we support inlining.
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 901
895 RelocIterator it(this, mode_mask); 902 RelocIterator it(this, mode_mask);
896 for (; !it.done(); it.next()) { 903 for (; !it.done(); it.next()) {
897 it.rinfo()->template Visit<StaticVisitor>(heap); 904 it.rinfo()->template Visit<StaticVisitor>(heap);
898 } 905 }
899 } 906 }
900 } 907 }
901 } // namespace v8::internal 908 } // namespace v8::internal
902 909
903 #endif // V8_OBJECTS_VISITING_INL_H_ 910 #endif // V8_OBJECTS_VISITING_INL_H_
OLDNEW
« no previous file with comments | « src/heap/mark-compact.cc ('k') | src/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698