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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 } | 461 } |
462 } | 462 } |
463 VisitSharedFunctionInfoStrongCode(heap, object); | 463 VisitSharedFunctionInfoStrongCode(heap, object); |
464 } | 464 } |
465 | 465 |
466 | 466 |
467 template<typename StaticVisitor> | 467 template<typename StaticVisitor> |
468 void StaticMarkingVisitor<StaticVisitor>::VisitConstantPoolArray( | 468 void StaticMarkingVisitor<StaticVisitor>::VisitConstantPoolArray( |
469 Map* map, HeapObject* object) { | 469 Map* map, HeapObject* object) { |
470 Heap* heap = map->GetHeap(); | 470 Heap* heap = map->GetHeap(); |
471 ConstantPoolArray* constant_pool = ConstantPoolArray::cast(object); | 471 ConstantPoolArray* array = ConstantPoolArray::cast(object); |
472 for (int i = 0; i < constant_pool->count_of_code_ptr_entries(); i++) { | 472 ConstantPoolArray::Iterator code_iter(array, ConstantPoolArray::CODE_PTR); |
473 int index = constant_pool->first_code_ptr_index() + i; | 473 while (!code_iter.is_finished()) { |
474 Address code_entry = | 474 Address code_entry = reinterpret_cast<Address>( |
475 reinterpret_cast<Address>(constant_pool->RawFieldOfElementAt(index)); | 475 array->RawFieldOfElementAt(code_iter.next_index())); |
476 StaticVisitor::VisitCodeEntry(heap, code_entry); | 476 StaticVisitor::VisitCodeEntry(heap, code_entry); |
477 } | 477 } |
478 for (int i = 0; i < constant_pool->count_of_heap_ptr_entries(); i++) { | 478 |
479 int index = constant_pool->first_heap_ptr_index() + i; | 479 ConstantPoolArray::Iterator heap_iter(array, ConstantPoolArray::HEAP_PTR); |
480 Object** slot = constant_pool->RawFieldOfElementAt(index); | 480 while (!heap_iter.is_finished()) { |
| 481 Object** slot = array->RawFieldOfElementAt(heap_iter.next_index()); |
481 HeapObject* object = HeapObject::cast(*slot); | 482 HeapObject* object = HeapObject::cast(*slot); |
482 heap->mark_compact_collector()->RecordSlot(slot, slot, object); | 483 heap->mark_compact_collector()->RecordSlot(slot, slot, object); |
483 bool is_weak_object = | 484 bool is_weak_object = |
484 (constant_pool->get_weak_object_state() == | 485 (array->get_weak_object_state() == |
485 ConstantPoolArray::WEAK_OBJECTS_IN_OPTIMIZED_CODE && | 486 ConstantPoolArray::WEAK_OBJECTS_IN_OPTIMIZED_CODE && |
486 Code::IsWeakObjectInOptimizedCode(object)) || | 487 Code::IsWeakObjectInOptimizedCode(object)) || |
487 (constant_pool->get_weak_object_state() == | 488 (array->get_weak_object_state() == |
488 ConstantPoolArray::WEAK_OBJECTS_IN_IC && | 489 ConstantPoolArray::WEAK_OBJECTS_IN_IC && |
489 Code::IsWeakObjectInIC(object)); | 490 Code::IsWeakObjectInIC(object)); |
490 if (!is_weak_object) { | 491 if (!is_weak_object) { |
491 StaticVisitor::MarkObject(heap, object); | 492 StaticVisitor::MarkObject(heap, object); |
492 } | 493 } |
493 } | 494 } |
494 } | 495 } |
495 | 496 |
496 | 497 |
497 template<typename StaticVisitor> | 498 template<typename StaticVisitor> |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 RelocIterator it(this, mode_mask); | 931 RelocIterator it(this, mode_mask); |
931 for (; !it.done(); it.next()) { | 932 for (; !it.done(); it.next()) { |
932 it.rinfo()->template Visit<StaticVisitor>(heap); | 933 it.rinfo()->template Visit<StaticVisitor>(heap); |
933 } | 934 } |
934 } | 935 } |
935 | 936 |
936 | 937 |
937 } } // namespace v8::internal | 938 } } // namespace v8::internal |
938 | 939 |
939 #endif // V8_OBJECTS_VISITING_INL_H_ | 940 #endif // V8_OBJECTS_VISITING_INL_H_ |
OLD | NEW |