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

Side by Side Diff: src/spaces.cc

Issue 8748005: Be more willing to expand old space when evacuating new space at the end of (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 2124 matching lines...) Expand 10 before | Expand all | Expand 10 after
2135 2135
2136 allocation_info_.top = NULL; 2136 allocation_info_.top = NULL;
2137 allocation_info_.limit = NULL; 2137 allocation_info_.limit = NULL;
2138 } 2138 }
2139 } 2139 }
2140 2140
2141 2141
2142 HeapObject* PagedSpace::SlowAllocateRaw(int size_in_bytes) { 2142 HeapObject* PagedSpace::SlowAllocateRaw(int size_in_bytes) {
2143 // Allocation in this space has failed. 2143 // Allocation in this space has failed.
2144 2144
2145 // If there are unswept pages advance lazy sweeper then sweep one page before
2146 // allocating a new page.
2147 if (first_unswept_page_->is_valid()) {
2148 AdvanceSweeper(size_in_bytes);
2149
2150 // Retry the free list allocation.
2151 HeapObject* object = free_list_.Allocate(size_in_bytes);
2152 if (object != NULL) return object;
2153 }
2154
2145 // Free list allocation failed and there is no next page. Fail if we have 2155 // Free list allocation failed and there is no next page. Fail if we have
2146 // hit the old generation size limit that should cause a garbage 2156 // hit the old generation size limit that should cause a garbage
2147 // collection. 2157 // collection.
2148 if (!heap()->always_allocate() && 2158 if (!heap()->always_allocate() &&
2149 heap()->OldGenerationAllocationLimitReached()) { 2159 heap()->OldGenerationAllocationLimitReached()) {
2150 return NULL; 2160 return NULL;
2151 } 2161 }
2152 2162
2153 // If there are unswept pages advance lazy sweeper.
2154 if (first_unswept_page_->is_valid()) {
2155 AdvanceSweeper(size_in_bytes);
2156
2157 // Retry the free list allocation.
2158 HeapObject* object = free_list_.Allocate(size_in_bytes);
2159 if (object != NULL) return object;
2160
2161 if (!IsSweepingComplete()) {
2162 AdvanceSweeper(kMaxInt);
2163
2164 // Retry the free list allocation.
2165 object = free_list_.Allocate(size_in_bytes);
2166 if (object != NULL) return object;
2167 }
2168 }
2169
2170 // Try to expand the space and allocate in the new next page. 2163 // Try to expand the space and allocate in the new next page.
2171 if (Expand()) { 2164 if (Expand()) {
2172 return free_list_.Allocate(size_in_bytes); 2165 return free_list_.Allocate(size_in_bytes);
2173 } 2166 }
2174 2167
2168 // Last ditch, sweep all the remaining pages to try to find space. This may
2169 // cause a pause.
2170 if (!IsSweepingComplete()) {
2171 AdvanceSweeper(kMaxInt);
2172
2173 // Retry the free list allocation.
2174 HeapObject* object = free_list_.Allocate(size_in_bytes);
2175 if (object != NULL) return object;
2176 }
2177
2175 // Finally, fail. 2178 // Finally, fail.
2176 return NULL; 2179 return NULL;
2177 } 2180 }
2178 2181
2179 2182
2180 #ifdef DEBUG 2183 #ifdef DEBUG
2181 void PagedSpace::ReportCodeStatistics() { 2184 void PagedSpace::ReportCodeStatistics() {
2182 Isolate* isolate = Isolate::Current(); 2185 Isolate* isolate = Isolate::Current();
2183 CommentStatistic* comments_statistics = 2186 CommentStatistic* comments_statistics =
2184 isolate->paged_space_comments_statistics(); 2187 isolate->paged_space_comments_statistics();
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
2650 object->ShortPrint(); 2653 object->ShortPrint();
2651 PrintF("\n"); 2654 PrintF("\n");
2652 } 2655 }
2653 printf(" --------------------------------------\n"); 2656 printf(" --------------------------------------\n");
2654 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 2657 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
2655 } 2658 }
2656 2659
2657 #endif // DEBUG 2660 #endif // DEBUG
2658 2661
2659 } } // namespace v8::internal 2662 } } // namespace v8::internal
OLDNEW
« src/mark-compact.cc ('K') | « src/spaces.h ('k') | test/cctest/test-mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698