Commit 7bf6bf93 authored by Igor Sheludko's avatar Igor Sheludko Committed by V8 LUCI CQ

[ext-code-space][heap] Add Executability to the v8-oom-location message

... in order to distinguish OOMs caused by code range exhaustion from
other OOMs.

Bug: v8:11880
Change-Id: Ic27242bee7dd7b68673ea478d5972a055ec58943
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3707289
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81232}
parent 2ed243c3
......@@ -252,7 +252,7 @@ Address MemoryAllocator::AllocateAlignedMemory(
DCHECK_LT(area_size, chunk_size);
VirtualMemory reservation(page_allocator, chunk_size, hint, alignment);
if (!reservation.IsReserved()) return HandleAllocationFailure();
if (!reservation.IsReserved()) return HandleAllocationFailure(executable);
// We cannot use the last chunk in the address space because we would
// overflow when comparing top and limit if this chunk is used for a
......@@ -264,7 +264,7 @@ Address MemoryAllocator::AllocateAlignedMemory(
// Retry reserve virtual memory.
reservation = VirtualMemory(page_allocator, chunk_size, hint, alignment);
if (!reservation.IsReserved()) return HandleAllocationFailure();
if (!reservation.IsReserved()) return HandleAllocationFailure(executable);
}
Address base = reservation.address();
......@@ -273,7 +273,7 @@ Address MemoryAllocator::AllocateAlignedMemory(
const size_t aligned_area_size = ::RoundUp(area_size, GetCommitPageSize());
if (!SetPermissionsOnExecutableMemoryChunk(&reservation, base,
aligned_area_size, chunk_size)) {
return HandleAllocationFailure();
return HandleAllocationFailure(executable);
}
} else {
// No guard page between page header and object area. This allows us to make
......@@ -286,7 +286,7 @@ Address MemoryAllocator::AllocateAlignedMemory(
PageAllocator::kReadWrite)) {
UpdateAllocatedSpaceLimits(base, base + commit_size);
} else {
return HandleAllocationFailure();
return HandleAllocationFailure(executable);
}
}
......@@ -294,11 +294,13 @@ Address MemoryAllocator::AllocateAlignedMemory(
return base;
}
Address MemoryAllocator::HandleAllocationFailure() {
Address MemoryAllocator::HandleAllocationFailure(Executability executable) {
Heap* heap = isolate_->heap();
if (!heap->deserialization_complete()) {
heap->FatalProcessOutOfMemory(
"MemoryChunk allocation failed during deserialization.");
executable == EXECUTABLE
? "Executable MemoryChunk allocation failed during deserialization."
: "MemoryChunk allocation failed during deserialization.");
}
return kNullAddress;
}
......
......@@ -261,7 +261,7 @@ class MemoryAllocator {
void UnregisterReadOnlyPage(ReadOnlyPage* page);
Address HandleAllocationFailure();
Address HandleAllocationFailure(Executability executable);
private:
// Used to store all data about MemoryChunk allocation, e.g. in
......
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