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

Unified Diff: src/spaces.cc

Issue 8657: Check the growth of the old generation before expanding the paged... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 12 years, 2 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.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/spaces.cc
===================================================================
--- src/spaces.cc (revision 631)
+++ src/spaces.cc (working copy)
@@ -1530,8 +1530,14 @@
return HeapObject::cast(result);
}
- // Free list allocation failed and there is no next page. Try to expand
- // the space and allocate in the new next page.
+ // Free list allocation failed and there is no next page. Fail if we have
+ // hit the old generation size limit that should cause a garbage
+ // collection.
+ if (Heap::OldGenerationAllocationLimitReached()) {
+ return NULL;
+ }
+
+ // Try to expand the space and allocate in the new next page.
ASSERT(!current_page->next_page()->is_valid());
if (Expand(current_page)) {
return AllocateInNextPage(current_page, size_in_bytes);
@@ -2009,8 +2015,14 @@
}
}
- // Free list allocation failed and there is no next page. Try to expand
- // the space and allocate in the new next page.
+ // Free list allocation failed and there is no next page. Fail if we have
+ // hit the old generation size limit that should cause a garbage
+ // collection.
+ if (Heap::OldGenerationAllocationLimitReached()) {
+ return NULL;
+ }
+
+ // Try to expand the space and allocate in the new next page.
ASSERT(!current_page->next_page()->is_valid());
if (Expand(current_page)) {
return AllocateInNextPage(current_page, size_in_bytes);
@@ -2236,6 +2248,13 @@
int object_size,
Executability executable) {
ASSERT(0 < object_size && object_size <= requested_size);
+
+ // Check if we want to force a GC before growing the old space further.
+ // If so, fail the allocation.
+ if (Heap::OldGenerationAllocationLimitReached()) {
+ return Failure::RetryAfterGC(requested_size, identity());
+ }
+
size_t chunk_size;
LargeObjectChunk* chunk =
LargeObjectChunk::New(requested_size, &chunk_size, executable);
« no previous file with comments | « src/heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698