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

Side by Side 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, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after
1523 1523
1524 // There is no next page in this space. Try free list allocation. 1524 // There is no next page in this space. Try free list allocation.
1525 int wasted_bytes; 1525 int wasted_bytes;
1526 Object* result = free_list_.Allocate(size_in_bytes, &wasted_bytes); 1526 Object* result = free_list_.Allocate(size_in_bytes, &wasted_bytes);
1527 accounting_stats_.WasteBytes(wasted_bytes); 1527 accounting_stats_.WasteBytes(wasted_bytes);
1528 if (!result->IsFailure()) { 1528 if (!result->IsFailure()) {
1529 accounting_stats_.AllocateBytes(size_in_bytes); 1529 accounting_stats_.AllocateBytes(size_in_bytes);
1530 return HeapObject::cast(result); 1530 return HeapObject::cast(result);
1531 } 1531 }
1532 1532
1533 // Free list allocation failed and there is no next page. Try to expand 1533 // Free list allocation failed and there is no next page. Fail if we have
1534 // the space and allocate in the new next page. 1534 // hit the old generation size limit that should cause a garbage
1535 // collection.
1536 if (Heap::OldGenerationAllocationLimitReached()) {
1537 return NULL;
1538 }
1539
1540 // Try to expand the space and allocate in the new next page.
1535 ASSERT(!current_page->next_page()->is_valid()); 1541 ASSERT(!current_page->next_page()->is_valid());
1536 if (Expand(current_page)) { 1542 if (Expand(current_page)) {
1537 return AllocateInNextPage(current_page, size_in_bytes); 1543 return AllocateInNextPage(current_page, size_in_bytes);
1538 } 1544 }
1539 1545
1540 // Finally, fail. 1546 // Finally, fail.
1541 return NULL; 1547 return NULL;
1542 } 1548 }
1543 1549
1544 1550
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
2002 // map space free list implicitly assumes that all free blocks are map 2008 // map space free list implicitly assumes that all free blocks are map
2003 // sized. 2009 // sized.
2004 if (size_in_bytes == Map::kSize) { 2010 if (size_in_bytes == Map::kSize) {
2005 Object* result = free_list_.Allocate(); 2011 Object* result = free_list_.Allocate();
2006 if (!result->IsFailure()) { 2012 if (!result->IsFailure()) {
2007 accounting_stats_.AllocateBytes(size_in_bytes); 2013 accounting_stats_.AllocateBytes(size_in_bytes);
2008 return HeapObject::cast(result); 2014 return HeapObject::cast(result);
2009 } 2015 }
2010 } 2016 }
2011 2017
2012 // Free list allocation failed and there is no next page. Try to expand 2018 // Free list allocation failed and there is no next page. Fail if we have
2013 // the space and allocate in the new next page. 2019 // hit the old generation size limit that should cause a garbage
2020 // collection.
2021 if (Heap::OldGenerationAllocationLimitReached()) {
2022 return NULL;
2023 }
2024
2025 // Try to expand the space and allocate in the new next page.
2014 ASSERT(!current_page->next_page()->is_valid()); 2026 ASSERT(!current_page->next_page()->is_valid());
2015 if (Expand(current_page)) { 2027 if (Expand(current_page)) {
2016 return AllocateInNextPage(current_page, size_in_bytes); 2028 return AllocateInNextPage(current_page, size_in_bytes);
2017 } 2029 }
2018 2030
2019 // Finally, fail. 2031 // Finally, fail.
2020 return NULL; 2032 return NULL;
2021 } 2033 }
2022 2034
2023 2035
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
2229 2241
2230 size_ = 0; 2242 size_ = 0;
2231 page_count_ = 0; 2243 page_count_ = 0;
2232 } 2244 }
2233 2245
2234 2246
2235 Object* LargeObjectSpace::AllocateRawInternal(int requested_size, 2247 Object* LargeObjectSpace::AllocateRawInternal(int requested_size,
2236 int object_size, 2248 int object_size,
2237 Executability executable) { 2249 Executability executable) {
2238 ASSERT(0 < object_size && object_size <= requested_size); 2250 ASSERT(0 < object_size && object_size <= requested_size);
2251
2252 // Check if we want to force a GC before growing the old space further.
2253 // If so, fail the allocation.
2254 if (Heap::OldGenerationAllocationLimitReached()) {
2255 return Failure::RetryAfterGC(requested_size, identity());
2256 }
2257
2239 size_t chunk_size; 2258 size_t chunk_size;
2240 LargeObjectChunk* chunk = 2259 LargeObjectChunk* chunk =
2241 LargeObjectChunk::New(requested_size, &chunk_size, executable); 2260 LargeObjectChunk::New(requested_size, &chunk_size, executable);
2242 if (chunk == NULL) { 2261 if (chunk == NULL) {
2243 return Failure::RetryAfterGC(requested_size, identity()); 2262 return Failure::RetryAfterGC(requested_size, identity());
2244 } 2263 }
2245 2264
2246 size_ += chunk_size; 2265 size_ += chunk_size;
2247 page_count_++; 2266 page_count_++;
2248 chunk->set_next(first_chunk_); 2267 chunk->set_next(first_chunk_);
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
2518 reinterpret_cast<Object**>(object->address() 2537 reinterpret_cast<Object**>(object->address()
2519 + Page::kObjectAreaSize), 2538 + Page::kObjectAreaSize),
2520 allocation_top); 2539 allocation_top);
2521 PrintF("\n"); 2540 PrintF("\n");
2522 } 2541 }
2523 } 2542 }
2524 } 2543 }
2525 #endif // DEBUG 2544 #endif // DEBUG
2526 2545
2527 } } // namespace v8::internal 2546 } } // namespace v8::internal
OLDNEW
« 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