Commit a6a887d0 authored by jochen's avatar jochen Committed by Commit bot

Extract code to mark an object during incremental marking

Not only does this remove code duplication, I also plan to use this for
unifying reference group marking later

BUG=none
R=hpayer@chromium.org
LOG=n

Review URL: https://codereview.chromium.org/1007793002

Cr-Commit-Position: refs/heads/master@{#27180}
parent 057857ef
...@@ -251,13 +251,7 @@ class IncrementalMarkingMarkingVisitor ...@@ -251,13 +251,7 @@ class IncrementalMarkingMarkingVisitor
// Marks the object grey and pushes it on the marking stack. // Marks the object grey and pushes it on the marking stack.
INLINE(static void MarkObject(Heap* heap, Object* obj)) { INLINE(static void MarkObject(Heap* heap, Object* obj)) {
HeapObject* heap_object = HeapObject::cast(obj); IncrementalMarking::MarkObject(heap, obj);
MarkBit mark_bit = Marking::MarkBitFrom(heap_object);
if (mark_bit.data_only()) {
MarkBlackOrKeepGrey(heap_object, mark_bit, heap_object->Size());
} else if (Marking::IsWhite(mark_bit)) {
heap->incremental_marking()->WhiteToGreyAndPush(heap_object, mark_bit);
}
} }
// Marks the object black without pushing it on the marking stack. // Marks the object black without pushing it on the marking stack.
...@@ -280,7 +274,7 @@ class IncrementalMarkingRootMarkingVisitor : public ObjectVisitor { ...@@ -280,7 +274,7 @@ class IncrementalMarkingRootMarkingVisitor : public ObjectVisitor {
public: public:
explicit IncrementalMarkingRootMarkingVisitor( explicit IncrementalMarkingRootMarkingVisitor(
IncrementalMarking* incremental_marking) IncrementalMarking* incremental_marking)
: incremental_marking_(incremental_marking) {} : heap_(incremental_marking->heap()) {}
void VisitPointer(Object** p) { MarkObjectByPointer(p); } void VisitPointer(Object** p) { MarkObjectByPointer(p); }
...@@ -293,18 +287,10 @@ class IncrementalMarkingRootMarkingVisitor : public ObjectVisitor { ...@@ -293,18 +287,10 @@ class IncrementalMarkingRootMarkingVisitor : public ObjectVisitor {
Object* obj = *p; Object* obj = *p;
if (!obj->IsHeapObject()) return; if (!obj->IsHeapObject()) return;
HeapObject* heap_object = HeapObject::cast(obj); IncrementalMarking::MarkObject(heap_, obj);
MarkBit mark_bit = Marking::MarkBitFrom(heap_object);
if (mark_bit.data_only()) {
MarkBlackOrKeepGrey(heap_object, mark_bit, heap_object->Size());
} else {
if (Marking::IsWhite(mark_bit)) {
incremental_marking_->WhiteToGreyAndPush(heap_object, mark_bit);
}
}
} }
IncrementalMarking* incremental_marking_; Heap* heap_;
}; };
...@@ -639,6 +625,17 @@ void IncrementalMarking::VisitObject(Map* map, HeapObject* obj, int size) { ...@@ -639,6 +625,17 @@ void IncrementalMarking::VisitObject(Map* map, HeapObject* obj, int size) {
} }
void IncrementalMarking::MarkObject(Heap* heap, Object* obj) {
HeapObject* heap_object = HeapObject::cast(obj);
MarkBit mark_bit = Marking::MarkBitFrom(heap_object);
if (mark_bit.data_only()) {
MarkBlackOrKeepGrey(heap_object, mark_bit, heap_object->Size());
} else if (Marking::IsWhite(mark_bit)) {
heap->incremental_marking()->WhiteToGreyAndPush(heap_object, mark_bit);
}
}
intptr_t IncrementalMarking::ProcessMarkingDeque(intptr_t bytes_to_process) { intptr_t IncrementalMarking::ProcessMarkingDeque(intptr_t bytes_to_process) {
intptr_t bytes_processed = 0; intptr_t bytes_processed = 0;
Map* filler_map = heap_->one_pointer_filler_map(); Map* filler_map = heap_->one_pointer_filler_map();
......
...@@ -189,6 +189,10 @@ class IncrementalMarking { ...@@ -189,6 +189,10 @@ class IncrementalMarking {
bool IsIdleMarkingDelayCounterLimitReached(); bool IsIdleMarkingDelayCounterLimitReached();
INLINE(static void MarkObject(Heap* heap, Object* object));
Heap* heap() const { return heap_; }
private: private:
int64_t SpaceLeftInOldSpace(); int64_t SpaceLeftInOldSpace();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment