Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: third_party/WebKit/Source/platform/heap/MarkingVisitor.h

Issue 2531973002: Simple BlinkGC heap compaction. (Closed)
Patch Set: synchronize on compaction finish Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium 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 MarkingVisitor_h 5 #ifndef MarkingVisitor_h
6 #define MarkingVisitor_h 6 #define MarkingVisitor_h
7 7
8 #include "platform/heap/MarkingVisitorImpl.h" 8 #include "platform/heap/MarkingVisitorImpl.h"
9 9
10 namespace blink { 10 namespace blink {
11 11
12 template <Visitor::MarkingMode Mode> 12 template <Visitor::MarkingMode Mode>
13 class MarkingVisitor final : public Visitor, 13 class MarkingVisitor final : public Visitor,
14 public MarkingVisitorImpl<MarkingVisitor<Mode>> { 14 public MarkingVisitorImpl<MarkingVisitor<Mode>> {
15 public: 15 public:
16 using Impl = MarkingVisitorImpl<MarkingVisitor<Mode>>; 16 using Impl = MarkingVisitorImpl<MarkingVisitor<Mode>>;
17 friend class MarkingVisitorImpl<MarkingVisitor<Mode>>; 17 friend class MarkingVisitorImpl<MarkingVisitor<Mode>>;
18 18
19 explicit MarkingVisitor(ThreadState* state) : Visitor(state, Mode) {} 19 explicit MarkingVisitor(ThreadState* state) : Visitor(state, Mode) {}
20 20
21 void markHeader(HeapObjectHeader* header, TraceCallback callback) override { 21 void markHeader(HeapObjectHeader* header, TraceCallback callback) override {
22 Impl::markHeader(header, header->payload(), callback); 22 Impl::markHeader(header, header->payload(), callback);
23 } 23 }
24 24
25 void mark(const void* objectPointer, TraceCallback callback) override { 25 void mark(const void* objectPointer, TraceCallback callback) override {
26 Impl::mark(objectPointer, callback); 26 Impl::mark(objectPointer, callback);
27 } 27 }
28 28
29 void registerDelayedMarkNoTracing(const void* object) override { 29 void registerDelayedMarkNoTracing(void** object) override {
30 Impl::registerDelayedMarkNoTracing(object); 30 Impl::registerDelayedMarkNoTracing(object);
31 } 31 }
32 32
33 void registerWeakMembers(const void* closure, 33 void registerWeakMembers(const void* closure,
34 const void* objectPointer, 34 const void* objectPointer,
35 WeakCallback callback) override { 35 WeakCallback callback) override {
36 Impl::registerWeakMembers(closure, objectPointer, callback); 36 Impl::registerWeakMembers(closure, objectPointer, callback);
37 } 37 }
38 38
39 virtual void registerWeakTable(const void* closure, 39 virtual void registerWeakTable(const void* closure,
40 EphemeronCallback iterationCallback, 40 EphemeronCallback iterationCallback,
41 EphemeronCallback iterationDoneCallback) { 41 EphemeronCallback iterationDoneCallback) {
42 Impl::registerWeakTable(closure, iterationCallback, iterationDoneCallback); 42 Impl::registerWeakTable(closure, iterationCallback, iterationDoneCallback);
43 } 43 }
44 44
45 #if ENABLE(ASSERT) 45 #if ENABLE(ASSERT)
46 virtual bool weakTableRegistered(const void* closure) { 46 virtual bool weakTableRegistered(const void* closure) {
47 return Impl::weakTableRegistered(closure); 47 return Impl::weakTableRegistered(closure);
48 } 48 }
49 #endif 49 #endif
50 50
51 void registerMovingObjectReference(MovableReference* slot) override {
52 Impl::registerMovingObjectReference(slot);
53 }
54
55 void registerMovingObjectCallback(MovableReference backingStore,
56 MovingObjectCallback callback,
57 void* callbackData) override {
58 Impl::registerMovingObjectCallback(backingStore, callback, callbackData);
59 }
60
51 bool ensureMarked(const void* objectPointer) override { 61 bool ensureMarked(const void* objectPointer) override {
52 return Impl::ensureMarked(objectPointer); 62 return Impl::ensureMarked(objectPointer);
53 } 63 }
54 64
55 void registerWeakCellWithCallback(void** cell, 65 void registerWeakCellWithCallback(void** cell,
56 WeakCallback callback) override { 66 WeakCallback callback) override {
57 Impl::registerWeakCellWithCallback(cell, callback); 67 Impl::registerWeakCellWithCallback(cell, callback);
58 } 68 }
59 69
60 protected: 70 protected:
61 inline bool shouldMarkObject(const void* objectPointer) const { 71 inline bool shouldMarkObject(const void* objectPointer) const {
62 if (Mode != ThreadLocalMarking) 72 if (Mode != ThreadLocalMarking)
63 return true; 73 return true;
64 74
65 BasePage* page = pageFromObject(objectPointer); 75 BasePage* page = pageFromObject(objectPointer);
66 ASSERT(!page->orphaned()); 76 ASSERT(!page->orphaned());
67 // When doing a thread local GC, the marker checks if 77 // When doing a thread local GC, the marker checks if
68 // the object resides in another thread's heap. If it 78 // the object resides in another thread's heap. If it
69 // does, the object should not be marked & traced. 79 // does, the object should not be marked & traced.
70 return page->terminating(); 80 return page->terminating();
71 } 81 }
72 }; 82 };
73 83
74 } // namespace blink 84 } // namespace blink
75 85
76 #endif 86 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698