Commit 980a9602 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[wasm][cleanup] Remove single-user NativeModule::Free method

This method only has a single user, and can be implemented in a few
lines, so just inline it.

R=ahaas@chromium.org

Bug: v8:8015
Change-Id: I26247d97ebb939274fa72cc5441e8c2e0c6bc869
Reviewed-on: https://chromium-review.googlesource.com/1245743Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56239}
parent 1fa16da7
...@@ -999,10 +999,14 @@ void WasmCodeManager::FreeNativeModule(NativeModule* native_module) { ...@@ -999,10 +999,14 @@ void WasmCodeManager::FreeNativeModule(NativeModule* native_module) {
DCHECK_EQ(1, native_modules_.count(native_module)); DCHECK_EQ(1, native_modules_.count(native_module));
native_modules_.erase(native_module); native_modules_.erase(native_module);
TRACE_HEAP("Freeing NativeModule %p\n", this); TRACE_HEAP("Freeing NativeModule %p\n", this);
for (auto& vmem : native_module->owned_code_space_) { for (auto& mem : native_module->owned_code_space_) {
lookup_map_.erase(vmem.address()); DCHECK(mem.IsReserved());
Free(&vmem); TRACE_HEAP("VMem Release: %" PRIxPTR ":%" PRIxPTR " (%zu)\n", mem.address(),
DCHECK(!vmem.IsReserved()); mem.end(), mem.size());
lookup_map_.erase(mem.address());
memory_tracker_->ReleaseReservation(mem.size());
mem.Free();
DCHECK(!mem.IsReserved());
} }
native_module->owned_code_space_.clear(); native_module->owned_code_space_.clear();
...@@ -1044,16 +1048,6 @@ WasmCode* WasmCodeManager::LookupCode(Address pc) const { ...@@ -1044,16 +1048,6 @@ WasmCode* WasmCodeManager::LookupCode(Address pc) const {
return candidate ? candidate->Lookup(pc) : nullptr; return candidate ? candidate->Lookup(pc) : nullptr;
} }
void WasmCodeManager::Free(VirtualMemory* mem) {
DCHECK(mem->IsReserved());
void* start = reinterpret_cast<void*>(mem->address());
void* end = reinterpret_cast<void*>(mem->end());
size_t size = mem->size();
mem->Free();
memory_tracker_->ReleaseReservation(size);
TRACE_HEAP("VMem Release: %p:%p (%zu)\n", start, end, size);
}
size_t WasmCodeManager::remaining_uncommitted_code_space() const { size_t WasmCodeManager::remaining_uncommitted_code_space() const {
return remaining_uncommitted_code_space_.load(); return remaining_uncommitted_code_space_.load();
} }
......
...@@ -477,7 +477,6 @@ class V8_EXPORT_PRIVATE WasmCodeManager final { ...@@ -477,7 +477,6 @@ class V8_EXPORT_PRIVATE WasmCodeManager final {
// There's no separate Uncommit. // There's no separate Uncommit.
void FreeNativeModule(NativeModule*); void FreeNativeModule(NativeModule*);
void Free(VirtualMemory* mem);
void AssignRanges(Address start, Address end, NativeModule*); void AssignRanges(Address start, Address end, NativeModule*);
void AssignRangesAndAddModule(Address start, Address end, NativeModule*); void AssignRangesAndAddModule(Address start, Address end, NativeModule*);
bool ShouldForceCriticalMemoryPressureNotification(); bool ShouldForceCriticalMemoryPressureNotification();
......
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