Commit 07ef612f authored by Eric Holk's avatar Eric Holk Committed by Commit Bot

[wasm] Remove racy DCHECKs

These DCHECKs involve reading and comparing two variables that may be modified
on a separate thread. Thus, there is no way to ensure these comparisons happen
atomically. This leads to runtime failures that are otherwise benign.

The other option would be to take the memory tracker mutex, but this seems
unnecessary given that two atomic counters is sufficient and these checks are
only used during debug builds.

Bug: chromium:838043
Change-Id: I1b87698c46c550bd2d58bfef956b5a07cb2ec52c
Reviewed-on: https://chromium-review.googlesource.com/1038886Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Eric Holk <eholk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52920}
parent 18bc2856
......@@ -122,18 +122,12 @@ void WasmMemoryTracker::ReleaseReservation(size_t num_bytes) {
size_t const old_reserved = reserved_address_space_.fetch_sub(num_bytes);
USE(old_reserved);
DCHECK_LE(num_bytes, old_reserved);
DCHECK_GE(old_reserved - num_bytes, allocated_address_space_);
}
void WasmMemoryTracker::RegisterAllocation(void* allocation_base,
size_t allocation_length,
void* buffer_start,
size_t buffer_length) {
// Make sure the caller has reserved the address space before registering the
// allocation.
DCHECK_LE(allocated_address_space_ + allocation_length,
reserved_address_space_);
base::LockGuard<base::Mutex> scope_lock(&mutex_);
allocated_address_space_ += allocation_length;
......
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