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