| Index: src/heap/spaces.cc
|
| diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc
|
| index a85e9fca16b4e6e2b4ffcfb9904a0c49bb3ce599..54e7364d0f6463d723e660ec074c4dfd6646da04 100644
|
| --- a/src/heap/spaces.cc
|
| +++ b/src/heap/spaces.cc
|
| @@ -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;
|
|
|