OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 if (!p->WasSwept()) { | 665 if (!p->WasSwept()) { |
666 if (FLAG_trace_fragmentation) { | 666 if (FLAG_trace_fragmentation) { |
667 PrintF("%p [%s]: %d bytes live (unswept)\n", | 667 PrintF("%p [%s]: %d bytes live (unswept)\n", |
668 reinterpret_cast<void*>(p), | 668 reinterpret_cast<void*>(p), |
669 AllocationSpaceName(space->identity()), | 669 AllocationSpaceName(space->identity()), |
670 p->LiveBytes()); | 670 p->LiveBytes()); |
671 } | 671 } |
672 return 0; | 672 return 0; |
673 } | 673 } |
674 | 674 |
675 FreeList::SizeStats sizes; | 675 PagedSpace::SizeStats sizes; |
676 space->CountFreeListItems(p, &sizes); | 676 space->ObtainFreeListStatistics(p, &sizes); |
677 | 677 |
678 intptr_t ratio; | 678 intptr_t ratio; |
679 intptr_t ratio_threshold; | 679 intptr_t ratio_threshold; |
680 intptr_t area_size = space->AreaSize(); | 680 intptr_t area_size = space->AreaSize(); |
681 if (space->identity() == CODE_SPACE) { | 681 if (space->identity() == CODE_SPACE) { |
682 ratio = (sizes.medium_size_ * 10 + sizes.large_size_ * 2) * 100 / | 682 ratio = (sizes.medium_size_ * 10 + sizes.large_size_ * 2) * 100 / |
683 area_size; | 683 area_size; |
684 ratio_threshold = 10; | 684 ratio_threshold = 10; |
685 } else { | 685 } else { |
686 ratio = (sizes.small_size_ * 5 + sizes.medium_size_) * 100 / | 686 ratio = (sizes.small_size_ * 5 + sizes.medium_size_) * 100 / |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 // Don't try to release too many pages. | 805 // Don't try to release too many pages. |
806 if (estimated_release >= ((over_reserved * 3) / 4)) { | 806 if (estimated_release >= ((over_reserved * 3) / 4)) { |
807 continue; | 807 continue; |
808 } | 808 } |
809 | 809 |
810 intptr_t free_bytes = 0; | 810 intptr_t free_bytes = 0; |
811 | 811 |
812 if (!p->WasSwept()) { | 812 if (!p->WasSwept()) { |
813 free_bytes = (p->area_size() - p->LiveBytes()); | 813 free_bytes = (p->area_size() - p->LiveBytes()); |
814 } else { | 814 } else { |
815 FreeList::SizeStats sizes; | 815 PagedSpace::SizeStats sizes; |
816 space->CountFreeListItems(p, &sizes); | 816 space->ObtainFreeListStatistics(p, &sizes); |
817 free_bytes = sizes.Total(); | 817 free_bytes = sizes.Total(); |
818 } | 818 } |
819 | 819 |
820 int free_pct = static_cast<int>(free_bytes * 100) / p->area_size(); | 820 int free_pct = static_cast<int>(free_bytes * 100) / p->area_size(); |
821 | 821 |
822 if (free_pct >= kFreenessThreshold) { | 822 if (free_pct >= kFreenessThreshold) { |
823 estimated_release += 2 * p->area_size() - free_bytes; | 823 estimated_release += 2 * p->area_size() - free_bytes; |
824 fragmentation = free_pct; | 824 fragmentation = free_pct; |
825 } else { | 825 } else { |
826 fragmentation = 0; | 826 fragmentation = 0; |
(...skipping 3306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4133 while (buffer != NULL) { | 4133 while (buffer != NULL) { |
4134 SlotsBuffer* next_buffer = buffer->next(); | 4134 SlotsBuffer* next_buffer = buffer->next(); |
4135 DeallocateBuffer(buffer); | 4135 DeallocateBuffer(buffer); |
4136 buffer = next_buffer; | 4136 buffer = next_buffer; |
4137 } | 4137 } |
4138 *buffer_address = NULL; | 4138 *buffer_address = NULL; |
4139 } | 4139 } |
4140 | 4140 |
4141 | 4141 |
4142 } } // namespace v8::internal | 4142 } } // namespace v8::internal |
OLD | NEW |