Commit b580e58f authored by Clemens Backes's avatar Clemens Backes Committed by V8 LUCI CQ

[wasm] Generate better OOM locations

The exact method name is not interesting when looking at crash
statistics, and can easily be retrieved from stack traces. Instead,
print a consice string saying what we were trying to do when we ran OOM.
This is more consistent with other OOM location strings.

R=ahaas@chromium.org

Change-Id: Ic8cf70b40c304711e8b96391418019b3f697e977
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3760446Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81691}
parent 725ce493
...@@ -626,7 +626,8 @@ size_t ReservationSize(size_t code_size_estimate, int num_declared_functions, ...@@ -626,7 +626,8 @@ size_t ReservationSize(size_t code_size_estimate, int num_declared_functions,
<< "required reservation minimum (" << minimum_size << "required reservation minimum (" << minimum_size
<< ") is bigger than supported maximum (" << ") is bigger than supported maximum ("
<< WasmCodeAllocator::kMaxCodeSpaceSize << ")"; << WasmCodeAllocator::kMaxCodeSpaceSize << ")";
V8::FatalProcessOutOfMemory(nullptr, "Wasm code space reservation", V8::FatalProcessOutOfMemory(nullptr,
"Exceeding maximum wasm code space size",
oom_detail.PrintToArray().data()); oom_detail.PrintToArray().data());
UNREACHABLE(); UNREACHABLE();
} }
...@@ -732,7 +733,7 @@ base::Vector<byte> WasmCodeAllocator::AllocateForCodeInRegion( ...@@ -732,7 +733,7 @@ base::Vector<byte> WasmCodeAllocator::AllocateForCodeInRegion(
auto oom_detail = base::FormattedString{} auto oom_detail = base::FormattedString{}
<< "cannot allocate more code space (" << reserve_size << "cannot allocate more code space (" << reserve_size
<< " bytes, currently " << total_reserved << ")"; << " bytes, currently " << total_reserved << ")";
V8::FatalProcessOutOfMemory(nullptr, "AllocateForCode", V8::FatalProcessOutOfMemory(nullptr, "Grow wasm code space",
oom_detail.PrintToArray().data()); oom_detail.PrintToArray().data());
UNREACHABLE(); UNREACHABLE();
} }
...@@ -1918,9 +1919,9 @@ void WasmCodeManager::Commit(base::AddressRegion region) { ...@@ -1918,9 +1919,9 @@ void WasmCodeManager::Commit(base::AddressRegion region) {
auto oom_detail = base::FormattedString{} auto oom_detail = base::FormattedString{}
<< "trying to commit " << region.size() << "trying to commit " << region.size()
<< ", already committed " << old_value; << ", already committed " << old_value;
V8::FatalProcessOutOfMemory( V8::FatalProcessOutOfMemory(nullptr,
nullptr, "WasmCodeManager::Commit: Exceeding maximum wasm code space", "Exceeding maximum wasm committed code space",
oom_detail.PrintToArray().data()); oom_detail.PrintToArray().data());
UNREACHABLE(); UNREACHABLE();
} }
if (total_committed_code_space_.compare_exchange_weak( if (total_committed_code_space_.compare_exchange_weak(
...@@ -1961,10 +1962,8 @@ void WasmCodeManager::Commit(base::AddressRegion region) { ...@@ -1961,10 +1962,8 @@ void WasmCodeManager::Commit(base::AddressRegion region) {
if (V8_UNLIKELY(!success)) { if (V8_UNLIKELY(!success)) {
auto oom_detail = base::FormattedString{} << "region size: " auto oom_detail = base::FormattedString{} << "region size: "
<< region.size(); << region.size();
V8::FatalProcessOutOfMemory( V8::FatalProcessOutOfMemory(nullptr, "Commit wasm code space",
nullptr, oom_detail.PrintToArray().data());
"WasmCodeManager::Commit: Cannot make pre-reserved region writable",
oom_detail.PrintToArray().data());
UNREACHABLE(); UNREACHABLE();
} }
} }
...@@ -2202,9 +2201,9 @@ base::AddressRegion WasmCodeManager::AllocateAssemblerBufferSpace(int size) { ...@@ -2202,9 +2201,9 @@ base::AddressRegion WasmCodeManager::AllocateAssemblerBufferSpace(int size) {
auto oom_detail = base::FormattedString{} auto oom_detail = base::FormattedString{}
<< "cannot allocate " << size << "cannot allocate " << size
<< " more bytes for assembler buffers"; << " more bytes for assembler buffers";
V8::FatalProcessOutOfMemory( V8::FatalProcessOutOfMemory(nullptr,
nullptr, "WasmCodeManager::AllocateAssemblerBufferSpace", "Allocate protected assembler buffer space",
oom_detail.PrintToArray().data()); oom_detail.PrintToArray().data());
UNREACHABLE(); UNREACHABLE();
} }
auto region = auto region =
...@@ -2268,7 +2267,7 @@ std::shared_ptr<NativeModule> WasmCodeManager::NewNativeModule( ...@@ -2268,7 +2267,7 @@ std::shared_ptr<NativeModule> WasmCodeManager::NewNativeModule(
auto oom_detail = base::FormattedString{} auto oom_detail = base::FormattedString{}
<< "NewNativeModule cannot allocate code space of " << "NewNativeModule cannot allocate code space of "
<< code_vmem_size << " bytes"; << code_vmem_size << " bytes";
V8::FatalProcessOutOfMemory(isolate, "WasmCodeManager::NewNativeModule", V8::FatalProcessOutOfMemory(isolate, "Allocate initial wasm code space",
oom_detail.PrintToArray().data()); oom_detail.PrintToArray().data());
UNREACHABLE(); UNREACHABLE();
} }
......
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