Chromium Code Reviews| 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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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(); | 540 Object* raw_transitions = map->raw_transitions(); |
| 541 if (TransitionArray::IsFullTransitionArray(raw_transitions)) { | 541 if (TransitionArray::IsFullTransitionArray(raw_transitions)) { |
| 542 MarkTransitionArray(heap, TransitionArray::cast(raw_transitions)); | 542 MarkTransitionArray(heap, TransitionArray::cast(raw_transitions)); |
| 543 } | 543 } |
| 544 | 544 |
| 545 // Since descriptor arrays are potentially shared, ensure that only the | |
| 546 // 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 | |
| 548 // holding the descriptor array will be implicitly recorded when the pointer | |
| 549 // 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 (map->is_prototype_map()) { |
| 552 descriptors->length() > 0) { | 547 // Prototype maps don't keep track of transitions, so just mark the entire |
| 553 StaticVisitor::VisitPointers(heap, descriptors->GetFirstElementAddress(), | 548 // descriptor array. |
| 554 descriptors->GetDescriptorEndSlot(0)); | 549 StaticVisitor::MarkObject(heap, descriptors); |
|
ulan
2015/07/06 09:47:04
No need to mark the array explicitly here: line 57
| |
| 555 } | 550 } else { |
| 556 int start = 0; | 551 // Since descriptor arrays are potentially shared, ensure that only the |
| 557 int end = map->NumberOfOwnDescriptors(); | 552 // descriptors that belong to this map are marked. The first time a |
| 558 if (start < end) { | 553 // non-empty descriptor array is marked, its header is also visited. The |
| 559 StaticVisitor::VisitPointers(heap, | 554 // slot holding the descriptor array will be implicitly recorded when the |
| 560 descriptors->GetDescriptorStartSlot(start), | 555 // pointer fields of this map are visited. |
| 561 descriptors->GetDescriptorEndSlot(end)); | 556 if (StaticVisitor::MarkObjectWithoutPush(heap, descriptors) && |
| 557 descriptors->length() > 0) { | |
| 558 StaticVisitor::VisitPointers(heap, descriptors->GetFirstElementAddress(), | |
| 559 descriptors->GetDescriptorEndSlot(0)); | |
| 560 } | |
| 561 int start = 0; | |
| 562 int end = map->NumberOfOwnDescriptors(); | |
| 563 if (start < end) { | |
| 564 StaticVisitor::VisitPointers(heap, | |
| 565 descriptors->GetDescriptorStartSlot(start), | |
| 566 descriptors->GetDescriptorEndSlot(end)); | |
| 567 } | |
| 562 } | 568 } |
| 563 | 569 |
| 564 // Mark the pointer fields of the Map. Since the transitions array has | 570 // 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 | 571 // been marked already, it is fine that one of these fields contains a |
| 566 // pointer to it. | 572 // pointer to it. |
| 567 StaticVisitor::VisitPointers( | 573 StaticVisitor::VisitPointers( |
| 568 heap, HeapObject::RawField(map, Map::kPointerFieldsBeginOffset), | 574 heap, HeapObject::RawField(map, Map::kPointerFieldsBeginOffset), |
| 569 HeapObject::RawField(map, Map::kPointerFieldsEndOffset)); | 575 HeapObject::RawField(map, Map::kPointerFieldsEndOffset)); |
| 570 } | 576 } |
| 571 | 577 |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 836 | 842 |
| 837 RelocIterator it(this, mode_mask); | 843 RelocIterator it(this, mode_mask); |
| 838 for (; !it.done(); it.next()) { | 844 for (; !it.done(); it.next()) { |
| 839 it.rinfo()->template Visit<StaticVisitor>(heap); | 845 it.rinfo()->template Visit<StaticVisitor>(heap); |
| 840 } | 846 } |
| 841 } | 847 } |
| 842 } | 848 } |
| 843 } // namespace v8::internal | 849 } // namespace v8::internal |
| 844 | 850 |
| 845 #endif // V8_OBJECTS_VISITING_INL_H_ | 851 #endif // V8_OBJECTS_VISITING_INL_H_ |
| OLD | NEW |