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

Unified Diff: src/spaces.cc

Issue 7870003: Guard against rare case of allocation failure during evacuation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: Created 9 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/spaces.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/spaces.cc
diff --git a/src/spaces.cc b/src/spaces.cc
index 8e7a947f171e86b7693bc682f71ed702e9644980..d2572d9a2cd3f42ba67001952bab6e666bce066e 100644
--- a/src/spaces.cc
+++ b/src/spaces.cc
@@ -721,8 +721,7 @@ MaybeObject* PagedSpace::FindObject(Address addr) {
return Failure::Exception();
}
-
-bool PagedSpace::Expand() {
+bool PagedSpace::CanExpand() {
ASSERT(max_capacity_ % Page::kObjectAreaSize == 0);
ASSERT(Capacity() % Page::kObjectAreaSize == 0);
@@ -733,6 +732,12 @@ bool PagedSpace::Expand() {
// Are we going to exceed capacity for this space?
if ((Capacity() + Page::kPageSize) > max_capacity_) return false;
+ return true;
+}
+
+bool PagedSpace::Expand() {
+ if (!CanExpand()) return false;
+
Page* p = heap()->isolate()->memory_allocator()->
AllocatePage(this, executable());
if (p == NULL) return false;
« no previous file with comments | « src/spaces.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698