| 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/base/platform/semaphore.h" | 9 #include "src/base/platform/semaphore.h" |
| 10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
| (...skipping 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1258 // Pages created during bootstrapping may contain immortal immovable objects. | 1258 // Pages created during bootstrapping may contain immortal immovable objects. |
| 1259 if (!heap()->deserialization_complete()) p->MarkNeverEvacuate(); | 1259 if (!heap()->deserialization_complete()) p->MarkNeverEvacuate(); |
| 1260 | 1260 |
| 1261 // When incremental marking was activated, old space pages are allocated | 1261 // When incremental marking was activated, old space pages are allocated |
| 1262 // black. | 1262 // black. |
| 1263 if (heap()->incremental_marking()->black_allocation() && | 1263 if (heap()->incremental_marking()->black_allocation() && |
| 1264 identity() == OLD_SPACE) { | 1264 identity() == OLD_SPACE) { |
| 1265 Bitmap::SetAllBits(p); | 1265 Bitmap::SetAllBits(p); |
| 1266 p->SetFlag(Page::BLACK_PAGE); | 1266 p->SetFlag(Page::BLACK_PAGE); |
| 1267 if (FLAG_trace_incremental_marking) { | 1267 if (FLAG_trace_incremental_marking) { |
| 1268 PrintIsolate(heap()->isolate(), "Added black page %p\n", p); | 1268 PrintIsolate(heap()->isolate(), "Added black page %p\n", |
| 1269 static_cast<void*>(p)); |
| 1269 } | 1270 } |
| 1270 } | 1271 } |
| 1271 | 1272 |
| 1272 DCHECK(Capacity() <= heap()->MaxOldGenerationSize()); | 1273 DCHECK(Capacity() <= heap()->MaxOldGenerationSize()); |
| 1273 | 1274 |
| 1274 p->InsertAfter(anchor_.prev_page()); | 1275 p->InsertAfter(anchor_.prev_page()); |
| 1275 | 1276 |
| 1276 return true; | 1277 return true; |
| 1277 } | 1278 } |
| 1278 | 1279 |
| (...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2563 } | 2564 } |
| 2564 if (category->next() != nullptr) { | 2565 if (category->next() != nullptr) { |
| 2565 category->next()->set_prev(category->prev()); | 2566 category->next()->set_prev(category->prev()); |
| 2566 } | 2567 } |
| 2567 category->set_next(nullptr); | 2568 category->set_next(nullptr); |
| 2568 category->set_prev(nullptr); | 2569 category->set_prev(nullptr); |
| 2569 } | 2570 } |
| 2570 | 2571 |
| 2571 void FreeList::PrintCategories(FreeListCategoryType type) { | 2572 void FreeList::PrintCategories(FreeListCategoryType type) { |
| 2572 FreeListCategoryIterator it(this, type); | 2573 FreeListCategoryIterator it(this, type); |
| 2573 PrintF("FreeList[%p, top=%p, %d] ", this, categories_[type], type); | 2574 PrintF("FreeList[%p, top=%p, %d] ", static_cast<void*>(this), |
| 2575 static_cast<void*>(categories_[type]), type); |
| 2574 while (it.HasNext()) { | 2576 while (it.HasNext()) { |
| 2575 FreeListCategory* current = it.Next(); | 2577 FreeListCategory* current = it.Next(); |
| 2576 PrintF("%p -> ", current); | 2578 PrintF("%p -> ", static_cast<void*>(current)); |
| 2577 } | 2579 } |
| 2578 PrintF("null\n"); | 2580 PrintF("null\n"); |
| 2579 } | 2581 } |
| 2580 | 2582 |
| 2581 | 2583 |
| 2582 #ifdef DEBUG | 2584 #ifdef DEBUG |
| 2583 intptr_t FreeListCategory::SumFreeList() { | 2585 intptr_t FreeListCategory::SumFreeList() { |
| 2584 intptr_t sum = 0; | 2586 intptr_t sum = 0; |
| 2585 FreeSpace* cur = top(); | 2587 FreeSpace* cur = top(); |
| 2586 while (cur != NULL) { | 2588 while (cur != NULL) { |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3211 if (obj->IsAbstractCode()) { | 3213 if (obj->IsAbstractCode()) { |
| 3212 AbstractCode* code = AbstractCode::cast(obj); | 3214 AbstractCode* code = AbstractCode::cast(obj); |
| 3213 isolate->code_kind_statistics()[code->kind()] += code->Size(); | 3215 isolate->code_kind_statistics()[code->kind()] += code->Size(); |
| 3214 } | 3216 } |
| 3215 } | 3217 } |
| 3216 } | 3218 } |
| 3217 | 3219 |
| 3218 | 3220 |
| 3219 void Page::Print() { | 3221 void Page::Print() { |
| 3220 // Make a best-effort to print the objects in the page. | 3222 // Make a best-effort to print the objects in the page. |
| 3221 PrintF("Page@%p in %s\n", this->address(), | 3223 PrintF("Page@%p in %s\n", static_cast<void*>(this->address()), |
| 3222 AllocationSpaceName(this->owner()->identity())); | 3224 AllocationSpaceName(this->owner()->identity())); |
| 3223 printf(" --------------------------------------\n"); | 3225 printf(" --------------------------------------\n"); |
| 3224 HeapObjectIterator objects(this); | 3226 HeapObjectIterator objects(this); |
| 3225 unsigned mark_size = 0; | 3227 unsigned mark_size = 0; |
| 3226 for (HeapObject* object = objects.Next(); object != NULL; | 3228 for (HeapObject* object = objects.Next(); object != NULL; |
| 3227 object = objects.Next()) { | 3229 object = objects.Next()) { |
| 3228 bool is_marked = Marking::IsBlackOrGrey(Marking::MarkBitFrom(object)); | 3230 bool is_marked = Marking::IsBlackOrGrey(Marking::MarkBitFrom(object)); |
| 3229 PrintF(" %c ", (is_marked ? '!' : ' ')); // Indent a little. | 3231 PrintF(" %c ", (is_marked ? '!' : ' ')); // Indent a little. |
| 3230 if (is_marked) { | 3232 if (is_marked) { |
| 3231 mark_size += object->Size(); | 3233 mark_size += object->Size(); |
| 3232 } | 3234 } |
| 3233 object->ShortPrint(); | 3235 object->ShortPrint(); |
| 3234 PrintF("\n"); | 3236 PrintF("\n"); |
| 3235 } | 3237 } |
| 3236 printf(" --------------------------------------\n"); | 3238 printf(" --------------------------------------\n"); |
| 3237 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3239 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
| 3238 } | 3240 } |
| 3239 | 3241 |
| 3240 #endif // DEBUG | 3242 #endif // DEBUG |
| 3241 } // namespace internal | 3243 } // namespace internal |
| 3242 } // namespace v8 | 3244 } // namespace v8 |
| OLD | NEW |