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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 StaticVisitor::VisitPointers( | 530 StaticVisitor::VisitPointers( |
531 map->GetHeap(), | 531 map->GetHeap(), |
532 HeapObject::RawField(object, JSDataView::BodyDescriptor::kStartOffset), | 532 HeapObject::RawField(object, JSDataView::BodyDescriptor::kStartOffset), |
533 HeapObject::RawField(object, JSDataView::kSizeWithInternalFields)); | 533 HeapObject::RawField(object, JSDataView::kSizeWithInternalFields)); |
534 } | 534 } |
535 | 535 |
536 | 536 |
537 template <typename StaticVisitor> | 537 template <typename StaticVisitor> |
538 void StaticMarkingVisitor<StaticVisitor>::MarkMapContents(Heap* heap, | 538 void StaticMarkingVisitor<StaticVisitor>::MarkMapContents(Heap* heap, |
539 Map* map) { | 539 Map* map) { |
540 Object* raw_transitions = map->raw_transitions(); | |
541 if (TransitionArray::IsFullTransitionArray(raw_transitions)) { | |
542 MarkTransitionArray(heap, TransitionArray::cast(raw_transitions)); | |
543 } | |
544 | |
545 // Since descriptor arrays are potentially shared, ensure that only the | 540 // Since descriptor arrays are potentially shared, ensure that only the |
546 // descriptors that belong to this map are marked. The first time a | 541 // descriptors that belong to this map are marked. The first time a |
547 // non-empty descriptor array is marked, its header is also visited. The slot | 542 // non-empty descriptor array is marked, its header is also visited. The slot |
548 // holding the descriptor array will be implicitly recorded when the pointer | 543 // holding the descriptor array will be implicitly recorded when the pointer |
549 // fields of this map are visited. | 544 // fields of this map are visited. |
550 DescriptorArray* descriptors = map->instance_descriptors(); | 545 DescriptorArray* descriptors = map->instance_descriptors(); |
551 if (StaticVisitor::MarkObjectWithoutPush(heap, descriptors) && | 546 if (StaticVisitor::MarkObjectWithoutPush(heap, descriptors) && |
552 descriptors->length() > 0) { | 547 descriptors->length() > 0) { |
553 StaticVisitor::VisitPointers(heap, descriptors->GetFirstElementAddress(), | 548 StaticVisitor::VisitPointers(heap, descriptors->GetFirstElementAddress(), |
554 descriptors->GetDescriptorEndSlot(0)); | 549 descriptors->GetDescriptorEndSlot(0)); |
555 } | 550 } |
556 int start = 0; | 551 int start = 0; |
557 int end = map->NumberOfOwnDescriptors(); | 552 int end = map->NumberOfOwnDescriptors(); |
558 if (start < end) { | 553 if (start < end) { |
559 StaticVisitor::VisitPointers(heap, | 554 StaticVisitor::VisitPointers(heap, |
560 descriptors->GetDescriptorStartSlot(start), | 555 descriptors->GetDescriptorStartSlot(start), |
561 descriptors->GetDescriptorEndSlot(end)); | 556 descriptors->GetDescriptorEndSlot(end)); |
562 } | 557 } |
563 | 558 |
564 // Mark the pointer fields of the Map. Since the transitions array has | 559 // Mark the pointer fields of the Map. Since the transitions array has |
565 // been marked already, it is fine that one of these fields contains a | 560 // been marked already, it is fine that one of these fields contains a |
566 // pointer to it. | 561 // pointer to it. |
567 StaticVisitor::VisitPointers( | 562 StaticVisitor::VisitPointers( |
568 heap, HeapObject::RawField(map, Map::kPointerFieldsBeginOffset), | 563 heap, HeapObject::RawField(map, Map::kPointerFieldsBeginOffset), |
569 HeapObject::RawField(map, Map::kPointerFieldsEndOffset)); | 564 HeapObject::RawField(map, Map::kPointerFieldsEndOffset)); |
570 } | 565 } |
571 | 566 |
572 | 567 |
573 template <typename StaticVisitor> | 568 template <typename StaticVisitor> |
574 void StaticMarkingVisitor<StaticVisitor>::MarkTransitionArray( | |
575 Heap* heap, TransitionArray* transitions) { | |
576 if (!StaticVisitor::MarkObjectWithoutPush(heap, transitions)) return; | |
577 | |
578 if (transitions->HasPrototypeTransitions()) { | |
579 StaticVisitor::VisitPointer(heap, | |
580 transitions->GetPrototypeTransitionsSlot()); | |
581 } | |
582 | |
583 int num_transitions = TransitionArray::NumberOfTransitions(transitions); | |
584 for (int i = 0; i < num_transitions; ++i) { | |
585 StaticVisitor::VisitPointer(heap, transitions->GetKeySlot(i)); | |
586 } | |
587 } | |
588 | |
589 | |
590 template <typename StaticVisitor> | |
591 void StaticMarkingVisitor<StaticVisitor>::MarkInlinedFunctionsCode(Heap* heap, | 569 void StaticMarkingVisitor<StaticVisitor>::MarkInlinedFunctionsCode(Heap* heap, |
592 Code* code) { | 570 Code* code) { |
593 // For optimized functions we should retain both non-optimized version | 571 // For optimized functions we should retain both non-optimized version |
594 // of its code and non-optimized version of all inlined functions. | 572 // of its code and non-optimized version of all inlined functions. |
595 // This is required to support bailing out from inlined code. | 573 // This is required to support bailing out from inlined code. |
596 DeoptimizationInputData* const data = | 574 DeoptimizationInputData* const data = |
597 DeoptimizationInputData::cast(code->deoptimization_data()); | 575 DeoptimizationInputData::cast(code->deoptimization_data()); |
598 FixedArray* const literals = data->LiteralArray(); | 576 FixedArray* const literals = data->LiteralArray(); |
599 int const inlined_count = data->InlinedFunctionCount()->value(); | 577 int const inlined_count = data->InlinedFunctionCount()->value(); |
600 for (int i = 0; i < inlined_count; ++i) { | 578 for (int i = 0; i < inlined_count; ++i) { |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 | 814 |
837 RelocIterator it(this, mode_mask); | 815 RelocIterator it(this, mode_mask); |
838 for (; !it.done(); it.next()) { | 816 for (; !it.done(); it.next()) { |
839 it.rinfo()->template Visit<StaticVisitor>(heap); | 817 it.rinfo()->template Visit<StaticVisitor>(heap); |
840 } | 818 } |
841 } | 819 } |
842 } | 820 } |
843 } // namespace v8::internal | 821 } // namespace v8::internal |
844 | 822 |
845 #endif // V8_OBJECTS_VISITING_INL_H_ | 823 #endif // V8_OBJECTS_VISITING_INL_H_ |
OLD | NEW |