OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
642 void MemoryAllocator::ReportStatistics() { | 642 void MemoryAllocator::ReportStatistics() { |
643 float pct = static_cast<float>(capacity_ - size_) / capacity_; | 643 float pct = static_cast<float>(capacity_ - size_) / capacity_; |
644 PrintF(" capacity: %" V8_PTR_PREFIX "d" | 644 PrintF(" capacity: %" V8_PTR_PREFIX "d" |
645 ", used: %" V8_PTR_PREFIX "d" | 645 ", used: %" V8_PTR_PREFIX "d" |
646 ", available: %%%d\n\n", | 646 ", available: %%%d\n\n", |
647 capacity_, size_, static_cast<int>(pct*100)); | 647 capacity_, size_, static_cast<int>(pct*100)); |
648 } | 648 } |
649 #endif | 649 #endif |
650 | 650 |
651 // ----------------------------------------------------------------------------- | 651 // ----------------------------------------------------------------------------- |
652 // MemoryChunk implementation | |
653 | |
654 void MemoryChunk::IncrementLiveBytesFromMutator(Address address, int by) { | |
655 MemoryChunk* chunk = MemoryChunk::FromAddress(address); | |
656 if (!chunk->InNewSpace()) { | |
Michael Starzinger
2012/01/18 09:12:18
We need an additional check here to make sure that
Vyacheslav Egorov (Chromium)
2012/01/18 09:22:49
Yeah, thanks for catching it. Somehow I lost this
| |
657 static_cast<PagedSpace*>(chunk->owner())->IncrementUnsweptFreeBytes(-by); | |
658 } | |
659 chunk->IncrementLiveBytes(by); | |
660 } | |
661 | |
662 // ----------------------------------------------------------------------------- | |
652 // PagedSpace implementation | 663 // PagedSpace implementation |
653 | 664 |
654 PagedSpace::PagedSpace(Heap* heap, | 665 PagedSpace::PagedSpace(Heap* heap, |
655 intptr_t max_capacity, | 666 intptr_t max_capacity, |
656 AllocationSpace id, | 667 AllocationSpace id, |
657 Executability executable) | 668 Executability executable) |
658 : Space(heap, id, executable), | 669 : Space(heap, id, executable), |
659 free_list_(this), | 670 free_list_(this), |
660 was_swept_conservatively_(false), | 671 was_swept_conservatively_(false), |
661 first_unswept_page_(Page::FromAddress(NULL)), | 672 first_unswept_page_(Page::FromAddress(NULL)), |
(...skipping 1846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2508 LargePage* previous = NULL; | 2519 LargePage* previous = NULL; |
2509 LargePage* current = first_page_; | 2520 LargePage* current = first_page_; |
2510 while (current != NULL) { | 2521 while (current != NULL) { |
2511 HeapObject* object = current->GetObject(); | 2522 HeapObject* object = current->GetObject(); |
2512 // Can this large page contain pointers to non-trivial objects. No other | 2523 // Can this large page contain pointers to non-trivial objects. No other |
2513 // pointer object is this big. | 2524 // pointer object is this big. |
2514 bool is_pointer_object = object->IsFixedArray(); | 2525 bool is_pointer_object = object->IsFixedArray(); |
2515 MarkBit mark_bit = Marking::MarkBitFrom(object); | 2526 MarkBit mark_bit = Marking::MarkBitFrom(object); |
2516 if (mark_bit.Get()) { | 2527 if (mark_bit.Get()) { |
2517 mark_bit.Clear(); | 2528 mark_bit.Clear(); |
2518 MemoryChunk::IncrementLiveBytes(object->address(), -object->Size()); | 2529 MemoryChunk::IncrementLiveBytesFromGC(object->address(), -object->Size()); |
2519 previous = current; | 2530 previous = current; |
2520 current = current->next_page(); | 2531 current = current->next_page(); |
2521 } else { | 2532 } else { |
2522 LargePage* page = current; | 2533 LargePage* page = current; |
2523 // Cut the chunk out from the chunk list. | 2534 // Cut the chunk out from the chunk list. |
2524 current = current->next_page(); | 2535 current = current->next_page(); |
2525 if (previous == NULL) { | 2536 if (previous == NULL) { |
2526 first_page_ = current; | 2537 first_page_ = current; |
2527 } else { | 2538 } else { |
2528 previous->set_next_page(current); | 2539 previous->set_next_page(current); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2663 object->ShortPrint(); | 2674 object->ShortPrint(); |
2664 PrintF("\n"); | 2675 PrintF("\n"); |
2665 } | 2676 } |
2666 printf(" --------------------------------------\n"); | 2677 printf(" --------------------------------------\n"); |
2667 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 2678 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
2668 } | 2679 } |
2669 | 2680 |
2670 #endif // DEBUG | 2681 #endif // DEBUG |
2671 | 2682 |
2672 } } // namespace v8::internal | 2683 } } // namespace v8::internal |
OLD | NEW |