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