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() { ...@@ -711,8 +711,6 @@ void IncrementalMarking::FinalizeIncrementally() {
double start = heap_->MonotonicallyIncreasingTimeInMs(); double start = heap_->MonotonicallyIncreasingTimeInMs();
int old_marking_deque_top = marking_deque()->top();
// After finishing incremental marking, we try to discover all unmarked // After finishing incremental marking, we try to discover all unmarked
// objects to reduce the marking load in the final pause. // 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. // 1) We scan and mark the roots again to find all changes to the root set.
...@@ -728,10 +726,10 @@ void IncrementalMarking::FinalizeIncrementally() { ...@@ -728,10 +726,10 @@ void IncrementalMarking::FinalizeIncrementally() {
} }
ProcessWeakCells(); ProcessWeakCells();
int marking_progress = abs(old_marking_deque_top - marking_deque()->top()); int marking_progress =
heap_->mark_compact_collector()->marking_deque()->Size() +
marking_progress += static_cast<int>( static_cast<int>(
heap_->local_embedder_heap_tracer()->NumberOfCachedWrappersToTrace()); heap_->local_embedder_heap_tracer()->NumberOfCachedWrappersToTrace());
double end = heap_->MonotonicallyIncreasingTimeInMs(); double end = heap_->MonotonicallyIncreasingTimeInMs();
double delta = end - start; double delta = end - start;
......
...@@ -47,6 +47,11 @@ class SequentialMarkingDeque { ...@@ -47,6 +47,11 @@ class SequentialMarkingDeque {
inline bool IsEmpty() { return top_ == bottom_; } 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_; } bool overflowed() const { return overflowed_; }
void ClearOverflowed() { overflowed_ = false; } void ClearOverflowed() { overflowed_ = false; }
...@@ -114,8 +119,6 @@ class SequentialMarkingDeque { ...@@ -114,8 +119,6 @@ class SequentialMarkingDeque {
top_ = new_top; top_ = new_top;
} }
int top() { return top_; }
private: private:
// This task uncommits the marking_deque backing store if // This task uncommits the marking_deque backing store if
// markin_deque->in_use_ is false. // 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