Commit 28291a38 authored by Ulan Degenbaev's avatar Ulan Degenbaev Committed by Commit Bot

[heap] Change VisitFixedArrayIncremental to not use unshift operation.

BUG=chromium:694255

Change-Id: I80657c5ec11fb36766a79af8584c1f1e3afaa497
Reviewed-on: https://chromium-review.googlesource.com/545595
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46182}
parent 1ce8bba2
......@@ -83,14 +83,6 @@ class ConcurrentMarkingDeque {
int Size() { return bailout_deque_.Size() + shared_deque_.Size(); }
// This is used for a large array with a progress bar.
// For simpicity, unshift to the bailout deque so that the concurrent thread
// does not see such objects.
bool Unshift(HeapObject* object) {
bailout_deque_.Unshift(object);
return true;
}
// Calls the specified callback on each element of the deques and replaces
// the element with the result of the callback. If the callback returns
// nullptr then the element is removed from the deque.
......@@ -140,10 +132,6 @@ class ConcurrentMarkingDeque {
deque_.pop_back();
return result;
}
void Unshift(HeapObject* object) {
base::LockGuard<base::Mutex> guard(&mutex_);
deque_.push_front(object);
}
template <typename Callback>
void Update(Callback callback) {
base::LockGuard<base::Mutex> guard(&mutex_);
......
......@@ -237,30 +237,33 @@ class IncrementalMarkingMarkingVisitor
int object_size = FixedArray::BodyDescriptor::SizeOf(map, object);
int start_offset =
Max(FixedArray::BodyDescriptor::kStartOffset, chunk->progress_bar());
int end_offset =
Min(object_size, start_offset + kProgressBarScanningChunk);
int already_scanned_offset = start_offset;
bool scan_until_end = false;
do {
VisitPointers(heap, object, HeapObject::RawField(object, start_offset),
HeapObject::RawField(object, end_offset));
start_offset = end_offset;
end_offset = Min(object_size, end_offset + kProgressBarScanningChunk);
scan_until_end =
heap->incremental_marking()->marking_worklist()->IsFull();
} while (scan_until_end && start_offset < object_size);
chunk->set_progress_bar(start_offset);
if (start_offset < object_size) {
if (ObjectMarking::IsGrey<IncrementalMarking::kAtomicity>(
object, heap->incremental_marking()->marking_state(object))) {
heap->incremental_marking()->marking_worklist()->Unshift(object);
heap->incremental_marking()->marking_worklist()->Push(object);
} else {
DCHECK(ObjectMarking::IsBlack<IncrementalMarking::kAtomicity>(
object, heap->incremental_marking()->marking_state(object)));
heap->mark_compact_collector()->UnshiftBlack(object);
heap->mark_compact_collector()->PushBlack(object);
}
int end_offset =
Min(object_size, start_offset + kProgressBarScanningChunk);
int already_scanned_offset = start_offset;
bool scan_until_end = false;
do {
VisitPointers(heap, object,
HeapObject::RawField(object, start_offset),
HeapObject::RawField(object, end_offset));
start_offset = end_offset;
end_offset = Min(object_size, end_offset + kProgressBarScanningChunk);
scan_until_end =
heap->incremental_marking()->marking_worklist()->IsFull();
} while (scan_until_end && start_offset < object_size);
chunk->set_progress_bar(start_offset);
if (start_offset < object_size) {
heap->incremental_marking()->NotifyIncompleteScanOfObject(
object_size - (start_offset - already_scanned_offset));
}
heap->incremental_marking()->NotifyIncompleteScanOfObject(
object_size - (start_offset - already_scanned_offset));
}
} else {
FixedArrayVisitor::Visit(map, object);
......
......@@ -21,13 +21,6 @@ void MarkCompactCollector::PushBlack(HeapObject* obj) {
}
}
void MarkCompactCollector::UnshiftBlack(HeapObject* obj) {
DCHECK(ObjectMarking::IsBlack(obj, MarkingState::Internal(obj)));
if (!marking_worklist()->Unshift(obj)) {
ObjectMarking::BlackToGrey(obj, MarkingState::Internal(obj));
}
}
void MarkCompactCollector::MarkObject(HeapObject* obj) {
if (ObjectMarking::WhiteToBlack<AccessMode::NON_ATOMIC>(
obj, MarkingState::Internal(obj))) {
......
......@@ -581,10 +581,6 @@ class MarkCompactCollector final : public MarkCompactCollectorBase {
// Note that this assumes live bytes have not yet been counted.
V8_INLINE void PushBlack(HeapObject* obj);
// Unshifts a black object into the marking stack and accounts for live bytes.
// Note that this assumes lives bytes have already been counted.
V8_INLINE void UnshiftBlack(HeapObject* obj);
// Marks the object black and pushes it on the marking stack.
// This is for non-incremental marking only.
V8_INLINE void MarkObject(HeapObject* obj);
......
......@@ -78,19 +78,6 @@ class SequentialMarkingDeque {
return object;
}
// Unshift the object into the marking stack if there is room, otherwise mark
// the deque as overflowed and wait for a rescan of the heap.
INLINE(bool Unshift(HeapObject* object)) {
if (IsFull()) {
SetOverflowed();
return false;
} else {
bottom_ = ((bottom_ - 1) & mask_);
array_[bottom_] = object;
return true;
}
}
// Calls the specified callback on each element of the deque and replaces
// the element with the result of the callback. If the callback returns
// nullptr then the element is removed from the deque.
......
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