| 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/embedder-tracing.h" |
| 10 #include "src/heap/heap.h" | 10 #include "src/heap/heap.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 // Base class for all static visitors. | 81 // Base class for all static visitors. |
| 82 class StaticVisitorBase : public AllStatic { | 82 class StaticVisitorBase : public AllStatic { |
| 83 public: | 83 public: |
| 84 // Visitor ID should fit in one byte. | 84 // Visitor ID should fit in one byte. |
| 85 STATIC_ASSERT(kVisitorIdCount <= 256); | 85 STATIC_ASSERT(kVisitorIdCount <= 256); |
| 86 | 86 |
| 87 // Determine which specialized visitor should be used for given instance type | 87 // Determine which specialized visitor should be used for given instance type |
| 88 // and instance type. | 88 // and instance type. |
| 89 static inline VisitorId GetVisitorId(int instance_type, int instance_size, | 89 static VisitorId GetVisitorId(int instance_type, int instance_size, |
| 90 bool has_unboxed_fields); | 90 bool has_unboxed_fields); |
| 91 | 91 |
| 92 // Determine which specialized visitor should be used for given map. | 92 // Determine which specialized visitor should be used for given map. |
| 93 static inline VisitorId GetVisitorId(Map* map); | 93 static VisitorId GetVisitorId(Map* map); |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 | 96 |
| 97 template <typename Callback> | 97 template <typename Callback> |
| 98 class VisitorDispatchTable { | 98 class VisitorDispatchTable { |
| 99 public: | 99 public: |
| 100 void CopyFrom(VisitorDispatchTable* other) { | 100 void CopyFrom(VisitorDispatchTable* other) { |
| 101 // We are not using memcpy to guarantee that during update | 101 // We are not using memcpy to guarantee that during update |
| 102 // every element of callbacks_ array will remain correct | 102 // every element of callbacks_ array will remain correct |
| 103 // pointer (memcpy might be implemented as a byte copying loop). | 103 // pointer (memcpy might be implemented as a byte copying loop). |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 // the next element. Given the head of the list, this function removes dead | 341 // the next element. Given the head of the list, this function removes dead |
| 342 // elements from the list and if requested records slots for next-element | 342 // elements from the list and if requested records slots for next-element |
| 343 // pointers. The template parameter T is a WeakListVisitor that defines how to | 343 // pointers. The template parameter T is a WeakListVisitor that defines how to |
| 344 // access the next-element pointers. | 344 // access the next-element pointers. |
| 345 template <class T> | 345 template <class T> |
| 346 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer); | 346 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer); |
| 347 } // namespace internal | 347 } // namespace internal |
| 348 } // namespace v8 | 348 } // namespace v8 |
| 349 | 349 |
| 350 #endif // V8_OBJECTS_VISITING_H_ | 350 #endif // V8_OBJECTS_VISITING_H_ |
| OLD | NEW |