Commit bf44d3ab authored by Dominik Inführ's avatar Dominik Inführ Committed by V8 LUCI CQ

[heap] Fix failing DCHECK in AllocationCounter::Pause

%SimulateFullSpace uses PauseAllocationObserversScope internally and
so does a GC. When there happens to be a GC during %SimulateFullSpace
(caused by --stress-concurrent-allocation here), then the DCHECK in
AllocationCounter::Pause would fail because it was already paused.

Solve this by counting the number of active
PauseAllocationObserversScopes.

Bug: v8:11936
Change-Id: I86487c24fd33739fd7e6635501b5f0257806c4bc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2992727Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75446}
parent 3ed54568
......@@ -246,9 +246,15 @@ void Space::RemoveAllocationObserver(AllocationObserver* observer) {
allocation_counter_.RemoveAllocationObserver(observer);
}
void Space::PauseAllocationObservers() { allocation_counter_.Pause(); }
void Space::PauseAllocationObservers() {
allocation_observers_paused_depth_++;
if (allocation_observers_paused_depth_ == 1) allocation_counter_.Pause();
}
void Space::ResumeAllocationObservers() { allocation_counter_.Resume(); }
void Space::ResumeAllocationObservers() {
allocation_observers_paused_depth_--;
if (allocation_observers_paused_depth_ == 0) allocation_counter_.Resume();
}
Address SpaceWithLinearArea::ComputeLimit(Address start, Address end,
size_t min_size) {
......
......@@ -188,6 +188,8 @@ class V8_EXPORT_PRIVATE Space : public BaseSpace {
#endif
protected:
int allocation_observers_paused_depth_ = 0;
AllocationCounter allocation_counter_;
// The List manages the pages that belong to the given space.
......
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