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 3756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3767 sweeper == PARALLEL_CONSERVATIVE || | 3767 sweeper == PARALLEL_CONSERVATIVE || |
3768 sweeper == CONCURRENT_CONSERVATIVE); | 3768 sweeper == CONCURRENT_CONSERVATIVE); |
3769 space->ClearStats(); | 3769 space->ClearStats(); |
3770 | 3770 |
3771 PageIterator it(space); | 3771 PageIterator it(space); |
3772 | 3772 |
3773 intptr_t freed_bytes = 0; | 3773 intptr_t freed_bytes = 0; |
3774 int pages_swept = 0; | 3774 int pages_swept = 0; |
3775 bool lazy_sweeping_active = false; | 3775 bool lazy_sweeping_active = false; |
3776 bool unused_page_present = false; | 3776 bool unused_page_present = false; |
3777 bool parallel_sweeping_active = false; | |
3777 | 3778 |
3778 while (it.has_next()) { | 3779 while (it.has_next()) { |
3779 Page* p = it.next(); | 3780 Page* p = it.next(); |
3780 | 3781 |
3781 ASSERT(p->parallel_sweeping() == 0); | 3782 ASSERT(p->parallel_sweeping() == 0); |
3782 // Clear sweeping flags indicating that marking bits are still intact. | 3783 // Clear sweeping flags indicating that marking bits are still intact. |
3783 p->ClearSweptPrecisely(); | 3784 p->ClearSweptPrecisely(); |
3784 p->ClearSweptConservatively(); | 3785 p->ClearSweptConservatively(); |
3785 | 3786 |
3786 if (p->IsEvacuationCandidate()) { | 3787 if (p->IsEvacuationCandidate()) { |
(...skipping 15 matching lines...) Expand all Loading... | |
3802 } | 3803 } |
3803 // Adjust unswept free bytes because releasing a page expects said | 3804 // Adjust unswept free bytes because releasing a page expects said |
3804 // counter to be accurate for unswept pages. | 3805 // counter to be accurate for unswept pages. |
3805 space->IncreaseUnsweptFreeBytes(p); | 3806 space->IncreaseUnsweptFreeBytes(p); |
3806 space->ReleasePage(p); | 3807 space->ReleasePage(p); |
3807 continue; | 3808 continue; |
3808 } | 3809 } |
3809 unused_page_present = true; | 3810 unused_page_present = true; |
3810 } | 3811 } |
3811 | 3812 |
3812 if (lazy_sweeping_active) { | |
3813 if (FLAG_gc_verbose) { | |
3814 PrintF("Sweeping 0x%" V8PRIxPTR " lazily postponed.\n", | |
3815 reinterpret_cast<intptr_t>(p)); | |
3816 } | |
3817 space->IncreaseUnsweptFreeBytes(p); | |
3818 continue; | |
3819 } | |
3820 | |
3821 switch (sweeper) { | 3813 switch (sweeper) { |
3822 case CONSERVATIVE: { | 3814 case CONSERVATIVE: { |
3823 if (FLAG_gc_verbose) { | 3815 if (FLAG_gc_verbose) { |
3824 PrintF("Sweeping 0x%" V8PRIxPTR " conservatively.\n", | 3816 PrintF("Sweeping 0x%" V8PRIxPTR " conservatively.\n", |
3825 reinterpret_cast<intptr_t>(p)); | 3817 reinterpret_cast<intptr_t>(p)); |
3826 } | 3818 } |
3827 SweepConservatively<SWEEP_SEQUENTIALLY>(space, NULL, p); | 3819 SweepConservatively<SWEEP_SEQUENTIALLY>(space, NULL, p); |
3828 pages_swept++; | 3820 pages_swept++; |
3829 break; | 3821 break; |
3830 } | 3822 } |
3831 case LAZY_CONSERVATIVE: { | 3823 case LAZY_CONSERVATIVE: { |
3832 if (FLAG_gc_verbose) { | 3824 if (lazy_sweeping_active) { |
3833 PrintF("Sweeping 0x%" V8PRIxPTR " conservatively as needed.\n", | 3825 if (FLAG_gc_verbose) { |
3834 reinterpret_cast<intptr_t>(p)); | 3826 PrintF("Sweeping 0x%" V8PRIxPTR " lazily postponed.\n", |
3827 reinterpret_cast<intptr_t>(p)); | |
3828 } | |
3829 space->IncreaseUnsweptFreeBytes(p); | |
3830 } else { | |
3831 if (FLAG_gc_verbose) { | |
3832 PrintF("Sweeping 0x%" V8PRIxPTR " conservatively.\n", | |
3833 reinterpret_cast<intptr_t>(p)); | |
3834 } | |
3835 freed_bytes += SweepConservatively<SWEEP_SEQUENTIALLY>(space, NULL, p) ; | |
Michael Starzinger
2013/03/05 17:46:33
Longer than 80 characters. Also the free_bytes cou
Hannes Payer (out of office)
2013/03/05 17:48:38
Already done.
| |
3836 pages_swept++; | |
3837 space->SetPagesToSweep(p->next_page()); | |
3838 lazy_sweeping_active = true; | |
3835 } | 3839 } |
3836 freed_bytes += SweepConservatively<SWEEP_SEQUENTIALLY>(space, NULL, p); | |
3837 pages_swept++; | |
3838 space->SetPagesToSweep(p->next_page()); | |
3839 lazy_sweeping_active = true; | |
3840 break; | 3840 break; |
3841 } | 3841 } |
3842 case CONCURRENT_CONSERVATIVE: | 3842 case CONCURRENT_CONSERVATIVE: |
3843 case PARALLEL_CONSERVATIVE: { | 3843 case PARALLEL_CONSERVATIVE: { |
3844 if (FLAG_gc_verbose) { | 3844 if (!parallel_sweeping_active) { |
3845 PrintF("Sweeping 0x%" V8PRIxPTR " conservatively in parallel.\n", | 3845 if (FLAG_gc_verbose) { |
3846 reinterpret_cast<intptr_t>(p)); | 3846 PrintF("Sweeping 0x%" V8PRIxPTR " conservatively.\n", |
3847 reinterpret_cast<intptr_t>(p)); | |
3848 } | |
3849 SweepConservatively<SWEEP_SEQUENTIALLY>(space, NULL, p); | |
3850 pages_swept++; | |
3851 parallel_sweeping_active = true; | |
3852 } else { | |
3853 if (FLAG_gc_verbose) { | |
3854 PrintF("Sweeping 0x%" V8PRIxPTR " conservatively in parallel.\n", | |
3855 reinterpret_cast<intptr_t>(p)); | |
3856 } | |
3857 p->set_parallel_sweeping(1); | |
3858 space->IncreaseUnsweptFreeBytes(p); | |
3847 } | 3859 } |
3848 p->set_parallel_sweeping(1); | |
3849 space->IncreaseUnsweptFreeBytes(p); | |
3850 break; | 3860 break; |
3851 } | 3861 } |
3852 case PRECISE: { | 3862 case PRECISE: { |
3853 if (FLAG_gc_verbose) { | 3863 if (FLAG_gc_verbose) { |
3854 PrintF("Sweeping 0x%" V8PRIxPTR " precisely.\n", | 3864 PrintF("Sweeping 0x%" V8PRIxPTR " precisely.\n", |
3855 reinterpret_cast<intptr_t>(p)); | 3865 reinterpret_cast<intptr_t>(p)); |
3856 } | 3866 } |
3857 if (space->identity() == CODE_SPACE) { | 3867 if (space->identity() == CODE_SPACE) { |
3858 SweepPrecisely<SWEEP_ONLY, REBUILD_SKIP_LIST>(space, p, NULL); | 3868 SweepPrecisely<SWEEP_ONLY, REBUILD_SKIP_LIST>(space, p, NULL); |
3859 } else { | 3869 } else { |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4120 while (buffer != NULL) { | 4130 while (buffer != NULL) { |
4121 SlotsBuffer* next_buffer = buffer->next(); | 4131 SlotsBuffer* next_buffer = buffer->next(); |
4122 DeallocateBuffer(buffer); | 4132 DeallocateBuffer(buffer); |
4123 buffer = next_buffer; | 4133 buffer = next_buffer; |
4124 } | 4134 } |
4125 *buffer_address = NULL; | 4135 *buffer_address = NULL; |
4126 } | 4136 } |
4127 | 4137 |
4128 | 4138 |
4129 } } // namespace v8::internal | 4139 } } // namespace v8::internal |
OLD | NEW |