Chromium Code Reviews| Index: third_party/WebKit/Source/platform/heap/Visitor.h |
| diff --git a/third_party/WebKit/Source/platform/heap/Visitor.h b/third_party/WebKit/Source/platform/heap/Visitor.h |
| index f93d1e4d52fd9ce3516a7bc9399758f7c60a2343..92a7e6f131ad304585eaa1f41da51ea4af78deb2 100644 |
| --- a/third_party/WebKit/Source/platform/heap/Visitor.h |
| +++ b/third_party/WebKit/Source/platform/heap/Visitor.h |
| @@ -243,10 +243,26 @@ class VisitorHelper { |
| void registerWeakMembers(const T* obj) { |
| registerWeakMembers(obj, &TraceMethodDelegate<T, method>::trampoline); |
| } |
| + |
| void registerWeakMembers(const void* object, WeakCallback callback) { |
| Derived::fromHelper(this)->registerWeakMembers(object, object, callback); |
| } |
| + template <typename T> |
| + void registerBackingStoreReference(T** slot) { |
| + Derived::fromHelper(this)->registerMovingObjectReference( |
| + reinterpret_cast<MovableReference*>(slot)); |
| + } |
| + |
| + template <typename T> |
| + void registerBackingStoreCallback(T* backingStore, |
| + MovingObjectCallback callback, |
| + void* callbackData) { |
| + Derived::fromHelper(this)->registerMovingObjectCallback( |
| + reinterpret_cast<MovableReference>(backingStore), callback, |
| + callbackData); |
| + } |
| + |
| inline ThreadState* state() const { return m_state; } |
| inline ThreadHeap& heap() const { return state()->heap(); } |
| @@ -254,7 +270,7 @@ class VisitorHelper { |
| template <typename T> |
| static void handleWeakCell(Visitor* self, void* object); |
| - ThreadState* m_state; |
| + ThreadState* const m_state; |
| }; |
| // Visitor is used to traverse the Blink object graph. Used for the |
| @@ -284,6 +300,13 @@ class PLATFORM_EXPORT Visitor : public VisitorHelper<Visitor> { |
| // This visitor is used to trace objects during weak processing. |
| // This visitor is allowed to trace only already marked objects. |
| WeakProcessing, |
| + // Perform global marking along with preparing for additional sweep |
| + // compaction of heap arenas afterwards. Compared to the GlobalMarking |
| + // visitor, this visitor will also register references to objects |
| + // that might be moved during arena compaction -- the compaction |
| + // pass will then fix up those references when the object move goes |
| + // ahead. |
| + GlobalMarkCompacting, |
|
haraken
2016/12/09 07:25:56
GlobalMarkingWithCompaction ?
sof
2016/12/09 21:44:05
Twiddles, done.
|
| }; |
| static std::unique_ptr<Visitor> create(ThreadState*, BlinkGC::GCType); |
| @@ -310,7 +333,10 @@ class PLATFORM_EXPORT Visitor : public VisitorHelper<Visitor> { |
| // object. If collection backings are reachable from other |
| // locations we strongify them to avoid issues with iterators and |
| // weak processing. |
| - virtual void registerDelayedMarkNoTracing(const void*) = 0; |
| + // A pointer to the location holding the backing store reference |
| + // is passed in. This is done so as to potentially allow that |
| + // location to be updated by the garbage collector. |
| + virtual void registerDelayedMarkNoTracing(void**) = 0; |
| // If the object calls this during the regular trace callback, then the |
| // WeakCallback argument may be called later, when the strong roots |
| @@ -344,10 +370,21 @@ class PLATFORM_EXPORT Visitor : public VisitorHelper<Visitor> { |
| virtual bool ensureMarked(const void*) = 0; |
| + virtual void registerMovingObjectReference(MovableReference*) = 0; |
| + |
| + virtual void registerMovingObjectCallback(MovableReference, |
| + MovingObjectCallback, |
| + void*) = 0; |
| + |
| virtual void registerWeakCellWithCallback(void**, WeakCallback) = 0; |
| inline MarkingMode getMarkingMode() const { return m_markingMode; } |
| + inline bool isGlobalMarking() const { |
| + return m_markingMode == GlobalMarking || |
| + m_markingMode == GlobalMarkCompacting; |
| + } |
| + |
| protected: |
| Visitor(ThreadState*, MarkingMode); |
| @@ -356,7 +393,6 @@ class PLATFORM_EXPORT Visitor : public VisitorHelper<Visitor> { |
| return static_cast<Visitor*>(helper); |
| } |
| - ThreadState* m_state; |
| const MarkingMode m_markingMode; |
| }; |