Commit 2b31e8aa authored by Jakob Kummerow's avatar Jakob Kummerow Committed by Commit Bot

[heap] Make external_memory_concurrently_freed_ unsigned

to avoid undefined behavior on signed integer overflow.

Change-Id: Ib55b427723a81dddc26f3ce4b2b3b8cc69c9c017
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1782166
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63526}
parent 8864510e
......@@ -80,8 +80,7 @@ void LocalArrayBufferTracker::Free(Callback should_free) {
ExternalBackingStoreType::kArrayBuffer, freed_memory);
// TODO(wez): Remove backing-store from external memory accounting.
page_->heap()->update_external_memory_concurrently_freed(
static_cast<intptr_t>(freed_memory));
page_->heap()->update_external_memory_concurrently_freed(freed_memory);
}
}
......
......@@ -68,8 +68,7 @@ void LocalArrayBufferTracker::Process(Callback callback) {
page_->DecrementExternalBackingStoreBytes(
ExternalBackingStoreType::kArrayBuffer, freed_memory);
// TODO(wez): Remove backing-store from external memory accounting.
page_->heap()->update_external_memory_concurrently_freed(
static_cast<intptr_t>(freed_memory));
page_->heap()->update_external_memory_concurrently_freed(freed_memory);
}
array_buffers_.swap(kept_array_buffers);
......
......@@ -67,7 +67,7 @@ void Heap::update_external_memory(int64_t delta) {
isolate()->isolate_data()->external_memory_ += delta;
}
void Heap::update_external_memory_concurrently_freed(intptr_t freed) {
void Heap::update_external_memory_concurrently_freed(uintptr_t freed) {
external_memory_concurrently_freed_ += freed;
}
......
......@@ -585,7 +585,7 @@ class Heap {
V8_INLINE int64_t external_memory();
V8_INLINE void update_external_memory(int64_t delta);
V8_INLINE void update_external_memory_concurrently_freed(intptr_t freed);
V8_INLINE void update_external_memory_concurrently_freed(uintptr_t freed);
V8_INLINE void account_external_memory_concurrently_freed();
size_t backing_store_bytes() const { return backing_store_bytes_; }
......@@ -1802,7 +1802,7 @@ class Heap {
#endif // DEBUG
// The amount of memory that has been freed concurrently.
std::atomic<intptr_t> external_memory_concurrently_freed_{0};
std::atomic<uintptr_t> external_memory_concurrently_freed_{0};
// This can be calculated directly from a pointer to the heap; however, it is
// more expedient to get at the isolate directly from within Heap methods.
......
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