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 presweep = true; | |
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3838 space->SetPagesToSweep(p->next_page()); | 3839 space->SetPagesToSweep(p->next_page()); |
3839 lazy_sweeping_active = true; | 3840 lazy_sweeping_active = true; |
3840 break; | 3841 break; |
3841 } | 3842 } |
3842 case CONCURRENT_CONSERVATIVE: | 3843 case CONCURRENT_CONSERVATIVE: |
3843 case PARALLEL_CONSERVATIVE: { | 3844 case PARALLEL_CONSERVATIVE: { |
3844 if (FLAG_gc_verbose) { | 3845 if (FLAG_gc_verbose) { |
3845 PrintF("Sweeping 0x%" V8PRIxPTR " conservatively in parallel.\n", | 3846 PrintF("Sweeping 0x%" V8PRIxPTR " conservatively in parallel.\n", |
3846 reinterpret_cast<intptr_t>(p)); | 3847 reinterpret_cast<intptr_t>(p)); |
3847 } | 3848 } |
3848 p->set_parallel_sweeping(1); | 3849 if (presweep) { |
Michael Starzinger
2013/03/05 15:35:20
Can we use a "parallel_sweeping_flag" instead, to
Hannes Payer (out of office)
2013/03/05 17:22:48
Done.
| |
3849 space->IncreaseUnsweptFreeBytes(p); | 3850 SweepConservatively<SWEEP_SEQUENTIALLY>(space, NULL, p); |
3851 pages_swept++; | |
3852 presweep = false; | |
3853 } else { | |
3854 p->set_parallel_sweeping(1); | |
3855 space->IncreaseUnsweptFreeBytes(p); | |
3856 } | |
3850 break; | 3857 break; |
3851 } | 3858 } |
3852 case PRECISE: { | 3859 case PRECISE: { |
3853 if (FLAG_gc_verbose) { | 3860 if (FLAG_gc_verbose) { |
3854 PrintF("Sweeping 0x%" V8PRIxPTR " precisely.\n", | 3861 PrintF("Sweeping 0x%" V8PRIxPTR " precisely.\n", |
3855 reinterpret_cast<intptr_t>(p)); | 3862 reinterpret_cast<intptr_t>(p)); |
3856 } | 3863 } |
3857 if (space->identity() == CODE_SPACE) { | 3864 if (space->identity() == CODE_SPACE) { |
3858 SweepPrecisely<SWEEP_ONLY, REBUILD_SKIP_LIST>(space, p, NULL); | 3865 SweepPrecisely<SWEEP_ONLY, REBUILD_SKIP_LIST>(space, p, NULL); |
3859 } else { | 3866 } else { |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4120 while (buffer != NULL) { | 4127 while (buffer != NULL) { |
4121 SlotsBuffer* next_buffer = buffer->next(); | 4128 SlotsBuffer* next_buffer = buffer->next(); |
4122 DeallocateBuffer(buffer); | 4129 DeallocateBuffer(buffer); |
4123 buffer = next_buffer; | 4130 buffer = next_buffer; |
4124 } | 4131 } |
4125 *buffer_address = NULL; | 4132 *buffer_address = NULL; |
4126 } | 4133 } |
4127 | 4134 |
4128 | 4135 |
4129 } } // namespace v8::internal | 4136 } } // namespace v8::internal |
OLD | NEW |