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

Unified Diff: src/heap/spaces.cc

Issue 1316183004: [heap] Throw OOM upon failing to expand a PagedSpace above old gen limits. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Compilation error: size_t vs int Created 5 years, 3 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 | « src/heap/spaces.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « src/heap/spaces.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698