| 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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 template <typename StaticVisitor> | 256 template <typename StaticVisitor> |
| 257 void StaticMarkingVisitor<StaticVisitor>::VisitCodeTarget(Heap* heap, | 257 void StaticMarkingVisitor<StaticVisitor>::VisitCodeTarget(Heap* heap, |
| 258 RelocInfo* rinfo) { | 258 RelocInfo* rinfo) { |
| 259 DCHECK(RelocInfo::IsCodeTarget(rinfo->rmode())); | 259 DCHECK(RelocInfo::IsCodeTarget(rinfo->rmode())); |
| 260 Code* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); | 260 Code* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); |
| 261 // Monomorphic ICs are preserved when possible, but need to be flushed | 261 // Monomorphic ICs are preserved when possible, but need to be flushed |
| 262 // when they might be keeping a Context alive, or when the heap is about | 262 // when they might be keeping a Context alive, or when the heap is about |
| 263 // to be serialized. | 263 // to be serialized. |
| 264 if (FLAG_cleanup_code_caches_at_gc && target->is_inline_cache_stub() && | 264 if (FLAG_cleanup_code_caches_at_gc && target->is_inline_cache_stub() && |
| 265 !target->is_call_stub() && | 265 !target->is_call_stub() && |
| 266 ((heap->flush_monomorphic_ics() && !target->is_weak_stub()) || | 266 ((heap->flush_monomorphic_ics() && !target->embeds_maps_weakly()) || |
| 267 heap->isolate()->serializer_enabled() || | 267 heap->isolate()->serializer_enabled() || |
| 268 target->ic_age() != heap->global_ic_age() || | 268 target->ic_age() != heap->global_ic_age())) { |
| 269 target->is_invalidated_weak_stub())) { | |
| 270 ICUtility::Clear(heap->isolate(), rinfo->pc(), | 269 ICUtility::Clear(heap->isolate(), rinfo->pc(), |
| 271 rinfo->host()->constant_pool()); | 270 rinfo->host()->constant_pool()); |
| 272 target = Code::GetCodeFromTargetAddress(rinfo->target_address()); | 271 target = Code::GetCodeFromTargetAddress(rinfo->target_address()); |
| 273 } | 272 } |
| 274 heap->mark_compact_collector()->RecordRelocSlot(rinfo, target); | 273 heap->mark_compact_collector()->RecordRelocSlot(rinfo, target); |
| 275 StaticVisitor::MarkObject(heap, target); | 274 StaticVisitor::MarkObject(heap, target); |
| 276 } | 275 } |
| 277 | 276 |
| 278 | 277 |
| 279 template <typename StaticVisitor> | 278 template <typename StaticVisitor> |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 } | 500 } |
| 502 | 501 |
| 503 ConstantPoolArray::Iterator heap_iter(array, ConstantPoolArray::HEAP_PTR); | 502 ConstantPoolArray::Iterator heap_iter(array, ConstantPoolArray::HEAP_PTR); |
| 504 while (!heap_iter.is_finished()) { | 503 while (!heap_iter.is_finished()) { |
| 505 Object** slot = array->RawFieldOfElementAt(heap_iter.next_index()); | 504 Object** slot = array->RawFieldOfElementAt(heap_iter.next_index()); |
| 506 HeapObject* object = HeapObject::cast(*slot); | 505 HeapObject* object = HeapObject::cast(*slot); |
| 507 heap->mark_compact_collector()->RecordSlot(slot, slot, object); | 506 heap->mark_compact_collector()->RecordSlot(slot, slot, object); |
| 508 bool is_weak_object = | 507 bool is_weak_object = |
| 509 (array->get_weak_object_state() == | 508 (array->get_weak_object_state() == |
| 510 ConstantPoolArray::WEAK_OBJECTS_IN_OPTIMIZED_CODE && | 509 ConstantPoolArray::WEAK_OBJECTS_IN_OPTIMIZED_CODE && |
| 511 Code::IsWeakObjectInOptimizedCode(object)) || | 510 Code::IsWeakObjectInOptimizedCode(object)); |
| 512 (array->get_weak_object_state() == | |
| 513 ConstantPoolArray::WEAK_OBJECTS_IN_IC && | |
| 514 Code::IsWeakObjectInIC(object)); | |
| 515 if (!is_weak_object) { | 511 if (!is_weak_object) { |
| 516 StaticVisitor::MarkObject(heap, object); | 512 StaticVisitor::MarkObject(heap, object); |
| 517 } | 513 } |
| 518 } | 514 } |
| 519 } | 515 } |
| 520 | 516 |
| 521 | 517 |
| 522 template <typename StaticVisitor> | 518 template <typename StaticVisitor> |
| 523 void StaticMarkingVisitor<StaticVisitor>::VisitJSFunction(Map* map, | 519 void StaticMarkingVisitor<StaticVisitor>::VisitJSFunction(Map* map, |
| 524 HeapObject* object) { | 520 HeapObject* object) { |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 | 938 |
| 943 RelocIterator it(this, mode_mask); | 939 RelocIterator it(this, mode_mask); |
| 944 for (; !it.done(); it.next()) { | 940 for (; !it.done(); it.next()) { |
| 945 it.rinfo()->template Visit<StaticVisitor>(heap); | 941 it.rinfo()->template Visit<StaticVisitor>(heap); |
| 946 } | 942 } |
| 947 } | 943 } |
| 948 } | 944 } |
| 949 } // namespace v8::internal | 945 } // namespace v8::internal |
| 950 | 946 |
| 951 #endif // V8_OBJECTS_VISITING_INL_H_ | 947 #endif // V8_OBJECTS_VISITING_INL_H_ |
| OLD | NEW |