Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1176 size, this, executable()); | 1176 size, this, executable()); |
| 1177 if (p == NULL) return false; | 1177 if (p == NULL) return false; |
| 1178 | 1178 |
| 1179 AccountCommitted(static_cast<intptr_t>(p->size())); | 1179 AccountCommitted(static_cast<intptr_t>(p->size())); |
| 1180 | 1180 |
| 1181 // Pages created during bootstrapping may contain immortal immovable objects. | 1181 // Pages created during bootstrapping may contain immortal immovable objects. |
| 1182 if (!heap()->deserialization_complete()) p->MarkNeverEvacuate(); | 1182 if (!heap()->deserialization_complete()) p->MarkNeverEvacuate(); |
| 1183 | 1183 |
| 1184 // When incremental marking was activated, old generation pages are allocated | 1184 // When incremental marking was activated, old generation pages are allocated |
| 1185 // black. | 1185 // black. |
| 1186 if (heap()->incremental_marking()->black_allocation()) { | 1186 if (heap()->incremental_marking()->black_allocation() && |
| 1187 identity() != CODE_SPACE && identity() != MAP_SPACE) { | |
|
ulan
2016/04/06 16:44:43
Let's whitelist instead of blacklist, identity() =
Hannes Payer (out of office)
2016/04/06 21:24:39
Done.
| |
| 1187 Bitmap::SetAllBits(p); | 1188 Bitmap::SetAllBits(p); |
| 1188 p->SetFlag(Page::BLACK_PAGE); | 1189 p->SetFlag(Page::BLACK_PAGE); |
| 1189 if (FLAG_trace_incremental_marking) { | 1190 if (FLAG_trace_incremental_marking) { |
| 1190 PrintIsolate(heap()->isolate(), "Added black page %p\n", p); | 1191 PrintIsolate(heap()->isolate(), "Added black page %p\n", p); |
| 1191 } | 1192 } |
| 1192 } | 1193 } |
| 1193 | 1194 |
| 1194 DCHECK(Capacity() <= heap()->MaxOldGenerationSize()); | 1195 DCHECK(Capacity() <= heap()->MaxOldGenerationSize()); |
| 1195 | 1196 |
| 1196 p->InsertAfter(anchor_.prev_page()); | 1197 p->InsertAfter(anchor_.prev_page()); |
| (...skipping 1697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2894 uintptr_t base = reinterpret_cast<uintptr_t>(page) / MemoryChunk::kAlignment; | 2895 uintptr_t base = reinterpret_cast<uintptr_t>(page) / MemoryChunk::kAlignment; |
| 2895 uintptr_t limit = base + (page->size() - 1) / MemoryChunk::kAlignment; | 2896 uintptr_t limit = base + (page->size() - 1) / MemoryChunk::kAlignment; |
| 2896 for (uintptr_t key = base; key <= limit; key++) { | 2897 for (uintptr_t key = base; key <= limit; key++) { |
| 2897 HashMap::Entry* entry = chunk_map_.LookupOrInsert( | 2898 HashMap::Entry* entry = chunk_map_.LookupOrInsert( |
| 2898 reinterpret_cast<void*>(key), static_cast<uint32_t>(key)); | 2899 reinterpret_cast<void*>(key), static_cast<uint32_t>(key)); |
| 2899 DCHECK(entry != NULL); | 2900 DCHECK(entry != NULL); |
| 2900 entry->value = page; | 2901 entry->value = page; |
| 2901 } | 2902 } |
| 2902 | 2903 |
| 2903 HeapObject* object = page->GetObject(); | 2904 HeapObject* object = page->GetObject(); |
| 2904 if (heap()->incremental_marking()->black_allocation()) { | |
| 2905 MarkBit mark_bit = Marking::MarkBitFrom(object); | |
| 2906 Marking::MarkBlack(mark_bit); | |
| 2907 page->SetFlag(Page::BLACK_PAGE); | |
| 2908 } | |
| 2909 MSAN_ALLOCATED_UNINITIALIZED_MEMORY(object->address(), object_size); | 2905 MSAN_ALLOCATED_UNINITIALIZED_MEMORY(object->address(), object_size); |
| 2910 | 2906 |
| 2911 if (Heap::ShouldZapGarbage()) { | 2907 if (Heap::ShouldZapGarbage()) { |
| 2912 // Make the object consistent so the heap can be verified in OldSpaceStep. | 2908 // Make the object consistent so the heap can be verified in OldSpaceStep. |
| 2913 // We only need to do this in debug builds or if verify_heap is on. | 2909 // We only need to do this in debug builds or if verify_heap is on. |
| 2914 reinterpret_cast<Object**>(object->address())[0] = | 2910 reinterpret_cast<Object**>(object->address())[0] = |
| 2915 heap()->fixed_array_map(); | 2911 heap()->fixed_array_map(); |
| 2916 reinterpret_cast<Object**>(object->address())[1] = Smi::FromInt(0); | 2912 reinterpret_cast<Object**>(object->address())[1] = Smi::FromInt(0); |
| 2917 } | 2913 } |
| 2918 | 2914 |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3135 object->ShortPrint(); | 3131 object->ShortPrint(); |
| 3136 PrintF("\n"); | 3132 PrintF("\n"); |
| 3137 } | 3133 } |
| 3138 printf(" --------------------------------------\n"); | 3134 printf(" --------------------------------------\n"); |
| 3139 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3135 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
| 3140 } | 3136 } |
| 3141 | 3137 |
| 3142 #endif // DEBUG | 3138 #endif // DEBUG |
| 3143 } // namespace internal | 3139 } // namespace internal |
| 3144 } // namespace v8 | 3140 } // namespace v8 |
| OLD | NEW |