| 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 399 // Since descriptor arrays are potentially shared, ensure that only the |
| 400 // descriptors that appeared for this map are marked. The first time a | 400 // descriptors that belong to this map are marked. The first time a |
| 401 // non-empty descriptor array is marked, its header is also visited. The slot | 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 | 402 // holding the descriptor array will be implicitly recorded when the pointer |
| 403 // fields of this map are visited. | 403 // fields of this map are visited. |
| 404 DescriptorArray* descriptors = map->instance_descriptors(); | 404 DescriptorArray* descriptors = map->instance_descriptors(); |
| 405 if (StaticVisitor::MarkObjectWithoutPush(heap, descriptors) && | 405 if (StaticVisitor::MarkObjectWithoutPush(heap, descriptors) && |
| 406 descriptors->length() > 0) { | 406 descriptors->length() > 0) { |
| 407 StaticVisitor::VisitPointers(heap, | 407 StaticVisitor::VisitPointers(heap, |
| 408 descriptors->GetFirstElementAddress(), | 408 descriptors->GetFirstElementAddress(), |
| 409 descriptors->GetDescriptorEndSlot(0)); | 409 descriptors->GetDescriptorEndSlot(0)); |
| 410 } | 410 } |
| 411 int start = 0; | 411 int start = 0; |
| 412 int end = map->NumberOfOwnDescriptors(); | 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) { | 413 if (start < end) { |
| 421 StaticVisitor::VisitPointers(heap, | 414 StaticVisitor::VisitPointers(heap, |
| 422 descriptors->GetDescriptorStartSlot(start), | 415 descriptors->GetDescriptorStartSlot(start), |
| 423 descriptors->GetDescriptorEndSlot(end)); | 416 descriptors->GetDescriptorEndSlot(end)); |
| 424 } | 417 } |
| 425 | 418 |
| 426 // Mark prototype dependent codes array but do not push it onto marking | 419 // Mark prototype dependent codes array but do not push it onto marking |
| 427 // stack, this will make references from it weak. We will clean dead | 420 // stack, this will make references from it weak. We will clean dead |
| 428 // codes when we iterate over maps in ClearNonLiveTransitions. | 421 // codes when we iterate over maps in ClearNonLiveTransitions. |
| 429 Object** slot = HeapObject::RawField(map, Map::kDependentCodesOffset); | 422 Object** slot = HeapObject::RawField(map, Map::kDependentCodesOffset); |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 RelocIterator it(this, mode_mask); | 709 RelocIterator it(this, mode_mask); |
| 717 for (; !it.done(); it.next()) { | 710 for (; !it.done(); it.next()) { |
| 718 it.rinfo()->template Visit<StaticVisitor>(heap); | 711 it.rinfo()->template Visit<StaticVisitor>(heap); |
| 719 } | 712 } |
| 720 } | 713 } |
| 721 | 714 |
| 722 | 715 |
| 723 } } // namespace v8::internal | 716 } } // namespace v8::internal |
| 724 | 717 |
| 725 #endif // V8_OBJECTS_VISITING_INL_H_ | 718 #endif // V8_OBJECTS_VISITING_INL_H_ |
| OLD | NEW |