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}
This commit is contained in:
parent
057857ef06
commit
a6a887d083
@ -251,13 +251,7 @@ class IncrementalMarkingMarkingVisitor
|
||||
|
||||
// Marks the object grey and pushes it on the marking stack.
|
||||
INLINE(static void 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);
|
||||
}
|
||||
IncrementalMarking::MarkObject(heap, obj);
|
||||
}
|
||||
|
||||
// Marks the object black without pushing it on the marking stack.
|
||||
@ -280,7 +274,7 @@ class IncrementalMarkingRootMarkingVisitor : public ObjectVisitor {
|
||||
public:
|
||||
explicit IncrementalMarkingRootMarkingVisitor(
|
||||
IncrementalMarking* incremental_marking)
|
||||
: incremental_marking_(incremental_marking) {}
|
||||
: heap_(incremental_marking->heap()) {}
|
||||
|
||||
void VisitPointer(Object** p) { MarkObjectByPointer(p); }
|
||||
|
||||
@ -293,18 +287,10 @@ class IncrementalMarkingRootMarkingVisitor : public ObjectVisitor {
|
||||
Object* obj = *p;
|
||||
if (!obj->IsHeapObject()) return;
|
||||
|
||||
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)) {
|
||||
incremental_marking_->WhiteToGreyAndPush(heap_object, mark_bit);
|
||||
}
|
||||
}
|
||||
IncrementalMarking::MarkObject(heap_, obj);
|
||||
}
|
||||
|
||||
IncrementalMarking* incremental_marking_;
|
||||
Heap* heap_;
|
||||
};
|
||||
|
||||
|
||||
@ -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 bytes_processed = 0;
|
||||
Map* filler_map = heap_->one_pointer_filler_map();
|
||||
|
@ -189,6 +189,10 @@ class IncrementalMarking {
|
||||
|
||||
bool IsIdleMarkingDelayCounterLimitReached();
|
||||
|
||||
INLINE(static void MarkObject(Heap* heap, Object* object));
|
||||
|
||||
Heap* heap() const { return heap_; }
|
||||
|
||||
private:
|
||||
int64_t SpaceLeftInOldSpace();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user