| Index: Source/heap/Visitor.h
|
| diff --git a/Source/heap/Visitor.h b/Source/heap/Visitor.h
|
| index 851edb018d49a21055389ea3c69ecc7892ee801c..c3f0ba407cbb282aa186f9d490f584e83ae42e8c 100644
|
| --- a/Source/heap/Visitor.h
|
| +++ b/Source/heap/Visitor.h
|
| @@ -53,7 +53,7 @@ namespace WebCore {
|
| template<typename T> class Member;
|
| template<typename T> class WeakMember;
|
| class HeapAllocator;
|
| -template<bool needsVisiting, bool isWeak, bool visitWeakPointersStrongly, typename T, typename Traits> struct VisitCollectionBackingTrait;
|
| +template<bool needsTracing, bool isWeak, bool markWeakPointersStrongly, typename T, typename Traits> struct CollectionBackingTraceTrait;
|
|
|
| typedef void (*FinalizationCallback)(void*);
|
|
|
| @@ -194,7 +194,7 @@ public:
|
| static_cast<T*>(self)->trace(visitor);
|
| }
|
|
|
| - static void visit(Visitor*, const T*);
|
| + static void mark(Visitor*, const T*);
|
|
|
| #ifndef NDEBUG
|
| static void checkTypeMarker(Visitor*, const T*);
|
| @@ -209,8 +209,8 @@ template<typename T, typename HashFunctions, typename Traits>
|
| void processWeakOffHeapHashSet(Visitor*, void* set);
|
|
|
| template<typename Collection>
|
| -struct CollectionVisitingTrait {
|
| - static void visit(Visitor*, const Collection&);
|
| +struct OffHeapCollectionTraceTrait {
|
| + static void mark(Visitor*, const Collection&);
|
| };
|
|
|
| template<typename T>
|
| @@ -238,22 +238,22 @@ public:
|
| Visitor() : m_hostObject(0), m_hostName(0) { }
|
| #endif
|
|
|
| - // One-argument templated visit method. This uses the static type of
|
| - // the argument to get the TraceTrait. By default, the visit method
|
| - // of the TraceTrait just calls the virtual two-argument visit method on this
|
| + // One-argument templated mark method. This uses the static type of
|
| + // the argument to get the TraceTrait. By default, the mark method
|
| + // of the TraceTrait just calls the virtual two-argument mark method on this
|
| // visitor, where the second argument is the static trace method.
|
| template<typename T>
|
| - void visit(T* t)
|
| + void mark(T* t)
|
| {
|
| if (!t)
|
| return;
|
| #ifndef NDEBUG
|
| TraceTrait<T>::checkTypeMarker(this, t);
|
| #endif
|
| - TraceTrait<T>::visit(this, t);
|
| + TraceTrait<T>::mark(this, t);
|
| }
|
|
|
| - // Member version of the one-argument templated visit method.
|
| + // Member version of the one-argument templated mark method.
|
| template<typename T>
|
| void trace(const Member<T>& t)
|
| {
|
| @@ -262,10 +262,10 @@ public:
|
| #ifndef NDEBUG
|
| TraceTrait<T>::checkTypeMarker(this, t.raw());
|
| #endif
|
| - TraceTrait<T>::visit(this, t.raw());
|
| + TraceTrait<T>::mark(this, t.raw());
|
| }
|
|
|
| - // Doesn't keep the visited thing alive, but will write null to the
|
| + // Doesn't keep the traced thing alive, but will write null to the
|
| // WeakMember later if the pointed-to object is dead.
|
| template<typename T>
|
| void trace(const WeakMember<T>& t)
|
| @@ -273,35 +273,35 @@ public:
|
| registerWeakCell(t.cell());
|
| }
|
|
|
| - // The following visit methods are for off-heap collections.
|
| + // The following mark methods are for off-heap collections.
|
| template<typename T, size_t inlineCapacity>
|
| void trace(const Vector<T, inlineCapacity, WTF::FastAllocator>& vector)
|
| {
|
| - CollectionVisitingTrait<Vector<T, inlineCapacity, WTF::FastAllocator> >::visit(this, vector);
|
| + OffHeapCollectionTraceTrait<Vector<T, inlineCapacity, WTF::FastAllocator> >::mark(this, vector);
|
| }
|
|
|
| template<typename T, typename U, typename V>
|
| void trace(const HashSet<T, WTF::FastAllocator, U, V>& hashSet)
|
| {
|
| - CollectionVisitingTrait<HashSet<T, WTF::FastAllocator, U, V> >::visit(this, hashSet);
|
| + OffHeapCollectionTraceTrait<HashSet<T, WTF::FastAllocator, U, V> >::mark(this, hashSet);
|
| }
|
|
|
| template<typename T, size_t inlineCapacity, typename U>
|
| void trace(const ListHashSet<T, inlineCapacity, U>& hashSet)
|
| {
|
| - CollectionVisitingTrait<ListHashSet<T, inlineCapacity, U> >::visit(this, hashSet);
|
| + OffHeapCollectionTraceTrait<ListHashSet<T, inlineCapacity, U> >::mark(this, hashSet);
|
| }
|
|
|
| template<typename T, size_t N>
|
| void trace(const Deque<T, N>& deque)
|
| {
|
| - CollectionVisitingTrait<Deque<T, N> >::visit(this, deque);
|
| + OffHeapCollectionTraceTrait<Deque<T, N> >::mark(this, deque);
|
| }
|
|
|
| template<typename T, typename U, typename V, typename W, typename X>
|
| void trace(const HashMap<T, U, WTF::FastAllocator, V, W, X>& map)
|
| {
|
| - CollectionVisitingTrait<HashMap<T, U, WTF::FastAllocator, V, W, X> >::visit(this, map);
|
| + OffHeapCollectionTraceTrait<HashMap<T, U, WTF::FastAllocator, V, W, X> >::mark(this, map);
|
| }
|
|
|
| // Fallback trace method for part objects to allow individual
|
| @@ -324,13 +324,13 @@ public:
|
| // This method adds the object to the set of objects that should have their
|
| // trace method called. Since not all objects have vtables we have to have
|
| // the callback as an explicit argument, but we can use the templated
|
| - // one-argument visit method above to automatically provide the callback
|
| + // one-argument mark method above to automatically provide the callback
|
| // function.
|
| - virtual void visit(const void*, TraceCallback) = 0;
|
| + virtual void mark(const void*, TraceCallback) = 0;
|
|
|
| // Used during conservative scanning.
|
| - virtual void visit(HeapObjectHeader*, TraceCallback) = 0;
|
| - virtual void visit(FinalizedHeapObjectHeader*, TraceCallback) = 0;
|
| + virtual void mark(HeapObjectHeader*, TraceCallback) = 0;
|
| + virtual void mark(FinalizedHeapObjectHeader*, TraceCallback) = 0;
|
|
|
| // If the object calls this during the regular trace callback, then the
|
| // WeakPointerCallback argument may be called later, when the strong roots
|
| @@ -377,7 +377,7 @@ public:
|
| // Macro to declare methods needed for each typed heap.
|
| #define DECLARE_VISITOR_METHODS(Type) \
|
| DEBUG_ONLY(void checkTypeMarker(const Type*, const char* marker);) \
|
| - virtual void visit(const Type*, TraceCallback) = 0; \
|
| + virtual void mark(const Type*, TraceCallback) = 0; \
|
| virtual bool isMarked(const Type*) = 0;
|
|
|
| FOR_EACH_TYPED_HEAP(DECLARE_VISITOR_METHODS)
|
| @@ -399,16 +399,16 @@ private:
|
| };
|
|
|
| template<typename T, typename HashFunctions, typename Traits>
|
| -struct CollectionVisitingTrait<WTF::HashSet<T, WTF::FastAllocator, HashFunctions, Traits> > {
|
| +struct OffHeapCollectionTraceTrait<WTF::HashSet<T, WTF::FastAllocator, HashFunctions, Traits> > {
|
| typedef WTF::HashSet<T, WTF::FastAllocator, HashFunctions, Traits> HashSet;
|
|
|
| - static void visit(Visitor* v, const HashSet& set)
|
| + static void mark(Visitor* v, const HashSet& set)
|
| {
|
| if (set.isEmpty())
|
| return;
|
| - if (WTF::NeedsVisiting<T>::value) {
|
| + if (WTF::NeedsTracing<T>::value) {
|
| for (typename HashSet::const_iterator it = set.begin(), end = set.end(); it != end; ++it)
|
| - VisitCollectionBackingTrait<Traits::needsVisiting, Traits::isWeak, false, T, Traits>::visit(v, *it);
|
| + CollectionBackingTraceTrait<Traits::needsTracing, Traits::isWeak, false, T, Traits>::mark(v, *it);
|
| }
|
| if (Traits::isWeak) {
|
| if (!set.isEmpty())
|
| @@ -418,10 +418,10 @@ struct CollectionVisitingTrait<WTF::HashSet<T, WTF::FastAllocator, HashFunctions
|
| };
|
|
|
| template<typename T, size_t inlineCapacity, typename HashFunctions>
|
| -struct CollectionVisitingTrait<WTF::ListHashSet<T, inlineCapacity, HashFunctions> > {
|
| +struct OffHeapCollectionTraceTrait<WTF::ListHashSet<T, inlineCapacity, HashFunctions> > {
|
| typedef WTF::ListHashSet<T, inlineCapacity, HashFunctions> ListHashSet;
|
|
|
| - static void visit(Visitor* visitor, const ListHashSet& set)
|
| + static void mark(Visitor* visitor, const ListHashSet& set)
|
| {
|
| if (set.isEmpty())
|
| return;
|
| @@ -431,17 +431,17 @@ struct CollectionVisitingTrait<WTF::ListHashSet<T, inlineCapacity, HashFunctions
|
| };
|
|
|
| template<typename Key, typename Value, typename HashFunctions, typename KeyTraits, typename ValueTraits>
|
| -struct CollectionVisitingTrait<WTF::HashMap<Key, Value, WTF::FastAllocator, HashFunctions, KeyTraits, ValueTraits> > {
|
| +struct OffHeapCollectionTraceTrait<WTF::HashMap<Key, Value, WTF::FastAllocator, HashFunctions, KeyTraits, ValueTraits> > {
|
| typedef WTF::HashMap<Key, Value, WTF::FastAllocator, HashFunctions, KeyTraits, ValueTraits> HashMap;
|
|
|
| - static void visit(Visitor* v, const HashMap& map)
|
| + static void mark(Visitor* v, const HashMap& map)
|
| {
|
| if (map.isEmpty())
|
| return;
|
| - if (WTF::NeedsVisiting<Key>::value || WTF::NeedsVisiting<Value>::value) {
|
| + if (WTF::NeedsTracing<Key>::value || WTF::NeedsTracing<Value>::value) {
|
| for (typename HashMap::const_iterator it = map.begin(), end = map.end(); it != end; ++it) {
|
| - VisitCollectionBackingTrait<KeyTraits::needsVisiting, KeyTraits::isWeak, false, Key, KeyTraits>::visit(v, it->key);
|
| - VisitCollectionBackingTrait<ValueTraits::needsVisiting, ValueTraits::isWeak, false, Value, ValueTraits>::visit(v, it->value);
|
| + CollectionBackingTraceTrait<KeyTraits::needsTracing, KeyTraits::isWeak, false, Key, KeyTraits>::mark(v, it->key);
|
| + CollectionBackingTraceTrait<ValueTraits::needsTracing, ValueTraits::isWeak, false, Value, ValueTraits>::mark(v, it->value);
|
| }
|
| }
|
| if (KeyTraits::isWeak || ValueTraits::isWeak) {
|
| @@ -458,13 +458,13 @@ template<typename T> void TraceTrait<T>::checkTypeMarker(Visitor* visitor, const
|
| }
|
| #endif
|
|
|
| -template<typename T> void TraceTrait<T>::visit(Visitor* visitor, const T* t)
|
| +template<typename T> void TraceTrait<T>::mark(Visitor* visitor, const T* t)
|
| {
|
| - // Default visit method of the trait just calls the two-argument visit
|
| + // Default mark method of the trait just calls the two-argument mark
|
| // method on the visitor. The second argument is the static trace method
|
| // of the trait, which by default calls the instance method
|
| // trace(Visitor*) on the object.
|
| - visitor->visit(const_cast<T*>(t), &trace);
|
| + visitor->mark(const_cast<T*>(t), &trace);
|
| }
|
|
|
| inline void doNothingTrace(Visitor*, void*)
|
| @@ -489,8 +489,8 @@ class HeapHashTableBacking;
|
| class TraceTrait<type> { \
|
| public: \
|
| static void checkTypeMarker(Visitor*, const void*) { } \
|
| - static void visit(Visitor* v, const type* p) { \
|
| - v->visit(p, nullptr); \
|
| + static void mark(Visitor* v, const type* p) { \
|
| + v->mark(p, nullptr); \
|
| } \
|
| }; \
|
| template<> \
|
| @@ -511,14 +511,14 @@ ITERATE_DO_NOTHING_TYPES(DECLARE_DO_NOTHING_TRAIT)
|
|
|
| #undef DECLARE_DO_NOTHING_TRAIT
|
|
|
| -// Vectors are simple collections, and it's possible to visit vectors in a more
|
| +// Vectors are simple collections, and it's possible to mark vectors in a more
|
| // general way so that collections of objects (not pointers to objects) can be
|
| -// visited.
|
| +// marked.
|
| template<typename T, size_t N>
|
| -struct CollectionVisitingTrait<WTF::Vector<T, N, WTF::FastAllocator> > {
|
| +struct OffHeapCollectionTraceTrait<WTF::Vector<T, N, WTF::FastAllocator> > {
|
| typedef WTF::Vector<T, N, WTF::FastAllocator> Vector;
|
|
|
| - static void visit(Visitor* v, const Vector& vector)
|
| + static void mark(Visitor* v, const Vector& vector)
|
| {
|
| if (vector.isEmpty())
|
| return;
|
| @@ -528,7 +528,7 @@ struct CollectionVisitingTrait<WTF::Vector<T, N, WTF::FastAllocator> > {
|
| };
|
|
|
| // Fallback definition.
|
| -template<typename Collection> void CollectionVisitingTrait<Collection>::visit(Visitor* visitor, const Collection& collection)
|
| +template<typename Collection> void OffHeapCollectionTraceTrait<Collection>::mark(Visitor* visitor, const Collection& collection)
|
| {
|
| if (collection.isEmpty())
|
| return;
|
|
|