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

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

Issue 1420423009: [heap] Black allocation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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
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/heap/spaces.h" 5 #include "src/heap/spaces.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/full-codegen.h" 9 #include "src/full-codegen/full-codegen.h"
10 #include "src/heap/slot-set.h" 10 #include "src/heap/slot-set.h"
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 1149
1150 Page* p = heap()->isolate()->memory_allocator()->AllocatePage(size, this, 1150 Page* p = heap()->isolate()->memory_allocator()->AllocatePage(size, this,
1151 executable()); 1151 executable());
1152 if (p == NULL) return false; 1152 if (p == NULL) return false;
1153 1153
1154 AccountCommitted(static_cast<intptr_t>(p->size())); 1154 AccountCommitted(static_cast<intptr_t>(p->size()));
1155 1155
1156 // Pages created during bootstrapping may contain immortal immovable objects. 1156 // Pages created during bootstrapping may contain immortal immovable objects.
1157 if (!heap()->deserialization_complete()) p->MarkNeverEvacuate(); 1157 if (!heap()->deserialization_complete()) p->MarkNeverEvacuate();
1158 1158
1159 // When incremental marking was activated, old generation pages are allocated
1160 // black.
1161 if (heap()->incremental_marking()->black_allocation()) {
1162 Bitmap::SetAllBits(p);
1163 p->SetFlag(Page::BLACK_PAGE);
1164 if (FLAG_trace_incremental_marking) {
1165 PrintIsolate(heap()->isolate(), "Added black page %p\n", p);
1166 }
1167 }
1168
1159 DCHECK(Capacity() <= heap()->MaxOldGenerationSize()); 1169 DCHECK(Capacity() <= heap()->MaxOldGenerationSize());
1160 1170
1161 p->InsertAfter(anchor_.prev_page()); 1171 p->InsertAfter(anchor_.prev_page());
1162 1172
1163 return true; 1173 return true;
1164 } 1174 }
1165 1175
1166 1176
1167 int PagedSpace::CountTotalPages() { 1177 int PagedSpace::CountTotalPages() {
1168 PageIterator it(this); 1178 PageIterator it(this);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 1260
1251 // Perform space-specific object verification. 1261 // Perform space-specific object verification.
1252 VerifyObject(object); 1262 VerifyObject(object);
1253 1263
1254 // The object itself should look OK. 1264 // The object itself should look OK.
1255 object->ObjectVerify(); 1265 object->ObjectVerify();
1256 1266
1257 // All the interior pointers should be contained in the heap. 1267 // All the interior pointers should be contained in the heap.
1258 int size = object->Size(); 1268 int size = object->Size();
1259 object->IterateBody(map->instance_type(), size, visitor); 1269 object->IterateBody(map->instance_type(), size, visitor);
1260 if (Marking::IsBlack(Marking::MarkBitFrom(object))) { 1270 if (!page->IsFlagSet(Page::BLACK_PAGE) &&
1271 Marking::IsBlack(Marking::MarkBitFrom(object))) {
1261 black_size += size; 1272 black_size += size;
1262 } 1273 }
1263 1274
1264 CHECK(object->address() + size <= top); 1275 CHECK(object->address() + size <= top);
1265 end_of_previous_object = object->address() + size; 1276 end_of_previous_object = object->address() + size;
1266 } 1277 }
1267 CHECK_LE(black_size, page->LiveBytes()); 1278 CHECK_LE(black_size, page->LiveBytes());
1268 } 1279 }
1269 CHECK(allocation_pointer_found_in_space); 1280 CHECK(allocation_pointer_found_in_space);
1270 } 1281 }
(...skipping 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after
2992 uintptr_t base = reinterpret_cast<uintptr_t>(page) / MemoryChunk::kAlignment; 3003 uintptr_t base = reinterpret_cast<uintptr_t>(page) / MemoryChunk::kAlignment;
2993 uintptr_t limit = base + (page->size() - 1) / MemoryChunk::kAlignment; 3004 uintptr_t limit = base + (page->size() - 1) / MemoryChunk::kAlignment;
2994 for (uintptr_t key = base; key <= limit; key++) { 3005 for (uintptr_t key = base; key <= limit; key++) {
2995 HashMap::Entry* entry = chunk_map_.LookupOrInsert( 3006 HashMap::Entry* entry = chunk_map_.LookupOrInsert(
2996 reinterpret_cast<void*>(key), static_cast<uint32_t>(key)); 3007 reinterpret_cast<void*>(key), static_cast<uint32_t>(key));
2997 DCHECK(entry != NULL); 3008 DCHECK(entry != NULL);
2998 entry->value = page; 3009 entry->value = page;
2999 } 3010 }
3000 3011
3001 HeapObject* object = page->GetObject(); 3012 HeapObject* object = page->GetObject();
3002 3013 if (heap()->incremental_marking()->black_allocation()) {
3014 MarkBit mark_bit = Marking::MarkBitFrom(object);
3015 Marking::MarkBlack(mark_bit);
3016 page->SetFlag(Page::BLACK_PAGE);
3017 }
3003 MSAN_ALLOCATED_UNINITIALIZED_MEMORY(object->address(), object_size); 3018 MSAN_ALLOCATED_UNINITIALIZED_MEMORY(object->address(), object_size);
3004 3019
3005 if (Heap::ShouldZapGarbage()) { 3020 if (Heap::ShouldZapGarbage()) {
3006 // Make the object consistent so the heap can be verified in OldSpaceStep. 3021 // Make the object consistent so the heap can be verified in OldSpaceStep.
3007 // We only need to do this in debug builds or if verify_heap is on. 3022 // We only need to do this in debug builds or if verify_heap is on.
3008 reinterpret_cast<Object**>(object->address())[0] = 3023 reinterpret_cast<Object**>(object->address())[0] =
3009 heap()->fixed_array_map(); 3024 heap()->fixed_array_map();
3010 reinterpret_cast<Object**>(object->address())[1] = Smi::FromInt(0); 3025 reinterpret_cast<Object**>(object->address())[1] = Smi::FromInt(0);
3011 } 3026 }
3012 3027
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
3230 object->ShortPrint(); 3245 object->ShortPrint();
3231 PrintF("\n"); 3246 PrintF("\n");
3232 } 3247 }
3233 printf(" --------------------------------------\n"); 3248 printf(" --------------------------------------\n");
3234 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 3249 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
3235 } 3250 }
3236 3251
3237 #endif // DEBUG 3252 #endif // DEBUG
3238 } // namespace internal 3253 } // namespace internal
3239 } // namespace v8 3254 } // namespace v8
OLDNEW
« src/heap/heap.cc ('K') | « 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