Commit 2ba38735 authored by Sathya Gunasekaran's avatar Sathya Gunasekaran

Revert "heap: Resolve -Wshadow warning in allocation-observer.cc"

This reverts commit ec4a3124.

Reason for revert: https://bugs.chromium.org/p/chromium/issues/detail?id=1253374#c2

Original change's description:
> heap: Resolve -Wshadow warning in allocation-observer.cc
>
> Bug: v8:12244, v8:12245
> Change-Id: Id6b9e0a3986fb04c1a949b26ecf20da652ddd097
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3181537
> Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
> Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
> Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#77045}

Bug: v8:12244, v8:12245
Change-Id: I506055fa7b959ac9adffa77ebc58234ec5b03371
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3186834Reviewed-by: 's avatarSathya Gunasekaran  <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77100}
parent 6c9f7992
......@@ -4,9 +4,6 @@
#include "src/heap/allocation-observer.h"
#include <algorithm>
#include <cstdint>
#include "src/heap/heap.h"
#include "src/heap/spaces.h"
......@@ -61,16 +58,15 @@ void AllocationCounter::RemoveAllocationObserver(AllocationObserver* observer) {
if (observers_.size() == 0) {
current_counter_ = next_counter_ = 0;
} else {
// There's at least one observer.
const size_t min_next_counter =
std::min_element(observers_.begin(), observers_.end(),
[](const auto& a, const auto& b) {
return a.next_counter_ < b.next_counter_;
})
->next_counter_;
DCHECK_GT(min_next_counter, current_counter_);
const size_t min_step_size = min_next_counter - current_counter_;
next_counter_ = current_counter_ + min_step_size;
size_t step_size = 0;
for (AllocationObserverCounter& observer : observers_) {
size_t left_in_step = observer.next_counter_ - current_counter_;
DCHECK_GT(left_in_step, 0);
step_size = step_size ? std::min(step_size, left_in_step) : left_in_step;
}
next_counter_ = current_counter_ + step_size;
}
}
......
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