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

Side by Side Diff: src/spaces.cc

Issue 10918067: Refactoring of snapshots. This simplifies and improves (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/spaces.h ('k') | src/spaces-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 intptr_t PagedSpace::SizeOfFirstPage() { 874 intptr_t PagedSpace::SizeOfFirstPage() {
875 int size = 0; 875 int size = 0;
876 switch (identity()) { 876 switch (identity()) {
877 case OLD_POINTER_SPACE: 877 case OLD_POINTER_SPACE:
878 size = 64 * kPointerSize * KB; 878 size = 64 * kPointerSize * KB;
879 break; 879 break;
880 case OLD_DATA_SPACE: 880 case OLD_DATA_SPACE:
881 size = 192 * KB; 881 size = 192 * KB;
882 break; 882 break;
883 case MAP_SPACE: 883 case MAP_SPACE:
884 size = 128 * KB; 884 size = 16 * kPointerSize * KB;
885 break; 885 break;
886 case CELL_SPACE: 886 case CELL_SPACE:
887 size = 96 * KB; 887 size = 16 * kPointerSize * KB;
888 break; 888 break;
889 case CODE_SPACE: 889 case CODE_SPACE:
890 if (kPointerSize == 8) { 890 if (kPointerSize == 8) {
891 // On x64 we allocate code pages in a special way (from the reserved 891 // On x64 we allocate code pages in a special way (from the reserved
892 // 2Byte area). That part of the code is not yet upgraded to handle 892 // 2Byte area). That part of the code is not yet upgraded to handle
893 // small pages. 893 // small pages.
894 size = AreaSize(); 894 size = AreaSize();
895 } else { 895 } else {
896 size = 384 * KB; 896 size = 384 * KB;
897 } 897 }
(...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after
2251 if (new_area == NULL) new_area = SlowAllocateRaw(size_in_bytes); 2251 if (new_area == NULL) new_area = SlowAllocateRaw(size_in_bytes);
2252 if (new_area == NULL) return false; 2252 if (new_area == NULL) return false;
2253 2253
2254 int old_linear_size = static_cast<int>(limit() - top()); 2254 int old_linear_size = static_cast<int>(limit() - top());
2255 // Mark the old linear allocation area with a free space so it can be 2255 // Mark the old linear allocation area with a free space so it can be
2256 // skipped when scanning the heap. This also puts it back in the free list 2256 // skipped when scanning the heap. This also puts it back in the free list
2257 // if it is big enough. 2257 // if it is big enough.
2258 Free(top(), old_linear_size); 2258 Free(top(), old_linear_size);
2259 2259
2260 SetTop(new_area->address(), new_area->address() + size_in_bytes); 2260 SetTop(new_area->address(), new_area->address() + size_in_bytes);
2261 Allocate(size_in_bytes);
2262 return true; 2261 return true;
2263 } 2262 }
2264 2263
2265 2264
2265 static void RepairFreeList(Heap* heap, FreeListNode* n) {
2266 while (n != NULL) {
2267 Map** map_location = reinterpret_cast<Map**>(n->address());
2268 if (*map_location == NULL) {
2269 *map_location = heap->free_space_map();
2270 } else {
2271 ASSERT(*map_location == heap->free_space_map());
2272 }
2273 n = n->next();
2274 }
2275 }
2276
2277
2278 void FreeList::RepairLists(Heap* heap) {
2279 RepairFreeList(heap, small_list_);
2280 RepairFreeList(heap, medium_list_);
2281 RepairFreeList(heap, large_list_);
2282 RepairFreeList(heap, huge_list_);
2283 }
2284
2285
2286 // After we have booted, we have created a map which represents free space
2287 // on the heap. If there was already a free list then the elements on it
2288 // were created with the wrong FreeSpaceMap (normally NULL), so we need to
2289 // fix them.
2290 void PagedSpace::RepairFreeListsAfterBoot() {
2291 free_list_.RepairLists(heap());
2292 }
2293
2294
2266 // You have to call this last, since the implementation from PagedSpace 2295 // You have to call this last, since the implementation from PagedSpace
2267 // doesn't know that memory was 'promised' to large object space. 2296 // doesn't know that memory was 'promised' to large object space.
2268 bool LargeObjectSpace::ReserveSpace(int bytes) { 2297 bool LargeObjectSpace::ReserveSpace(int bytes) {
2269 return heap()->OldGenerationCapacityAvailable() >= bytes && 2298 return heap()->OldGenerationCapacityAvailable() >= bytes &&
2270 (!heap()->incremental_marking()->IsStopped() || 2299 (!heap()->incremental_marking()->IsStopped() ||
2271 heap()->OldGenerationSpaceAvailable() >= bytes); 2300 heap()->OldGenerationSpaceAvailable() >= bytes);
2272 } 2301 }
2273 2302
2274 2303
2275 bool PagedSpace::AdvanceSweeper(intptr_t bytes_to_sweep) { 2304 bool PagedSpace::AdvanceSweeper(intptr_t bytes_to_sweep) {
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
2858 object->ShortPrint(); 2887 object->ShortPrint();
2859 PrintF("\n"); 2888 PrintF("\n");
2860 } 2889 }
2861 printf(" --------------------------------------\n"); 2890 printf(" --------------------------------------\n");
2862 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 2891 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
2863 } 2892 }
2864 2893
2865 #endif // DEBUG 2894 #endif // DEBUG
2866 2895
2867 } } // namespace v8::internal 2896 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/spaces.h ('k') | src/spaces-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698