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

Side by Side Diff: src/spaces.cc

Issue 8700: As discussed on the phone, I'd like your thoughts on the... (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
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 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after
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. Fail if we have 1533 // Free list allocation failed and there is no next page. Fail if we have
1534 // hit the old generation size limit that should cause a garbage 1534 // hit the old generation size limit that should cause a garbage
1535 // collection. 1535 // collection.
1536 if (Heap::OldGenerationAllocationLimitReached()) { 1536 if (!Heap::always_allocate() && Heap::OldGenerationAllocationLimitReached()) {
bak 2008/10/30 11:17:02 This expression is used several times. Please make
1537 return NULL; 1537 return NULL;
1538 } 1538 }
1539 1539
1540 // Try to expand the space and allocate in the new next page. 1540 // Try to expand the space and allocate in the new next page.
1541 ASSERT(!current_page->next_page()->is_valid()); 1541 ASSERT(!current_page->next_page()->is_valid());
1542 if (Expand(current_page)) { 1542 if (Expand(current_page)) {
1543 return AllocateInNextPage(current_page, size_in_bytes); 1543 return AllocateInNextPage(current_page, size_in_bytes);
1544 } 1544 }
1545 1545
1546 // Finally, fail. 1546 // Finally, fail.
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
2011 Object* result = free_list_.Allocate(); 2011 Object* result = free_list_.Allocate();
2012 if (!result->IsFailure()) { 2012 if (!result->IsFailure()) {
2013 accounting_stats_.AllocateBytes(size_in_bytes); 2013 accounting_stats_.AllocateBytes(size_in_bytes);
2014 return HeapObject::cast(result); 2014 return HeapObject::cast(result);
2015 } 2015 }
2016 } 2016 }
2017 2017
2018 // Free list allocation failed and there is no next page. Fail if we have 2018 // Free list allocation failed and there is no next page. Fail if we have
2019 // hit the old generation size limit that should cause a garbage 2019 // hit the old generation size limit that should cause a garbage
2020 // collection. 2020 // collection.
2021 if (Heap::OldGenerationAllocationLimitReached()) { 2021 if (!Heap::always_allocate() && Heap::OldGenerationAllocationLimitReached()) {
2022 return NULL; 2022 return NULL;
2023 } 2023 }
2024 2024
2025 // Try to expand the space and allocate in the new next page. 2025 // Try to expand the space and allocate in the new next page.
2026 ASSERT(!current_page->next_page()->is_valid()); 2026 ASSERT(!current_page->next_page()->is_valid());
2027 if (Expand(current_page)) { 2027 if (Expand(current_page)) {
2028 return AllocateInNextPage(current_page, size_in_bytes); 2028 return AllocateInNextPage(current_page, size_in_bytes);
2029 } 2029 }
2030 2030
2031 // Finally, fail. 2031 // Finally, fail.
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
2244 } 2244 }
2245 2245
2246 2246
2247 Object* LargeObjectSpace::AllocateRawInternal(int requested_size, 2247 Object* LargeObjectSpace::AllocateRawInternal(int requested_size,
2248 int object_size, 2248 int object_size,
2249 Executability executable) { 2249 Executability executable) {
2250 ASSERT(0 < object_size && object_size <= requested_size); 2250 ASSERT(0 < object_size && object_size <= requested_size);
2251 2251
2252 // Check if we want to force a GC before growing the old space further. 2252 // Check if we want to force a GC before growing the old space further.
2253 // If so, fail the allocation. 2253 // If so, fail the allocation.
2254 if (Heap::OldGenerationAllocationLimitReached()) { 2254 if (!Heap::always_allocate() && Heap::OldGenerationAllocationLimitReached()) {
2255 return Failure::RetryAfterGC(requested_size, identity()); 2255 return Failure::RetryAfterGC(requested_size, identity());
2256 } 2256 }
2257 2257
2258 size_t chunk_size; 2258 size_t chunk_size;
2259 LargeObjectChunk* chunk = 2259 LargeObjectChunk* chunk =
2260 LargeObjectChunk::New(requested_size, &chunk_size, executable); 2260 LargeObjectChunk::New(requested_size, &chunk_size, executable);
2261 if (chunk == NULL) { 2261 if (chunk == NULL) {
2262 return Failure::RetryAfterGC(requested_size, identity()); 2262 return Failure::RetryAfterGC(requested_size, identity());
2263 } 2263 }
2264 2264
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
2537 reinterpret_cast<Object**>(object->address() 2537 reinterpret_cast<Object**>(object->address()
2538 + Page::kObjectAreaSize), 2538 + Page::kObjectAreaSize),
2539 allocation_top); 2539 allocation_top);
2540 PrintF("\n"); 2540 PrintF("\n");
2541 } 2541 }
2542 } 2542 }
2543 } 2543 }
2544 #endif // DEBUG 2544 #endif // DEBUG
2545 2545
2546 } } // namespace v8::internal 2546 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698