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/heap/embedder-tracing.h" |
9 #include "src/heap/heap.h" | 10 #include "src/heap/heap.h" |
10 #include "src/heap/spaces.h" | 11 #include "src/heap/spaces.h" |
11 #include "src/layout-descriptor.h" | 12 #include "src/layout-descriptor.h" |
12 #include "src/objects-body-descriptors.h" | 13 #include "src/objects-body-descriptors.h" |
13 | 14 |
14 // This file provides base classes and auxiliary methods for defining | 15 // This file provides base classes and auxiliary methods for defining |
15 // static object visitors used during GC. | 16 // static object visitors used during GC. |
16 // Visiting HeapObject body with a normal ObjectVisitor requires performing | 17 // Visiting HeapObject body with a normal ObjectVisitor requires performing |
17 // two switches on object's instance type to determine object size and layout | 18 // two switches on object's instance type to determine object size and layout |
18 // and one or more virtual method calls on visitor itself. | 19 // and one or more virtual method calls on visitor itself. |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 JSObjectVisitor::template VisitSpecialized<size>(map, object); | 418 JSObjectVisitor::template VisitSpecialized<size>(map, object); |
418 } | 419 } |
419 | 420 |
420 INLINE(static void Visit(Map* map, HeapObject* object)) { | 421 INLINE(static void Visit(Map* map, HeapObject* object)) { |
421 TracePossibleWrapper(object); | 422 TracePossibleWrapper(object); |
422 JSObjectVisitor::Visit(map, object); | 423 JSObjectVisitor::Visit(map, object); |
423 } | 424 } |
424 | 425 |
425 private: | 426 private: |
426 INLINE(static void TracePossibleWrapper(HeapObject* object)) { | 427 INLINE(static void TracePossibleWrapper(HeapObject* object)) { |
427 if (object->GetHeap()->UsingEmbedderHeapTracer()) { | 428 if (object->GetHeap()->local_embedder_heap_tracer()->InUse()) { |
428 DCHECK(object->IsJSObject()); | 429 DCHECK(object->IsJSObject()); |
429 object->GetHeap()->TracePossibleWrapper(JSObject::cast(object)); | 430 object->GetHeap()->TracePossibleWrapper(JSObject::cast(object)); |
430 } | 431 } |
431 } | 432 } |
432 }; | 433 }; |
433 | 434 |
434 typedef FlexibleBodyVisitor<StaticVisitor, StructBodyDescriptor, void> | 435 typedef FlexibleBodyVisitor<StaticVisitor, StructBodyDescriptor, void> |
435 StructObjectVisitor; | 436 StructObjectVisitor; |
436 | 437 |
437 typedef void (*Callback)(Map* map, HeapObject* object); | 438 typedef void (*Callback)(Map* map, HeapObject* object); |
(...skipping 14 matching lines...) Expand all Loading... |
452 // the next element. Given the head of the list, this function removes dead | 453 // the next element. Given the head of the list, this function removes dead |
453 // elements from the list and if requested records slots for next-element | 454 // elements from the list and if requested records slots for next-element |
454 // pointers. The template parameter T is a WeakListVisitor that defines how to | 455 // pointers. The template parameter T is a WeakListVisitor that defines how to |
455 // access the next-element pointers. | 456 // access the next-element pointers. |
456 template <class T> | 457 template <class T> |
457 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer); | 458 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer); |
458 } // namespace internal | 459 } // namespace internal |
459 } // namespace v8 | 460 } // namespace v8 |
460 | 461 |
461 #endif // V8_OBJECTS_VISITING_H_ | 462 #endif // V8_OBJECTS_VISITING_H_ |
OLD | NEW |