OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 // array slot, since it will be implicitly recorded when the pointer | 389 // array slot, since it will be implicitly recorded when the pointer |
390 // fields of this map are visited. | 390 // fields of this map are visited. |
391 TransitionArray* transitions = map->unchecked_transition_array(); | 391 TransitionArray* transitions = map->unchecked_transition_array(); |
392 if (transitions->IsTransitionArray()) { | 392 if (transitions->IsTransitionArray()) { |
393 MarkTransitionArray(heap, transitions); | 393 MarkTransitionArray(heap, transitions); |
394 } else { | 394 } else { |
395 // Already marked by marking map->GetBackPointer() above. | 395 // Already marked by marking map->GetBackPointer() above. |
396 ASSERT(transitions->IsMap() || transitions->IsUndefined()); | 396 ASSERT(transitions->IsMap() || transitions->IsUndefined()); |
397 } | 397 } |
398 | 398 |
| 399 // Since descriptor arrays are potentially shared, ensure that only the |
| 400 // descriptors that appeared for this map are marked. The first time a |
| 401 // non-empty descriptor array is marked, its header is also visited. The slot |
| 402 // holding the descriptor array will be implicitly recorded when the pointer |
| 403 // fields of this map are visited. |
| 404 DescriptorArray* descriptors = map->instance_descriptors(); |
| 405 if (StaticVisitor::MarkObjectWithoutPush(heap, descriptors) && |
| 406 descriptors->length() > 0) { |
| 407 StaticVisitor::VisitPointers(heap, |
| 408 descriptors->GetFirstElementAddress(), |
| 409 descriptors->GetDescriptorEndSlot(0)); |
| 410 } |
| 411 int start = 0; |
| 412 int end = map->NumberOfOwnDescriptors(); |
| 413 Object* back_pointer = map->GetBackPointer(); |
| 414 if (!back_pointer->IsUndefined()) { |
| 415 Map* parent_map = Map::cast(back_pointer); |
| 416 if (descriptors == parent_map->instance_descriptors()) { |
| 417 start = parent_map->NumberOfOwnDescriptors(); |
| 418 } |
| 419 } |
| 420 if (start < end) { |
| 421 StaticVisitor::VisitPointers(heap, |
| 422 descriptors->GetDescriptorStartSlot(start), |
| 423 descriptors->GetDescriptorEndSlot(end)); |
| 424 } |
| 425 |
399 // Mark prototype dependent codes array but do not push it onto marking | 426 // Mark prototype dependent codes array but do not push it onto marking |
400 // stack, this will make references from it weak. We will clean dead | 427 // stack, this will make references from it weak. We will clean dead |
401 // codes when we iterate over maps in ClearNonLiveTransitions. | 428 // codes when we iterate over maps in ClearNonLiveTransitions. |
402 Object** slot = HeapObject::RawField(map, Map::kDependentCodesOffset); | 429 Object** slot = HeapObject::RawField(map, Map::kDependentCodesOffset); |
403 HeapObject* obj = HeapObject::cast(*slot); | 430 HeapObject* obj = HeapObject::cast(*slot); |
404 heap->mark_compact_collector()->RecordSlot(slot, slot, obj); | 431 heap->mark_compact_collector()->RecordSlot(slot, slot, obj); |
405 StaticVisitor::MarkObjectWithoutPush(heap, obj); | 432 StaticVisitor::MarkObjectWithoutPush(heap, obj); |
406 | 433 |
407 // Mark the pointer fields of the Map. Since the transitions array has | 434 // Mark the pointer fields of the Map. Since the transitions array has |
408 // been marked already, it is fine that one of these fields contains a | 435 // been marked already, it is fine that one of these fields contains a |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 RelocIterator it(this, mode_mask); | 716 RelocIterator it(this, mode_mask); |
690 for (; !it.done(); it.next()) { | 717 for (; !it.done(); it.next()) { |
691 it.rinfo()->template Visit<StaticVisitor>(heap); | 718 it.rinfo()->template Visit<StaticVisitor>(heap); |
692 } | 719 } |
693 } | 720 } |
694 | 721 |
695 | 722 |
696 } } // namespace v8::internal | 723 } } // namespace v8::internal |
697 | 724 |
698 #endif // V8_OBJECTS_VISITING_INL_H_ | 725 #endif // V8_OBJECTS_VISITING_INL_H_ |
OLD | NEW |