| 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 Heap* heap, Address entry_address) { | 229 Heap* heap, Address entry_address) { |
| 230 Code* code = Code::cast(Code::GetObjectFromEntryAddress(entry_address)); | 230 Code* code = Code::cast(Code::GetObjectFromEntryAddress(entry_address)); |
| 231 heap->mark_compact_collector()->RecordCodeEntrySlot(entry_address, code); | 231 heap->mark_compact_collector()->RecordCodeEntrySlot(entry_address, code); |
| 232 StaticVisitor::MarkObject(heap, code); | 232 StaticVisitor::MarkObject(heap, code); |
| 233 } | 233 } |
| 234 | 234 |
| 235 | 235 |
| 236 template<typename StaticVisitor> | 236 template<typename StaticVisitor> |
| 237 void StaticMarkingVisitor<StaticVisitor>::VisitEmbeddedPointer( | 237 void StaticMarkingVisitor<StaticVisitor>::VisitEmbeddedPointer( |
| 238 Heap* heap, RelocInfo* rinfo) { | 238 Heap* heap, RelocInfo* rinfo) { |
| 239 ASSERT(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT); | 239 DCHECK(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT); |
| 240 HeapObject* object = HeapObject::cast(rinfo->target_object()); | 240 HeapObject* object = HeapObject::cast(rinfo->target_object()); |
| 241 heap->mark_compact_collector()->RecordRelocSlot(rinfo, object); | 241 heap->mark_compact_collector()->RecordRelocSlot(rinfo, object); |
| 242 // TODO(ulan): It could be better to record slots only for strongly embedded | 242 // TODO(ulan): It could be better to record slots only for strongly embedded |
| 243 // objects here and record slots for weakly embedded object during clearing | 243 // objects here and record slots for weakly embedded object during clearing |
| 244 // of non-live references in mark-compact. | 244 // of non-live references in mark-compact. |
| 245 if (!rinfo->host()->IsWeakObject(object)) { | 245 if (!rinfo->host()->IsWeakObject(object)) { |
| 246 StaticVisitor::MarkObject(heap, object); | 246 StaticVisitor::MarkObject(heap, object); |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 | 249 |
| 250 | 250 |
| 251 template<typename StaticVisitor> | 251 template<typename StaticVisitor> |
| 252 void StaticMarkingVisitor<StaticVisitor>::VisitCell( | 252 void StaticMarkingVisitor<StaticVisitor>::VisitCell( |
| 253 Heap* heap, RelocInfo* rinfo) { | 253 Heap* heap, RelocInfo* rinfo) { |
| 254 ASSERT(rinfo->rmode() == RelocInfo::CELL); | 254 DCHECK(rinfo->rmode() == RelocInfo::CELL); |
| 255 Cell* cell = rinfo->target_cell(); | 255 Cell* cell = rinfo->target_cell(); |
| 256 // No need to record slots because the cell space is not compacted during GC. | 256 // No need to record slots because the cell space is not compacted during GC. |
| 257 if (!rinfo->host()->IsWeakObject(cell)) { | 257 if (!rinfo->host()->IsWeakObject(cell)) { |
| 258 StaticVisitor::MarkObject(heap, cell); | 258 StaticVisitor::MarkObject(heap, cell); |
| 259 } | 259 } |
| 260 } | 260 } |
| 261 | 261 |
| 262 | 262 |
| 263 template<typename StaticVisitor> | 263 template<typename StaticVisitor> |
| 264 void StaticMarkingVisitor<StaticVisitor>::VisitDebugTarget( | 264 void StaticMarkingVisitor<StaticVisitor>::VisitDebugTarget( |
| 265 Heap* heap, RelocInfo* rinfo) { | 265 Heap* heap, RelocInfo* rinfo) { |
| 266 ASSERT((RelocInfo::IsJSReturn(rinfo->rmode()) && | 266 DCHECK((RelocInfo::IsJSReturn(rinfo->rmode()) && |
| 267 rinfo->IsPatchedReturnSequence()) || | 267 rinfo->IsPatchedReturnSequence()) || |
| 268 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && | 268 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && |
| 269 rinfo->IsPatchedDebugBreakSlotSequence())); | 269 rinfo->IsPatchedDebugBreakSlotSequence())); |
| 270 Code* target = Code::GetCodeFromTargetAddress(rinfo->call_address()); | 270 Code* target = Code::GetCodeFromTargetAddress(rinfo->call_address()); |
| 271 heap->mark_compact_collector()->RecordRelocSlot(rinfo, target); | 271 heap->mark_compact_collector()->RecordRelocSlot(rinfo, target); |
| 272 StaticVisitor::MarkObject(heap, target); | 272 StaticVisitor::MarkObject(heap, target); |
| 273 } | 273 } |
| 274 | 274 |
| 275 | 275 |
| 276 template<typename StaticVisitor> | 276 template<typename StaticVisitor> |
| 277 void StaticMarkingVisitor<StaticVisitor>::VisitCodeTarget( | 277 void StaticMarkingVisitor<StaticVisitor>::VisitCodeTarget( |
| 278 Heap* heap, RelocInfo* rinfo) { | 278 Heap* heap, RelocInfo* rinfo) { |
| 279 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode())); | 279 DCHECK(RelocInfo::IsCodeTarget(rinfo->rmode())); |
| 280 Code* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); | 280 Code* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); |
| 281 // Monomorphic ICs are preserved when possible, but need to be flushed | 281 // Monomorphic ICs are preserved when possible, but need to be flushed |
| 282 // when they might be keeping a Context alive, or when the heap is about | 282 // when they might be keeping a Context alive, or when the heap is about |
| 283 // to be serialized. | 283 // to be serialized. |
| 284 if (FLAG_cleanup_code_caches_at_gc && target->is_inline_cache_stub() | 284 if (FLAG_cleanup_code_caches_at_gc && target->is_inline_cache_stub() |
| 285 && (target->ic_state() == MEGAMORPHIC || target->ic_state() == GENERIC || | 285 && (target->ic_state() == MEGAMORPHIC || target->ic_state() == GENERIC || |
| 286 target->ic_state() == POLYMORPHIC || heap->flush_monomorphic_ics() || | 286 target->ic_state() == POLYMORPHIC || heap->flush_monomorphic_ics() || |
| 287 heap->isolate()->serializer_enabled() || | 287 heap->isolate()->serializer_enabled() || |
| 288 target->ic_age() != heap->global_ic_age() || | 288 target->ic_age() != heap->global_ic_age() || |
| 289 target->is_invalidated_weak_stub())) { | 289 target->is_invalidated_weak_stub())) { |
| 290 IC::Clear(heap->isolate(), rinfo->pc(), rinfo->host()->constant_pool()); | 290 IC::Clear(heap->isolate(), rinfo->pc(), rinfo->host()->constant_pool()); |
| 291 target = Code::GetCodeFromTargetAddress(rinfo->target_address()); | 291 target = Code::GetCodeFromTargetAddress(rinfo->target_address()); |
| 292 } | 292 } |
| 293 heap->mark_compact_collector()->RecordRelocSlot(rinfo, target); | 293 heap->mark_compact_collector()->RecordRelocSlot(rinfo, target); |
| 294 StaticVisitor::MarkObject(heap, target); | 294 StaticVisitor::MarkObject(heap, target); |
| 295 } | 295 } |
| 296 | 296 |
| 297 | 297 |
| 298 template<typename StaticVisitor> | 298 template<typename StaticVisitor> |
| 299 void StaticMarkingVisitor<StaticVisitor>::VisitCodeAgeSequence( | 299 void StaticMarkingVisitor<StaticVisitor>::VisitCodeAgeSequence( |
| 300 Heap* heap, RelocInfo* rinfo) { | 300 Heap* heap, RelocInfo* rinfo) { |
| 301 ASSERT(RelocInfo::IsCodeAgeSequence(rinfo->rmode())); | 301 DCHECK(RelocInfo::IsCodeAgeSequence(rinfo->rmode())); |
| 302 Code* target = rinfo->code_age_stub(); | 302 Code* target = rinfo->code_age_stub(); |
| 303 ASSERT(target != NULL); | 303 DCHECK(target != NULL); |
| 304 heap->mark_compact_collector()->RecordRelocSlot(rinfo, target); | 304 heap->mark_compact_collector()->RecordRelocSlot(rinfo, target); |
| 305 StaticVisitor::MarkObject(heap, target); | 305 StaticVisitor::MarkObject(heap, target); |
| 306 } | 306 } |
| 307 | 307 |
| 308 | 308 |
| 309 template<typename StaticVisitor> | 309 template<typename StaticVisitor> |
| 310 void StaticMarkingVisitor<StaticVisitor>::VisitNativeContext( | 310 void StaticMarkingVisitor<StaticVisitor>::VisitNativeContext( |
| 311 Map* map, HeapObject* object) { | 311 Map* map, HeapObject* object) { |
| 312 FixedBodyVisitor<StaticVisitor, | 312 FixedBodyVisitor<StaticVisitor, |
| 313 Context::MarkCompactBodyDescriptor, | 313 Context::MarkCompactBodyDescriptor, |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 962 RelocIterator it(this, mode_mask); | 962 RelocIterator it(this, mode_mask); |
| 963 for (; !it.done(); it.next()) { | 963 for (; !it.done(); it.next()) { |
| 964 it.rinfo()->template Visit<StaticVisitor>(heap); | 964 it.rinfo()->template Visit<StaticVisitor>(heap); |
| 965 } | 965 } |
| 966 } | 966 } |
| 967 | 967 |
| 968 | 968 |
| 969 } } // namespace v8::internal | 969 } } // namespace v8::internal |
| 970 | 970 |
| 971 #endif // V8_OBJECTS_VISITING_INL_H_ | 971 #endif // V8_OBJECTS_VISITING_INL_H_ |
| OLD | NEW |