[wasm] Print code space size on OOM
If we hit an OOM when allocating the code space for a Wasm module, include the code size we tried to allocate in the error message. This should make crash reports easier to diagnose. R=ecmziegler@chromium.org Bug: chromium:1302310 Change-Id: I0a85caff65efcad122664765c07f78b35095097e Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3506993 Reviewed-by: Emanuel Ziegler <ecmziegler@chromium.org> Commit-Queue: Clemens Backes <clemensb@chromium.org> Cr-Commit-Position: refs/heads/main@{#79402}
This commit is contained in:
parent
35e6a1107a
commit
88a5983d44
@ -2194,7 +2194,13 @@ std::shared_ptr<NativeModule> WasmCodeManager::NewNativeModule(
|
||||
|
||||
// If we cannot allocate enough code space, fail with an OOM message.
|
||||
if (code_vmem_size < min_code_size) {
|
||||
V8::FatalProcessOutOfMemory(isolate, "NewNativeModule");
|
||||
constexpr auto format = base::StaticCharVector(
|
||||
"NewNativeModule cannot allocate required minimum (%zu)");
|
||||
constexpr int kMaxMessageLength =
|
||||
format.size() - 3 + std::numeric_limits<size_t>::digits10;
|
||||
base::EmbeddedVector<char, kMaxMessageLength + 1> message;
|
||||
SNPrintF(message, format.begin(), min_code_size);
|
||||
V8::FatalProcessOutOfMemory(isolate, message.begin());
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
@ -2207,7 +2213,13 @@ std::shared_ptr<NativeModule> WasmCodeManager::NewNativeModule(
|
||||
code_space = TryAllocate(code_vmem_size);
|
||||
if (code_space.IsReserved()) break;
|
||||
if (retries == kAllocationRetries) {
|
||||
V8::FatalProcessOutOfMemory(isolate, "NewNativeModule");
|
||||
constexpr auto format = base::StaticCharVector(
|
||||
"NewNativeModule cannot allocate code space of %zu bytes");
|
||||
constexpr int kMaxMessageLength =
|
||||
format.size() - 3 + std::numeric_limits<size_t>::digits10;
|
||||
base::EmbeddedVector<char, kMaxMessageLength + 1> message;
|
||||
SNPrintF(message, format.begin(), code_vmem_size);
|
||||
V8::FatalProcessOutOfMemory(isolate, message.begin());
|
||||
UNREACHABLE();
|
||||
}
|
||||
// Run one GC, then try the allocation again.
|
||||
|
Loading…
Reference in New Issue
Block a user