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. |