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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 | 94 |
95 template <typename Callback> | 95 template <typename Callback> |
96 class VisitorDispatchTable { | 96 class VisitorDispatchTable { |
97 public: | 97 public: |
98 void CopyFrom(VisitorDispatchTable* other) { | 98 void CopyFrom(VisitorDispatchTable* other) { |
99 // We are not using memcpy to guarantee that during update | 99 // We are not using memcpy to guarantee that during update |
100 // every element of callbacks_ array will remain correct | 100 // every element of callbacks_ array will remain correct |
101 // pointer (memcpy might be implemented as a byte copying loop). | 101 // pointer (memcpy might be implemented as a byte copying loop). |
102 for (int i = 0; i < kVisitorIdCount; i++) { | 102 for (int i = 0; i < kVisitorIdCount; i++) { |
103 base::NoBarrier_Store(&callbacks_[i], other->callbacks_[i]); | 103 base::Relaxed_Store(&callbacks_[i], other->callbacks_[i]); |
104 } | 104 } |
105 } | 105 } |
106 | 106 |
107 inline Callback GetVisitor(Map* map); | 107 inline Callback GetVisitor(Map* map); |
108 | 108 |
109 inline Callback GetVisitorById(VisitorId id) { | 109 inline Callback GetVisitorById(VisitorId id) { |
110 return reinterpret_cast<Callback>(callbacks_[id]); | 110 return reinterpret_cast<Callback>(callbacks_[id]); |
111 } | 111 } |
112 | 112 |
113 void Register(VisitorId id, Callback callback) { | 113 void Register(VisitorId id, Callback callback) { |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 // the next element. Given the head of the list, this function removes dead | 413 // the next element. Given the head of the list, this function removes dead |
414 // elements from the list and if requested records slots for next-element | 414 // elements from the list and if requested records slots for next-element |
415 // pointers. The template parameter T is a WeakListVisitor that defines how to | 415 // pointers. The template parameter T is a WeakListVisitor that defines how to |
416 // access the next-element pointers. | 416 // access the next-element pointers. |
417 template <class T> | 417 template <class T> |
418 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer); | 418 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer); |
419 } // namespace internal | 419 } // namespace internal |
420 } // namespace v8 | 420 } // namespace v8 |
421 | 421 |
422 #endif // V8_OBJECTS_VISITING_H_ | 422 #endif // V8_OBJECTS_VISITING_H_ |
OLD | NEW |