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 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 } | 491 } |
492 } | 492 } |
493 VisitSharedFunctionInfoStrongCode(heap, object); | 493 VisitSharedFunctionInfoStrongCode(heap, object); |
494 } | 494 } |
495 | 495 |
496 | 496 |
497 template<typename StaticVisitor> | 497 template<typename StaticVisitor> |
498 void StaticMarkingVisitor<StaticVisitor>::VisitConstantPoolArray( | 498 void StaticMarkingVisitor<StaticVisitor>::VisitConstantPoolArray( |
499 Map* map, HeapObject* object) { | 499 Map* map, HeapObject* object) { |
500 Heap* heap = map->GetHeap(); | 500 Heap* heap = map->GetHeap(); |
501 ConstantPoolArray* constant_pool = ConstantPoolArray::cast(object); | 501 ConstantPoolArray* array = ConstantPoolArray::cast(object); |
502 for (int i = 0; i < constant_pool->count_of_code_ptr_entries(); i++) { | 502 ConstantPoolArray::Iterator code_iter(array, ConstantPoolArray::CODE_PTR); |
503 int index = constant_pool->first_code_ptr_index() + i; | 503 while (!code_iter.is_finished()) { |
504 Address code_entry = | 504 Address code_entry = reinterpret_cast<Address>( |
505 reinterpret_cast<Address>(constant_pool->RawFieldOfElementAt(index)); | 505 array->RawFieldOfElementAt(code_iter.next_index())); |
506 StaticVisitor::VisitCodeEntry(heap, code_entry); | 506 StaticVisitor::VisitCodeEntry(heap, code_entry); |
507 } | 507 } |
508 for (int i = 0; i < constant_pool->count_of_heap_ptr_entries(); i++) { | 508 |
509 int index = constant_pool->first_heap_ptr_index() + i; | 509 ConstantPoolArray::Iterator heap_iter(array, ConstantPoolArray::HEAP_PTR); |
510 Object** slot = constant_pool->RawFieldOfElementAt(index); | 510 while (!heap_iter.is_finished()) { |
| 511 Object** slot = array->RawFieldOfElementAt(heap_iter.next_index()); |
511 HeapObject* object = HeapObject::cast(*slot); | 512 HeapObject* object = HeapObject::cast(*slot); |
512 heap->mark_compact_collector()->RecordSlot(slot, slot, object); | 513 heap->mark_compact_collector()->RecordSlot(slot, slot, object); |
513 bool is_weak_object = | 514 bool is_weak_object = |
514 (constant_pool->get_weak_object_state() == | 515 (array->get_weak_object_state() == |
515 ConstantPoolArray::WEAK_OBJECTS_IN_OPTIMIZED_CODE && | 516 ConstantPoolArray::WEAK_OBJECTS_IN_OPTIMIZED_CODE && |
516 Code::IsWeakObjectInOptimizedCode(object)) || | 517 Code::IsWeakObjectInOptimizedCode(object)) || |
517 (constant_pool->get_weak_object_state() == | 518 (array->get_weak_object_state() == |
518 ConstantPoolArray::WEAK_OBJECTS_IN_IC && | 519 ConstantPoolArray::WEAK_OBJECTS_IN_IC && |
519 Code::IsWeakObjectInIC(object)); | 520 Code::IsWeakObjectInIC(object)); |
520 if (!is_weak_object) { | 521 if (!is_weak_object) { |
521 StaticVisitor::MarkObject(heap, object); | 522 StaticVisitor::MarkObject(heap, object); |
522 } | 523 } |
523 } | 524 } |
524 } | 525 } |
525 | 526 |
526 | 527 |
527 template<typename StaticVisitor> | 528 template<typename StaticVisitor> |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 RelocIterator it(this, mode_mask); | 961 RelocIterator it(this, mode_mask); |
961 for (; !it.done(); it.next()) { | 962 for (; !it.done(); it.next()) { |
962 it.rinfo()->template Visit<StaticVisitor>(heap); | 963 it.rinfo()->template Visit<StaticVisitor>(heap); |
963 } | 964 } |
964 } | 965 } |
965 | 966 |
966 | 967 |
967 } } // namespace v8::internal | 968 } } // namespace v8::internal |
968 | 969 |
969 #endif // V8_OBJECTS_VISITING_INL_H_ | 970 #endif // V8_OBJECTS_VISITING_INL_H_ |
OLD | NEW |