[heap] Fix accounting of used bytes in CppHeap
Bug: chromium:1404804, v8:13207 Change-Id: I352c3be0125c4344b613474757a900eb0114ff5f Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4135878 Auto-Submit: Michael Lippautz <mlippautz@chromium.org> Reviewed-by: Anton Bikineev <bikineev@chromium.org> Commit-Queue: Michael Lippautz <mlippautz@chromium.org> Commit-Queue: Anton Bikineev <bikineev@chromium.org> Cr-Commit-Position: refs/heads/main@{#85089}
This commit is contained in:
parent
da8ef354e8
commit
5b1929a8f0
@ -885,9 +885,11 @@ void CppHeap::ReportBufferedAllocationSizeIfPossible() {
|
||||
|
||||
if (bytes_to_report < 0) {
|
||||
DCHECK_GE(used_size_.load(std::memory_order_relaxed), bytes_to_report);
|
||||
used_size_.fetch_sub(bytes_to_report, std::memory_order_relaxed);
|
||||
used_size_.fetch_sub(static_cast<size_t>(-bytes_to_report),
|
||||
std::memory_order_relaxed);
|
||||
} else {
|
||||
used_size_.fetch_add(bytes_to_report, std::memory_order_relaxed);
|
||||
used_size_.fetch_add(static_cast<size_t>(bytes_to_report),
|
||||
std::memory_order_relaxed);
|
||||
allocated_size_ += bytes_to_report;
|
||||
|
||||
if (v8_flags.global_gc_scheduling && v8_flags.incremental_marking) {
|
||||
|
Loading…
Reference in New Issue
Block a user