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