| Index: src/heap/spaces.cc
|
| diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc
|
| index d372083a4a63aee1e48dbc4a18950a9ffa79e39e..a1c31800c922f57282399c066ce2a2e2c7737611 100644
|
| --- a/src/heap/spaces.cc
|
| +++ b/src/heap/spaces.cc
|
| @@ -1017,7 +1017,8 @@ Object* PagedSpace::FindObject(Address addr) {
|
|
|
| bool PagedSpace::CanExpand() {
|
| DCHECK(max_capacity_ % AreaSize() == 0);
|
| - DCHECK(Capacity() <= heap()->MaxOldGenerationSize());
|
| + DCHECK(heap()->mark_compact_collector()->is_compacting() ||
|
| + Capacity() <= heap()->MaxOldGenerationSize());
|
| DCHECK(heap()->CommittedOldGenerationMemory() <=
|
| heap()->MaxOldGenerationSize() +
|
| PagedSpace::MaxEmergencyMemoryAllocated());
|
| @@ -1164,6 +1165,11 @@ void PagedSpace::FreeEmergencyMemory() {
|
|
|
|
|
| void PagedSpace::UseEmergencyMemory() {
|
| + // Page::Initialize makes the chunk into a real page and adds it to the
|
| + // accounting for this space. Unlike PagedSpace::Expand, we don't check
|
| + // CanExpand first, so we can go over the limits a little here. That's OK,
|
| + // because we are in the process of compacting which will free up at least as
|
| + // much memory as it allocates.
|
| Page* page = Page::Initialize(heap(), emergency_memory_, executable(), this);
|
| page->InsertAfter(anchor_.prev_page());
|
| emergency_memory_ = NULL;
|
|
|