| 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 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1184 | 1184 |
| 1185 Page* p = heap()->isolate()->memory_allocator()->AllocatePage<Page>( | 1185 Page* p = heap()->isolate()->memory_allocator()->AllocatePage<Page>( |
| 1186 size, this, executable()); | 1186 size, this, executable()); |
| 1187 if (p == NULL) return false; | 1187 if (p == NULL) return false; |
| 1188 | 1188 |
| 1189 AccountCommitted(static_cast<intptr_t>(p->size())); | 1189 AccountCommitted(static_cast<intptr_t>(p->size())); |
| 1190 | 1190 |
| 1191 // Pages created during bootstrapping may contain immortal immovable objects. | 1191 // Pages created during bootstrapping may contain immortal immovable objects. |
| 1192 if (!heap()->deserialization_complete()) p->MarkNeverEvacuate(); | 1192 if (!heap()->deserialization_complete()) p->MarkNeverEvacuate(); |
| 1193 | 1193 |
| 1194 // When incremental marking was activated, old generation pages are allocated | 1194 // When incremental marking was activated, old space pages are allocated |
| 1195 // black. | 1195 // black. |
| 1196 if (heap()->incremental_marking()->black_allocation()) { | 1196 if (heap()->incremental_marking()->black_allocation() && |
| 1197 identity() == OLD_SPACE) { |
| 1197 Bitmap::SetAllBits(p); | 1198 Bitmap::SetAllBits(p); |
| 1198 p->SetFlag(Page::BLACK_PAGE); | 1199 p->SetFlag(Page::BLACK_PAGE); |
| 1199 if (FLAG_trace_incremental_marking) { | 1200 if (FLAG_trace_incremental_marking) { |
| 1200 PrintIsolate(heap()->isolate(), "Added black page %p\n", p); | 1201 PrintIsolate(heap()->isolate(), "Added black page %p\n", p); |
| 1201 } | 1202 } |
| 1202 } | 1203 } |
| 1203 | 1204 |
| 1204 DCHECK(Capacity() <= heap()->MaxOldGenerationSize()); | 1205 DCHECK(Capacity() <= heap()->MaxOldGenerationSize()); |
| 1205 | 1206 |
| 1206 p->InsertAfter(anchor_.prev_page()); | 1207 p->InsertAfter(anchor_.prev_page()); |
| (...skipping 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2922 uintptr_t base = reinterpret_cast<uintptr_t>(page) / MemoryChunk::kAlignment; | 2923 uintptr_t base = reinterpret_cast<uintptr_t>(page) / MemoryChunk::kAlignment; |
| 2923 uintptr_t limit = base + (page->size() - 1) / MemoryChunk::kAlignment; | 2924 uintptr_t limit = base + (page->size() - 1) / MemoryChunk::kAlignment; |
| 2924 for (uintptr_t key = base; key <= limit; key++) { | 2925 for (uintptr_t key = base; key <= limit; key++) { |
| 2925 HashMap::Entry* entry = chunk_map_.LookupOrInsert( | 2926 HashMap::Entry* entry = chunk_map_.LookupOrInsert( |
| 2926 reinterpret_cast<void*>(key), static_cast<uint32_t>(key)); | 2927 reinterpret_cast<void*>(key), static_cast<uint32_t>(key)); |
| 2927 DCHECK(entry != NULL); | 2928 DCHECK(entry != NULL); |
| 2928 entry->value = page; | 2929 entry->value = page; |
| 2929 } | 2930 } |
| 2930 | 2931 |
| 2931 HeapObject* object = page->GetObject(); | 2932 HeapObject* object = page->GetObject(); |
| 2932 if (heap()->incremental_marking()->black_allocation()) { | |
| 2933 MarkBit mark_bit = Marking::MarkBitFrom(object); | |
| 2934 Marking::MarkBlack(mark_bit); | |
| 2935 page->SetFlag(Page::BLACK_PAGE); | |
| 2936 } | |
| 2937 MSAN_ALLOCATED_UNINITIALIZED_MEMORY(object->address(), object_size); | 2933 MSAN_ALLOCATED_UNINITIALIZED_MEMORY(object->address(), object_size); |
| 2938 | 2934 |
| 2939 if (Heap::ShouldZapGarbage()) { | 2935 if (Heap::ShouldZapGarbage()) { |
| 2940 // Make the object consistent so the heap can be verified in OldSpaceStep. | 2936 // Make the object consistent so the heap can be verified in OldSpaceStep. |
| 2941 // We only need to do this in debug builds or if verify_heap is on. | 2937 // We only need to do this in debug builds or if verify_heap is on. |
| 2942 reinterpret_cast<Object**>(object->address())[0] = | 2938 reinterpret_cast<Object**>(object->address())[0] = |
| 2943 heap()->fixed_array_map(); | 2939 heap()->fixed_array_map(); |
| 2944 reinterpret_cast<Object**>(object->address())[1] = Smi::FromInt(0); | 2940 reinterpret_cast<Object**>(object->address())[1] = Smi::FromInt(0); |
| 2945 } | 2941 } |
| 2946 | 2942 |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3163 object->ShortPrint(); | 3159 object->ShortPrint(); |
| 3164 PrintF("\n"); | 3160 PrintF("\n"); |
| 3165 } | 3161 } |
| 3166 printf(" --------------------------------------\n"); | 3162 printf(" --------------------------------------\n"); |
| 3167 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3163 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
| 3168 } | 3164 } |
| 3169 | 3165 |
| 3170 #endif // DEBUG | 3166 #endif // DEBUG |
| 3171 } // namespace internal | 3167 } // namespace internal |
| 3172 } // namespace v8 | 3168 } // namespace v8 |
| OLD | NEW |