| 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/array-buffer-tracker.h" | 8 #include "src/heap/array-buffer-tracker.h" |
| 9 #include "src/heap/objects-visiting.h" | 9 #include "src/heap/objects-visiting.h" |
| 10 #include "src/ic/ic-state.h" | 10 #include "src/ic/ic-state.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 code); | 213 code); |
| 214 StaticVisitor::MarkObject(heap, code); | 214 StaticVisitor::MarkObject(heap, code); |
| 215 } | 215 } |
| 216 | 216 |
| 217 | 217 |
| 218 template <typename StaticVisitor> | 218 template <typename StaticVisitor> |
| 219 void StaticMarkingVisitor<StaticVisitor>::VisitEmbeddedPointer( | 219 void StaticMarkingVisitor<StaticVisitor>::VisitEmbeddedPointer( |
| 220 Heap* heap, RelocInfo* rinfo) { | 220 Heap* heap, RelocInfo* rinfo) { |
| 221 DCHECK(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT); | 221 DCHECK(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT); |
| 222 HeapObject* object = HeapObject::cast(rinfo->target_object()); | 222 HeapObject* object = HeapObject::cast(rinfo->target_object()); |
| 223 heap->mark_compact_collector()->RecordRelocSlot(rinfo, object); | 223 Code* host = rinfo->host(); |
| 224 heap->mark_compact_collector()->RecordRelocSlot(host, rinfo, object); |
| 224 // TODO(ulan): It could be better to record slots only for strongly embedded | 225 // TODO(ulan): It could be better to record slots only for strongly embedded |
| 225 // objects here and record slots for weakly embedded object during clearing | 226 // objects here and record slots for weakly embedded object during clearing |
| 226 // of non-live references in mark-compact. | 227 // of non-live references in mark-compact. |
| 227 if (!rinfo->host()->IsWeakObject(object)) { | 228 if (!host->IsWeakObject(object)) { |
| 228 StaticVisitor::MarkObject(heap, object); | 229 StaticVisitor::MarkObject(heap, object); |
| 229 } | 230 } |
| 230 } | 231 } |
| 231 | 232 |
| 232 | 233 |
| 233 template <typename StaticVisitor> | 234 template <typename StaticVisitor> |
| 234 void StaticMarkingVisitor<StaticVisitor>::VisitCell(Heap* heap, | 235 void StaticMarkingVisitor<StaticVisitor>::VisitCell(Heap* heap, |
| 235 RelocInfo* rinfo) { | 236 RelocInfo* rinfo) { |
| 236 DCHECK(rinfo->rmode() == RelocInfo::CELL); | 237 DCHECK(rinfo->rmode() == RelocInfo::CELL); |
| 237 Cell* cell = rinfo->target_cell(); | 238 Cell* cell = rinfo->target_cell(); |
| 238 heap->mark_compact_collector()->RecordRelocSlot(rinfo, cell); | 239 Code* host = rinfo->host(); |
| 239 if (!rinfo->host()->IsWeakObject(cell)) { | 240 heap->mark_compact_collector()->RecordRelocSlot(host, rinfo, cell); |
| 241 if (!host->IsWeakObject(cell)) { |
| 240 StaticVisitor::MarkObject(heap, cell); | 242 StaticVisitor::MarkObject(heap, cell); |
| 241 } | 243 } |
| 242 } | 244 } |
| 243 | 245 |
| 244 | 246 |
| 245 template <typename StaticVisitor> | 247 template <typename StaticVisitor> |
| 246 void StaticMarkingVisitor<StaticVisitor>::VisitDebugTarget(Heap* heap, | 248 void StaticMarkingVisitor<StaticVisitor>::VisitDebugTarget(Heap* heap, |
| 247 RelocInfo* rinfo) { | 249 RelocInfo* rinfo) { |
| 248 DCHECK(RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && | 250 DCHECK(RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && |
| 249 rinfo->IsPatchedDebugBreakSlotSequence()); | 251 rinfo->IsPatchedDebugBreakSlotSequence()); |
| 250 Code* target = Code::GetCodeFromTargetAddress(rinfo->debug_call_address()); | 252 Code* target = Code::GetCodeFromTargetAddress(rinfo->debug_call_address()); |
| 251 heap->mark_compact_collector()->RecordRelocSlot(rinfo, target); | 253 Code* host = rinfo->host(); |
| 254 heap->mark_compact_collector()->RecordRelocSlot(host, rinfo, target); |
| 252 StaticVisitor::MarkObject(heap, target); | 255 StaticVisitor::MarkObject(heap, target); |
| 253 } | 256 } |
| 254 | 257 |
| 255 | 258 |
| 256 template <typename StaticVisitor> | 259 template <typename StaticVisitor> |
| 257 void StaticMarkingVisitor<StaticVisitor>::VisitCodeTarget(Heap* heap, | 260 void StaticMarkingVisitor<StaticVisitor>::VisitCodeTarget(Heap* heap, |
| 258 RelocInfo* rinfo) { | 261 RelocInfo* rinfo) { |
| 259 DCHECK(RelocInfo::IsCodeTarget(rinfo->rmode())); | 262 DCHECK(RelocInfo::IsCodeTarget(rinfo->rmode())); |
| 260 Code* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); | 263 Code* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); |
| 261 // Monomorphic ICs are preserved when possible, but need to be flushed | 264 // 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 | 265 // when they might be keeping a Context alive, or when the heap is about |
| 263 // to be serialized. | 266 // to be serialized. |
| 264 if (FLAG_cleanup_code_caches_at_gc && target->is_inline_cache_stub() && | 267 if (FLAG_cleanup_code_caches_at_gc && target->is_inline_cache_stub() && |
| 265 !target->is_call_stub() && (heap->isolate()->serializer_enabled() || | 268 !target->is_call_stub() && (heap->isolate()->serializer_enabled() || |
| 266 target->ic_age() != heap->global_ic_age())) { | 269 target->ic_age() != heap->global_ic_age())) { |
| 267 ICUtility::Clear(heap->isolate(), rinfo->pc(), | 270 ICUtility::Clear(heap->isolate(), rinfo->pc(), |
| 268 rinfo->host()->constant_pool()); | 271 rinfo->host()->constant_pool()); |
| 269 target = Code::GetCodeFromTargetAddress(rinfo->target_address()); | 272 target = Code::GetCodeFromTargetAddress(rinfo->target_address()); |
| 270 } | 273 } |
| 271 heap->mark_compact_collector()->RecordRelocSlot(rinfo, target); | 274 Code* host = rinfo->host(); |
| 275 heap->mark_compact_collector()->RecordRelocSlot(host, rinfo, target); |
| 272 StaticVisitor::MarkObject(heap, target); | 276 StaticVisitor::MarkObject(heap, target); |
| 273 } | 277 } |
| 274 | 278 |
| 275 | 279 |
| 276 template <typename StaticVisitor> | 280 template <typename StaticVisitor> |
| 277 void StaticMarkingVisitor<StaticVisitor>::VisitCodeAgeSequence( | 281 void StaticMarkingVisitor<StaticVisitor>::VisitCodeAgeSequence( |
| 278 Heap* heap, RelocInfo* rinfo) { | 282 Heap* heap, RelocInfo* rinfo) { |
| 279 DCHECK(RelocInfo::IsCodeAgeSequence(rinfo->rmode())); | 283 DCHECK(RelocInfo::IsCodeAgeSequence(rinfo->rmode())); |
| 280 Code* target = rinfo->code_age_stub(); | 284 Code* target = rinfo->code_age_stub(); |
| 281 DCHECK(target != NULL); | 285 DCHECK(target != NULL); |
| 282 heap->mark_compact_collector()->RecordRelocSlot(rinfo, target); | 286 Code* host = rinfo->host(); |
| 287 heap->mark_compact_collector()->RecordRelocSlot(host, rinfo, target); |
| 283 StaticVisitor::MarkObject(heap, target); | 288 StaticVisitor::MarkObject(heap, target); |
| 284 } | 289 } |
| 285 | 290 |
| 286 | 291 |
| 287 template <typename StaticVisitor> | 292 template <typename StaticVisitor> |
| 288 void StaticMarkingVisitor<StaticVisitor>::VisitNativeContext( | 293 void StaticMarkingVisitor<StaticVisitor>::VisitNativeContext( |
| 289 Map* map, HeapObject* object) { | 294 Map* map, HeapObject* object) { |
| 290 FixedBodyVisitor<StaticVisitor, Context::MarkCompactBodyDescriptor, | 295 FixedBodyVisitor<StaticVisitor, Context::MarkCompactBodyDescriptor, |
| 291 void>::Visit(map, object); | 296 void>::Visit(map, object); |
| 292 } | 297 } |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 typedef FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode, | 724 typedef FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode, |
| 720 void> JSFunctionWeakCodeBodyVisitor; | 725 void> JSFunctionWeakCodeBodyVisitor; |
| 721 JSFunctionWeakCodeBodyVisitor::Visit(map, object); | 726 JSFunctionWeakCodeBodyVisitor::Visit(map, object); |
| 722 } | 727 } |
| 723 | 728 |
| 724 | 729 |
| 725 } // namespace internal | 730 } // namespace internal |
| 726 } // namespace v8 | 731 } // namespace v8 |
| 727 | 732 |
| 728 #endif // V8_OBJECTS_VISITING_INL_H_ | 733 #endif // V8_OBJECTS_VISITING_INL_H_ |
| OLD | NEW |