Commit 61d1cedf authored by mlippautz's avatar mlippautz Committed by Commit bot

[heap] Throw OOM upon failing to expand a PagedSpace above old gen limits.

The AlwaysAllocate scope make it impossible to enforce a DCHECK on the maximum
old generation sizes as e.g. large objects can still be allocated using this
scope. Returning false here results in OOM.

R=mstarzinger@chromium.org
BUG=chromium:525448
LOG=N

Review URL: https://codereview.chromium.org/1316183004

Cr-Commit-Position: refs/heads/master@{#30535}
parent 038f5eaf
......@@ -1082,28 +1082,27 @@ Object* PagedSpace::FindObject(Address addr) {
}
bool PagedSpace::CanExpand() {
bool PagedSpace::CanExpand(size_t size) {
DCHECK(heap()->mark_compact_collector()->is_compacting() ||
Capacity() <= heap()->MaxOldGenerationSize());
DCHECK(heap()->CommittedOldGenerationMemory() <=
heap()->MaxOldGenerationSize() +
PagedSpace::MaxEmergencyMemoryAllocated());
// Are we going to exceed capacity for this space?
if (!heap()->CanExpandOldGeneration(Page::kPageSize)) return false;
// Are we going to exceed capacity for this space? At this point we can be
// way over the maximum size because of AlwaysAllocate scopes and large
// objects.
if (!heap()->CanExpandOldGeneration(static_cast<int>(size))) return false;
return true;
}
bool PagedSpace::Expand() {
if (!CanExpand()) return false;
intptr_t size = AreaSize();
if (snapshotable() && !HasPages()) {
size = Snapshot::SizeOfFirstPage(heap()->isolate(), identity());
}
if (!CanExpand(size)) return false;
Page* p = heap()->isolate()->memory_allocator()->AllocatePage(size, this,
executable());
if (p == NULL) return false;
......
......@@ -1919,7 +1919,7 @@ class PagedSpace : public Space {
void EvictEvacuationCandidatesFromFreeLists();
bool CanExpand();
bool CanExpand(size_t size);
// Returns the number of total pages in this space.
int CountTotalPages();
......
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