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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/heap/MarkingVisitor.h
diff --git a/third_party/WebKit/Source/platform/heap/MarkingVisitor.h b/third_party/WebKit/Source/platform/heap/MarkingVisitor.h
index deeac44cef50de0731bb46c47e9c9727830efb51..900f298f47d530f1293f2ec312bd94b73c1511ad 100644
--- a/third_party/WebKit/Source/platform/heap/MarkingVisitor.h
+++ b/third_party/WebKit/Source/platform/heap/MarkingVisitor.h
@@ -9,11 +9,11 @@
namespace blink {
-template <Visitor::MarkingMode Mode>
-class MarkingVisitor final : public Visitor, public MarkingVisitorImpl<MarkingVisitor<Mode>> {
+template <Visitor::MarkingMode Mode, bool PerThreadHeapEnabled>
+class MarkingVisitor final : public Visitor, public MarkingVisitorImpl<MarkingVisitor<Mode, PerThreadHeapEnabled>, PerThreadHeapEnabled> {
public:
- using Impl = MarkingVisitorImpl<MarkingVisitor<Mode>>;
- friend class MarkingVisitorImpl<MarkingVisitor<Mode>>;
+ using Impl = MarkingVisitorImpl<MarkingVisitor<Mode, PerThreadHeapEnabled>, PerThreadHeapEnabled>;
+ friend class MarkingVisitorImpl<MarkingVisitor<Mode, PerThreadHeapEnabled>, PerThreadHeapEnabled>;
explicit MarkingVisitor(ThreadState* state)
: Visitor(state, Mode)
@@ -65,15 +65,22 @@ protected:
inline bool shouldMarkObject(const void* objectPointer)
{
- if (Mode != ThreadLocalMarking)
- return true;
-
- BasePage* page = pageFromObject(objectPointer);
- ASSERT(!page->orphaned());
- // When doing a thread local GC, the marker checks if
- // the object resides in another thread's heap. If it
- // does, the object should not be marked & traced.
- return page->terminating();
+ if (Mode == ThreadTerminationMarking) {
+ BasePage* page = pageFromObject(objectPointer);
+ ASSERT(!page->orphaned());
+ // When doing a thread local GC, the marker checks if
+ // the object resides in another thread's heap. If it
+ // does, the object should not be marked & traced.
+ return page->terminating();
+ }
+#if ENABLE(ASSERT)
+ if (Mode == ThreadLocalMarking) {
+ BasePage* page = pageFromObject(objectPointer);
+ ASSERT(!page->orphaned());
+ ASSERT(&page->arena()->getThreadState()->heap() == &Visitor::heap());
+ }
+#endif
+ return true;
}
};

Powered by Google App Engine
This is Rietveld 408576698