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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 &FixedBodyVisitor<StaticVisitor, Symbol::BodyDescriptor, void>::Visit); | 130 &FixedBodyVisitor<StaticVisitor, Symbol::BodyDescriptor, void>::Visit); |
131 | 131 |
132 table_.Register(kVisitFixedArray, &FixedArrayVisitor::Visit); | 132 table_.Register(kVisitFixedArray, &FixedArrayVisitor::Visit); |
133 | 133 |
134 table_.Register(kVisitFixedDoubleArray, &DataObjectVisitor::Visit); | 134 table_.Register(kVisitFixedDoubleArray, &DataObjectVisitor::Visit); |
135 | 135 |
136 table_.Register(kVisitFixedTypedArray, &DataObjectVisitor::Visit); | 136 table_.Register(kVisitFixedTypedArray, &DataObjectVisitor::Visit); |
137 | 137 |
138 table_.Register(kVisitFixedFloat64Array, &DataObjectVisitor::Visit); | 138 table_.Register(kVisitFixedFloat64Array, &DataObjectVisitor::Visit); |
139 | 139 |
140 table_.Register(kVisitConstantPoolArray, &VisitConstantPoolArray); | |
141 | |
142 table_.Register(kVisitNativeContext, &VisitNativeContext); | 140 table_.Register(kVisitNativeContext, &VisitNativeContext); |
143 | 141 |
144 table_.Register(kVisitAllocationSite, &VisitAllocationSite); | 142 table_.Register(kVisitAllocationSite, &VisitAllocationSite); |
145 | 143 |
146 table_.Register(kVisitByteArray, &DataObjectVisitor::Visit); | 144 table_.Register(kVisitByteArray, &DataObjectVisitor::Visit); |
147 | 145 |
148 table_.Register(kVisitFreeSpace, &DataObjectVisitor::Visit); | 146 table_.Register(kVisitFreeSpace, &DataObjectVisitor::Visit); |
149 | 147 |
150 table_.Register(kVisitSeqOneByteString, &DataObjectVisitor::Visit); | 148 table_.Register(kVisitSeqOneByteString, &DataObjectVisitor::Visit); |
151 | 149 |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 // Flush optimized code map on major GCs without code flushing, | 439 // Flush optimized code map on major GCs without code flushing, |
442 // needed because cached code doesn't contain breakpoints. | 440 // needed because cached code doesn't contain breakpoints. |
443 shared->ClearOptimizedCodeMap(); | 441 shared->ClearOptimizedCodeMap(); |
444 } | 442 } |
445 } | 443 } |
446 VisitSharedFunctionInfoStrongCode(heap, object); | 444 VisitSharedFunctionInfoStrongCode(heap, object); |
447 } | 445 } |
448 | 446 |
449 | 447 |
450 template <typename StaticVisitor> | 448 template <typename StaticVisitor> |
451 void StaticMarkingVisitor<StaticVisitor>::VisitConstantPoolArray( | |
452 Map* map, HeapObject* object) { | |
453 Heap* heap = map->GetHeap(); | |
454 ConstantPoolArray* array = ConstantPoolArray::cast(object); | |
455 ConstantPoolArray::Iterator code_iter(array, ConstantPoolArray::CODE_PTR); | |
456 while (!code_iter.is_finished()) { | |
457 Address code_entry = reinterpret_cast<Address>( | |
458 array->RawFieldOfElementAt(code_iter.next_index())); | |
459 StaticVisitor::VisitCodeEntry(heap, code_entry); | |
460 } | |
461 | |
462 ConstantPoolArray::Iterator heap_iter(array, ConstantPoolArray::HEAP_PTR); | |
463 while (!heap_iter.is_finished()) { | |
464 Object** slot = array->RawFieldOfElementAt(heap_iter.next_index()); | |
465 HeapObject* object = HeapObject::cast(*slot); | |
466 heap->mark_compact_collector()->RecordSlot(slot, slot, object); | |
467 bool is_weak_object = | |
468 (array->get_weak_object_state() == | |
469 ConstantPoolArray::WEAK_OBJECTS_IN_OPTIMIZED_CODE && | |
470 Code::IsWeakObjectInOptimizedCode(object)); | |
471 if (!is_weak_object) { | |
472 StaticVisitor::MarkObject(heap, object); | |
473 } | |
474 } | |
475 } | |
476 | |
477 | |
478 template <typename StaticVisitor> | |
479 void StaticMarkingVisitor<StaticVisitor>::VisitJSFunction(Map* map, | 449 void StaticMarkingVisitor<StaticVisitor>::VisitJSFunction(Map* map, |
480 HeapObject* object) { | 450 HeapObject* object) { |
481 Heap* heap = map->GetHeap(); | 451 Heap* heap = map->GetHeap(); |
482 JSFunction* function = JSFunction::cast(object); | 452 JSFunction* function = JSFunction::cast(object); |
483 MarkCompactCollector* collector = heap->mark_compact_collector(); | 453 MarkCompactCollector* collector = heap->mark_compact_collector(); |
484 if (collector->is_code_flushing_enabled()) { | 454 if (collector->is_code_flushing_enabled()) { |
485 if (IsFlushable(heap, function)) { | 455 if (IsFlushable(heap, function)) { |
486 // This function's code looks flushable. But we have to postpone | 456 // This function's code looks flushable. But we have to postpone |
487 // the decision until we see all functions that point to the same | 457 // the decision until we see all functions that point to the same |
488 // SharedFunctionInfo because some of them might be optimized. | 458 // SharedFunctionInfo because some of them might be optimized. |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | | 789 RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | |
820 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); | 790 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); |
821 | 791 |
822 // There are two places where we iterate code bodies: here and the | 792 // There are two places where we iterate code bodies: here and the |
823 // templated CodeIterateBody (below). They should be kept in sync. | 793 // templated CodeIterateBody (below). They should be kept in sync. |
824 IteratePointer(v, kRelocationInfoOffset); | 794 IteratePointer(v, kRelocationInfoOffset); |
825 IteratePointer(v, kHandlerTableOffset); | 795 IteratePointer(v, kHandlerTableOffset); |
826 IteratePointer(v, kDeoptimizationDataOffset); | 796 IteratePointer(v, kDeoptimizationDataOffset); |
827 IteratePointer(v, kTypeFeedbackInfoOffset); | 797 IteratePointer(v, kTypeFeedbackInfoOffset); |
828 IterateNextCodeLink(v, kNextCodeLinkOffset); | 798 IterateNextCodeLink(v, kNextCodeLinkOffset); |
829 IteratePointer(v, kConstantPoolOffset); | |
830 | 799 |
831 RelocIterator it(this, mode_mask); | 800 RelocIterator it(this, mode_mask); |
832 Isolate* isolate = this->GetIsolate(); | 801 Isolate* isolate = this->GetIsolate(); |
833 for (; !it.done(); it.next()) { | 802 for (; !it.done(); it.next()) { |
834 it.rinfo()->Visit(isolate, v); | 803 it.rinfo()->Visit(isolate, v); |
835 } | 804 } |
836 } | 805 } |
837 | 806 |
838 | 807 |
839 template <typename StaticVisitor> | 808 template <typename StaticVisitor> |
(...skipping 16 matching lines...) Expand all Loading... |
856 StaticVisitor::VisitPointer( | 825 StaticVisitor::VisitPointer( |
857 heap, reinterpret_cast<Object**>(this->address() + kHandlerTableOffset)); | 826 heap, reinterpret_cast<Object**>(this->address() + kHandlerTableOffset)); |
858 StaticVisitor::VisitPointer( | 827 StaticVisitor::VisitPointer( |
859 heap, | 828 heap, |
860 reinterpret_cast<Object**>(this->address() + kDeoptimizationDataOffset)); | 829 reinterpret_cast<Object**>(this->address() + kDeoptimizationDataOffset)); |
861 StaticVisitor::VisitPointer( | 830 StaticVisitor::VisitPointer( |
862 heap, | 831 heap, |
863 reinterpret_cast<Object**>(this->address() + kTypeFeedbackInfoOffset)); | 832 reinterpret_cast<Object**>(this->address() + kTypeFeedbackInfoOffset)); |
864 StaticVisitor::VisitNextCodeLink( | 833 StaticVisitor::VisitNextCodeLink( |
865 heap, reinterpret_cast<Object**>(this->address() + kNextCodeLinkOffset)); | 834 heap, reinterpret_cast<Object**>(this->address() + kNextCodeLinkOffset)); |
866 StaticVisitor::VisitPointer( | |
867 heap, reinterpret_cast<Object**>(this->address() + kConstantPoolOffset)); | |
868 | 835 |
869 | 836 |
870 RelocIterator it(this, mode_mask); | 837 RelocIterator it(this, mode_mask); |
871 for (; !it.done(); it.next()) { | 838 for (; !it.done(); it.next()) { |
872 it.rinfo()->template Visit<StaticVisitor>(heap); | 839 it.rinfo()->template Visit<StaticVisitor>(heap); |
873 } | 840 } |
874 } | 841 } |
875 } | 842 } |
876 } // namespace v8::internal | 843 } // namespace v8::internal |
877 | 844 |
878 #endif // V8_OBJECTS_VISITING_INL_H_ | 845 #endif // V8_OBJECTS_VISITING_INL_H_ |
OLD | NEW |