Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1135)

Unified Diff: src/heap/mark-compact.cc

Issue 1068833002: More robust when allocation fails during compaction (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/heap/spaces.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | src/heap/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698