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

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

Issue 1909803002: Add per thread heap enabled MarkingVisitorImpl Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months 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, bool PerThreadHeapEnabled>
13 class MarkingVisitor final : public Visitor, public MarkingVisitorImpl<MarkingVi sitor<Mode>> { 13 class MarkingVisitor final : public Visitor, public MarkingVisitorImpl<MarkingVi sitor<Mode, PerThreadHeapEnabled>, PerThreadHeapEnabled> {
14 public: 14 public:
15 using Impl = MarkingVisitorImpl<MarkingVisitor<Mode>>; 15 using Impl = MarkingVisitorImpl<MarkingVisitor<Mode, PerThreadHeapEnabled>, PerThreadHeapEnabled>;
16 friend class MarkingVisitorImpl<MarkingVisitor<Mode>>; 16 friend class MarkingVisitorImpl<MarkingVisitor<Mode, PerThreadHeapEnabled>, PerThreadHeapEnabled>;
17 17
18 explicit MarkingVisitor(ThreadState* state) 18 explicit MarkingVisitor(ThreadState* state)
19 : Visitor(state, Mode) 19 : Visitor(state, Mode)
20 { 20 {
21 } 21 }
22 22
23 void markHeader(HeapObjectHeader* header, TraceCallback callback) override 23 void markHeader(HeapObjectHeader* header, TraceCallback callback) override
24 { 24 {
25 Impl::markHeader(header, header->payload(), callback); 25 Impl::markHeader(header, header->payload(), callback);
26 } 26 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 58 }
59 59
60 protected: 60 protected:
61 void registerWeakCellWithCallback(void** cell, WeakCallback callback) overri de 61 void registerWeakCellWithCallback(void** cell, WeakCallback callback) overri de
62 { 62 {
63 Impl::registerWeakCellWithCallback(cell, callback); 63 Impl::registerWeakCellWithCallback(cell, callback);
64 } 64 }
65 65
66 inline bool shouldMarkObject(const void* objectPointer) 66 inline bool shouldMarkObject(const void* objectPointer)
67 { 67 {
68 if (Mode != ThreadLocalMarking) 68 if (Mode == ThreadTerminationMarking) {
69 return true; 69 BasePage* page = pageFromObject(objectPointer);
70 70 ASSERT(!page->orphaned());
71 BasePage* page = pageFromObject(objectPointer); 71 // When doing a thread local GC, the marker checks if
72 ASSERT(!page->orphaned()); 72 // the object resides in another thread's heap. If it
73 // When doing a thread local GC, the marker checks if 73 // does, the object should not be marked & traced.
74 // the object resides in another thread's heap. If it 74 return page->terminating();
75 // does, the object should not be marked & traced. 75 }
76 return page->terminating(); 76 #if ENABLE(ASSERT)
77 if (Mode == ThreadLocalMarking) {
78 BasePage* page = pageFromObject(objectPointer);
79 ASSERT(!page->orphaned());
80 ASSERT(&page->arena()->getThreadState()->heap() == &Visitor::heap()) ;
81 }
82 #endif
83 return true;
77 } 84 }
78 }; 85 };
79 86
80 } // namespace blink 87 } // namespace blink
81 88
82 #endif 89 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698