| Index: src/heap/mark-compact.cc
|
| diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
|
| index be1825f40bf0a75bdeae1ab33c83995652681d1b..ada69add09e39998621abe3072ff7ec69b830dea 100644
|
| --- a/src/heap/mark-compact.cc
|
| +++ b/src/heap/mark-compact.cc
|
| @@ -3354,12 +3354,13 @@ void MarkCompactCollector::EvacuatePages() {
|
| // Allocate emergency memory for the case when compaction fails due to out
|
| // of memory.
|
| if (!space->HasEmergencyMemory()) {
|
| - space->CreateEmergencyMemory();
|
| + space->CreateEmergencyMemory(); // If the OS lets us.
|
| }
|
| if (p->IsEvacuationCandidate()) {
|
| - // During compaction we might have to request a new page. Check that we
|
| - // have an emergency page and the space still has room for that.
|
| - if (space->HasEmergencyMemory() || space->CanExpand()) {
|
| + // During compaction we might have to request a new page in order to free
|
| + // up a page. Check that we actually got an emergency page above so we
|
| + // can guarantee that this succeeds.
|
| + if (space->HasEmergencyMemory()) {
|
| EvacuateLiveObjectsFromPage(p);
|
| // Unlink the page from the list of pages here. We must not iterate
|
| // over that page later (e.g. when scan on scavenge pages are
|
|
|