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

Side by Side Diff: src/heap/spaces.cc

Issue 1012023002: Merge old data and pointer space. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « src/heap/spaces.h ('k') | src/heap/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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/base/platform/platform.h" 8 #include "src/base/platform/platform.h"
9 #include "src/full-codegen.h" 9 #include "src/full-codegen.h"
10 #include "src/heap/mark-compact.h" 10 #include "src/heap/mark-compact.h"
(...skipping 23 matching lines...) Expand all
34 // just an anchor for the double linked page list. Initialize the current 34 // just an anchor for the double linked page list. Initialize the current
35 // address and end as NULL, then the first iteration will move on 35 // address and end as NULL, then the first iteration will move on
36 // to the first page. 36 // to the first page.
37 Initialize(space, NULL, NULL, kAllPagesInSpace, size_func); 37 Initialize(space, NULL, NULL, kAllPagesInSpace, size_func);
38 } 38 }
39 39
40 40
41 HeapObjectIterator::HeapObjectIterator(Page* page, 41 HeapObjectIterator::HeapObjectIterator(Page* page,
42 HeapObjectCallback size_func) { 42 HeapObjectCallback size_func) {
43 Space* owner = page->owner(); 43 Space* owner = page->owner();
44 DCHECK(owner == page->heap()->old_pointer_space() || 44 DCHECK(owner == page->heap()->old_space() ||
45 owner == page->heap()->old_data_space() ||
46 owner == page->heap()->map_space() || 45 owner == page->heap()->map_space() ||
47 owner == page->heap()->cell_space() || 46 owner == page->heap()->cell_space() ||
48 owner == page->heap()->property_cell_space() || 47 owner == page->heap()->property_cell_space() ||
49 owner == page->heap()->code_space()); 48 owner == page->heap()->code_space());
50 Initialize(reinterpret_cast<PagedSpace*>(owner), page->area_start(), 49 Initialize(reinterpret_cast<PagedSpace*>(owner), page->area_start(),
51 page->area_end(), kOnePageOnly, size_func); 50 page->area_end(), kOnePageOnly, size_func);
52 DCHECK(page->WasSwept() || page->SweepingCompleted()); 51 DCHECK(page->WasSwept() || page->SweepingCompleted());
53 } 52 }
54 53
55 54
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 chunk->initialize_scan_on_scavenge(false); 503 chunk->initialize_scan_on_scavenge(false);
505 chunk->SetFlag(WAS_SWEPT); 504 chunk->SetFlag(WAS_SWEPT);
506 505
507 DCHECK(OFFSET_OF(MemoryChunk, flags_) == kFlagsOffset); 506 DCHECK(OFFSET_OF(MemoryChunk, flags_) == kFlagsOffset);
508 DCHECK(OFFSET_OF(MemoryChunk, live_byte_count_) == kLiveBytesOffset); 507 DCHECK(OFFSET_OF(MemoryChunk, live_byte_count_) == kLiveBytesOffset);
509 508
510 if (executable == EXECUTABLE) { 509 if (executable == EXECUTABLE) {
511 chunk->SetFlag(IS_EXECUTABLE); 510 chunk->SetFlag(IS_EXECUTABLE);
512 } 511 }
513 512
514 if (owner == heap->old_data_space()) {
515 chunk->SetFlag(CONTAINS_ONLY_DATA);
516 }
517
518 return chunk; 513 return chunk;
519 } 514 }
520 515
521 516
522 // Commit MemoryChunk area to the requested size. 517 // Commit MemoryChunk area to the requested size.
523 bool MemoryChunk::CommitArea(size_t requested) { 518 bool MemoryChunk::CommitArea(size_t requested) {
524 size_t guard_size = 519 size_t guard_size =
525 IsFlagSet(IS_EXECUTABLE) ? MemoryAllocator::CodePageGuardSize() : 0; 520 IsFlagSet(IS_EXECUTABLE) ? MemoryAllocator::CodePageGuardSize() : 0;
526 size_t header_size = area_start() - address() - guard_size; 521 size_t header_size = area_start() - address() - guard_size;
527 size_t commit_size = 522 size_t commit_size =
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 } 914 }
920 chunk->IncrementLiveBytes(by); 915 chunk->IncrementLiveBytes(by);
921 } 916 }
922 917
923 918
924 // ----------------------------------------------------------------------------- 919 // -----------------------------------------------------------------------------
925 // PagedSpace implementation 920 // PagedSpace implementation
926 921
927 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::NEW_SPACE) == 922 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::NEW_SPACE) ==
928 ObjectSpace::kObjectSpaceNewSpace); 923 ObjectSpace::kObjectSpaceNewSpace);
929 STATIC_ASSERT(static_cast<ObjectSpace>(1 924 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::OLD_SPACE) ==
930 << AllocationSpace::OLD_POINTER_SPACE) == 925 ObjectSpace::kObjectSpaceOldSpace);
931 ObjectSpace::kObjectSpaceOldPointerSpace);
932 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::OLD_DATA_SPACE) ==
933 ObjectSpace::kObjectSpaceOldDataSpace);
934 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::CODE_SPACE) == 926 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::CODE_SPACE) ==
935 ObjectSpace::kObjectSpaceCodeSpace); 927 ObjectSpace::kObjectSpaceCodeSpace);
936 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::CELL_SPACE) == 928 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::CELL_SPACE) ==
937 ObjectSpace::kObjectSpaceCellSpace); 929 ObjectSpace::kObjectSpaceCellSpace);
938 STATIC_ASSERT( 930 STATIC_ASSERT(
939 static_cast<ObjectSpace>(1 << AllocationSpace::PROPERTY_CELL_SPACE) == 931 static_cast<ObjectSpace>(1 << AllocationSpace::PROPERTY_CELL_SPACE) ==
940 ObjectSpace::kObjectSpacePropertyCellSpace); 932 ObjectSpace::kObjectSpacePropertyCellSpace);
941 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::MAP_SPACE) == 933 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::MAP_SPACE) ==
942 ObjectSpace::kObjectSpaceMapSpace); 934 ObjectSpace::kObjectSpaceMapSpace);
943 935
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1114 allocation_info_.set_top(NULL); 1106 allocation_info_.set_top(NULL);
1115 allocation_info_.set_limit(NULL); 1107 allocation_info_.set_limit(NULL);
1116 } 1108 }
1117 1109
1118 // If page is still in a list, unlink it from that list. 1110 // If page is still in a list, unlink it from that list.
1119 if (page->next_chunk() != NULL) { 1111 if (page->next_chunk() != NULL) {
1120 DCHECK(page->prev_chunk() != NULL); 1112 DCHECK(page->prev_chunk() != NULL);
1121 page->Unlink(); 1113 page->Unlink();
1122 } 1114 }
1123 1115
1124 if (page->IsFlagSet(MemoryChunk::CONTAINS_ONLY_DATA)) { 1116 heap()->QueueMemoryChunkForFree(page);
1125 heap()->isolate()->memory_allocator()->Free(page);
1126 } else {
1127 heap()->QueueMemoryChunkForFree(page);
1128 }
1129 1117
1130 DCHECK(Capacity() > 0); 1118 DCHECK(Capacity() > 0);
1131 accounting_stats_.ShrinkSpace(AreaSize()); 1119 accounting_stats_.ShrinkSpace(AreaSize());
1132 } 1120 }
1133 1121
1134 1122
1135 void PagedSpace::CreateEmergencyMemory() { 1123 void PagedSpace::CreateEmergencyMemory() {
1136 if (identity() == CODE_SPACE) { 1124 if (identity() == CODE_SPACE) {
1137 // Make the emergency block available to the allocator. 1125 // Make the emergency block available to the allocator.
1138 CodeRange* code_range = heap()->isolate()->code_range(); 1126 CodeRange* code_range = heap()->isolate()->code_range();
(...skipping 2001 matching lines...) Expand 10 before | Expand all | Expand 10 after
3140 object->ShortPrint(); 3128 object->ShortPrint();
3141 PrintF("\n"); 3129 PrintF("\n");
3142 } 3130 }
3143 printf(" --------------------------------------\n"); 3131 printf(" --------------------------------------\n");
3144 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 3132 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
3145 } 3133 }
3146 3134
3147 #endif // DEBUG 3135 #endif // DEBUG
3148 } 3136 }
3149 } // namespace v8::internal 3137 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/spaces.h ('k') | src/heap/spaces-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698