Commit 49989753 authored by vegorov@chromium.org's avatar vegorov@chromium.org

Don't ignore return value of CommitCodePage in AllocateAlignedMemory.

Release the mapping as whole if commit failed to avoid leaking virtual address space.

R=mstarzinger@chromium.org
BUG=chromium:118625

Review URL: https://chromiumcodereview.appspot.com/10260012

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11471 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b54ca31f
......@@ -362,15 +362,22 @@ Address MemoryAllocator::AllocateAlignedMemory(size_t size,
if (base == NULL) return NULL;
if (executable == EXECUTABLE) {
CommitCodePage(&reservation, base, size);
if (!CommitCodePage(&reservation, base, size)) {
base = NULL;
}
} else {
if (!reservation.Commit(base,
size,
executable == EXECUTABLE)) {
return NULL;
if (!reservation.Commit(base, size, false)) {
base = NULL;
}
}
if (base == NULL) {
// Failed to commit the body. Release the mapping and any partially
// commited regions inside it.
reservation.Release();
return NULL;
}
controller->TakeControl(&reservation);
return base;
}
......
......@@ -1042,7 +1042,9 @@ class MemoryAllocator {
return CodePageAreaEndOffset() - CodePageAreaStartOffset();
}
static bool CommitCodePage(VirtualMemory* vm, Address start, size_t size);
MUST_USE_RESULT static bool CommitCodePage(VirtualMemory* vm,
Address start,
size_t size);
private:
Isolate* isolate_;
......
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