Commit 5a766b44 authored by ulan's avatar ulan Committed by Commit bot

[heap] Fix computation of marking progress in incremental finalization.

The existing formula returns non-sense when the old top is greater than
the current top.

BUG=chromium:694255

Review-Url: https://codereview.chromium.org/2850373003
Cr-Commit-Position: refs/heads/master@{#45037}
parent 8d628bc9
......@@ -711,8 +711,6 @@ void IncrementalMarking::FinalizeIncrementally() {
double start = heap_->MonotonicallyIncreasingTimeInMs();
int old_marking_deque_top = marking_deque()->top();
// After finishing incremental marking, we try to discover all unmarked
// objects to reduce the marking load in the final pause.
// 1) We scan and mark the roots again to find all changes to the root set.
......@@ -728,9 +726,9 @@ void IncrementalMarking::FinalizeIncrementally() {
}
ProcessWeakCells();
int marking_progress = abs(old_marking_deque_top - marking_deque()->top());
marking_progress += static_cast<int>(
int marking_progress =
heap_->mark_compact_collector()->marking_deque()->Size() +
static_cast<int>(
heap_->local_embedder_heap_tracer()->NumberOfCachedWrappersToTrace());
double end = heap_->MonotonicallyIncreasingTimeInMs();
......
......@@ -47,6 +47,11 @@ class SequentialMarkingDeque {
inline bool IsEmpty() { return top_ == bottom_; }
int Size() {
// Return (top - bottom + capacity) % capacity, where capacity = mask + 1.
return (top_ - bottom_ + mask_ + 1) & mask_;
}
bool overflowed() const { return overflowed_; }
void ClearOverflowed() { overflowed_ = false; }
......@@ -114,8 +119,6 @@ class SequentialMarkingDeque {
top_ = new_top;
}
int top() { return top_; }
private:
// This task uncommits the marking_deque backing store if
// markin_deque->in_use_ is false.
......
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