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

Unified Diff: src/heap/mark-compact.h

Issue 2840863002: [heap] MC: Refactor page evacuation (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | src/heap/mark-compact.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/mark-compact.h
diff --git a/src/heap/mark-compact.h b/src/heap/mark-compact.h
index e4acac031a5d045adc7e70098d4e55770e96af20..c1ab317d25ba7a841ac9f92765702e874a4da9da 100644
--- a/src/heap/mark-compact.h
+++ b/src/heap/mark-compact.h
@@ -415,6 +415,12 @@ enum PageEvacuationMode { NEW_TO_NEW, NEW_TO_OLD };
class MarkCompactCollectorBase {
public:
virtual ~MarkCompactCollectorBase() {}
+
+ // Note: Make sure to refer to the instances by their concrete collector
+ // type to avoid vtable lookups marking state methods when used in hot paths.
+ virtual MarkingState marking_state(HeapObject* object) const = 0;
+ virtual MarkingState marking_state(MemoryChunk* chunk) const = 0;
+
virtual void SetUp() = 0;
virtual void TearDown() = 0;
virtual void CollectGarbage() = 0;
@@ -439,6 +445,14 @@ class MinorMarkCompactCollector final : public MarkCompactCollectorBase {
explicit MinorMarkCompactCollector(Heap* heap)
: MarkCompactCollectorBase(heap), marking_deque_(heap) {}
+ MarkingState marking_state(HeapObject* object) const override {
+ return MarkingState::External(object);
+ }
+
+ MarkingState marking_state(MemoryChunk* chunk) const override {
+ return MarkingState::External(chunk);
+ }
+
void SetUp() override;
void TearDown() override;
void CollectGarbage() override;
@@ -549,6 +563,14 @@ class MarkCompactCollector final : public MarkCompactCollectorBase {
static void Initialize();
+ MarkingState marking_state(HeapObject* object) const override {
+ return MarkingState::Internal(object);
Michael Lippautz 2017/04/25 14:14:37 These should be the only getters that know about t
+ }
+
+ MarkingState marking_state(MemoryChunk* chunk) const override {
+ return MarkingState::Internal(chunk);
+ }
+
void SetUp() override;
void TearDown() override;
// Performs a global garbage collection.
« no previous file with comments | « no previous file | src/heap/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698