| 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_H_ | 5 #ifndef V8_OBJECTS_VISITING_H_ |
| 6 #define V8_OBJECTS_VISITING_H_ | 6 #define V8_OBJECTS_VISITING_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/layout-descriptor.h" | 9 #include "src/layout-descriptor.h" |
| 10 | 10 |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 | 374 |
| 375 static VisitorDispatchTable<Callback> table_; | 375 static VisitorDispatchTable<Callback> table_; |
| 376 }; | 376 }; |
| 377 | 377 |
| 378 | 378 |
| 379 template <typename StaticVisitor> | 379 template <typename StaticVisitor> |
| 380 VisitorDispatchTable<typename StaticNewSpaceVisitor<StaticVisitor>::Callback> | 380 VisitorDispatchTable<typename StaticNewSpaceVisitor<StaticVisitor>::Callback> |
| 381 StaticNewSpaceVisitor<StaticVisitor>::table_; | 381 StaticNewSpaceVisitor<StaticVisitor>::table_; |
| 382 | 382 |
| 383 | 383 |
| 384 #ifdef TRACE_RETAINING_PATH |
| 385 void SetCurrentRetainer(HeapObject* obj); |
| 386 void ResetCurrentRetainer(HeapObject* obj); |
| 387 #endif |
| 388 |
| 389 |
| 384 // Base class for visitors used to transitively mark the entire heap. | 390 // Base class for visitors used to transitively mark the entire heap. |
| 385 // IterateBody returns nothing. | 391 // IterateBody returns nothing. |
| 386 // Certain types of objects might not be handled by this base class and | 392 // Certain types of objects might not be handled by this base class and |
| 387 // no visitor function is registered by the generic initialization. A | 393 // no visitor function is registered by the generic initialization. A |
| 388 // specialized visitor function needs to be provided by the inheriting | 394 // specialized visitor function needs to be provided by the inheriting |
| 389 // class itself for those cases. | 395 // class itself for those cases. |
| 390 // | 396 // |
| 391 // This class is intended to be used in the following way: | 397 // This class is intended to be used in the following way: |
| 392 // | 398 // |
| 393 // class SomeVisitor : public StaticMarkingVisitor<SomeVisitor> { | 399 // class SomeVisitor : public StaticMarkingVisitor<SomeVisitor> { |
| 394 // ... | 400 // ... |
| 395 // } | 401 // } |
| 396 // | 402 // |
| 397 // This is an example of Curiously recurring template pattern. | 403 // This is an example of Curiously recurring template pattern. |
| 398 template <typename StaticVisitor> | 404 template <typename StaticVisitor> |
| 399 class StaticMarkingVisitor : public StaticVisitorBase { | 405 class StaticMarkingVisitor : public StaticVisitorBase { |
| 400 public: | 406 public: |
| 401 static void Initialize(); | 407 static void Initialize(); |
| 402 | 408 |
| 403 INLINE(static void IterateBody(Map* map, HeapObject* obj)) { | 409 INLINE(static void IterateBody(Map* map, HeapObject* obj)) { |
| 410 #ifdef TRACE_RETAINING_PATH |
| 411 SetCurrentRetainer(obj); |
| 412 #endif |
| 404 table_.GetVisitor(map)(map, obj); | 413 table_.GetVisitor(map)(map, obj); |
| 414 #ifdef TRACE_RETAINING_PATH |
| 415 ResetCurrentRetainer(obj); |
| 416 #endif |
| 405 } | 417 } |
| 406 | 418 |
| 407 INLINE(static void VisitPropertyCell(Map* map, HeapObject* object)); | 419 INLINE(static void VisitPropertyCell(Map* map, HeapObject* object)); |
| 408 INLINE(static void VisitWeakCell(Map* map, HeapObject* object)); | 420 INLINE(static void VisitWeakCell(Map* map, HeapObject* object)); |
| 409 INLINE(static void VisitCodeEntry(Heap* heap, Address entry_address)); | 421 INLINE(static void VisitCodeEntry(Heap* heap, Address entry_address)); |
| 410 INLINE(static void VisitEmbeddedPointer(Heap* heap, RelocInfo* rinfo)); | 422 INLINE(static void VisitEmbeddedPointer(Heap* heap, RelocInfo* rinfo)); |
| 411 INLINE(static void VisitCell(Heap* heap, RelocInfo* rinfo)); | 423 INLINE(static void VisitCell(Heap* heap, RelocInfo* rinfo)); |
| 412 INLINE(static void VisitDebugTarget(Heap* heap, RelocInfo* rinfo)); | 424 INLINE(static void VisitDebugTarget(Heap* heap, RelocInfo* rinfo)); |
| 413 INLINE(static void VisitCodeTarget(Heap* heap, RelocInfo* rinfo)); | 425 INLINE(static void VisitCodeTarget(Heap* heap, RelocInfo* rinfo)); |
| 414 INLINE(static void VisitCodeAgeSequence(Heap* heap, RelocInfo* rinfo)); | 426 INLINE(static void VisitCodeAgeSequence(Heap* heap, RelocInfo* rinfo)); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 // the next element. Given the head of the list, this function removes dead | 499 // the next element. Given the head of the list, this function removes dead |
| 488 // elements from the list and if requested records slots for next-element | 500 // elements from the list and if requested records slots for next-element |
| 489 // pointers. The template parameter T is a WeakListVisitor that defines how to | 501 // pointers. The template parameter T is a WeakListVisitor that defines how to |
| 490 // access the next-element pointers. | 502 // access the next-element pointers. |
| 491 template <class T> | 503 template <class T> |
| 492 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer); | 504 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer); |
| 493 } | 505 } |
| 494 } // namespace v8::internal | 506 } // namespace v8::internal |
| 495 | 507 |
| 496 #endif // V8_OBJECTS_VISITING_H_ | 508 #endif // V8_OBJECTS_VISITING_H_ |
| OLD | NEW |