Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: src/mark-compact.cc

Issue 12444003: Presweep one page before parallel/concurrent sweeping. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3752 matching lines...) Expand 10 before | Expand all | Expand 10 after
3763 3763
3764 void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) { 3764 void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) {
3765 space->set_was_swept_conservatively(sweeper == CONSERVATIVE || 3765 space->set_was_swept_conservatively(sweeper == CONSERVATIVE ||
3766 sweeper == LAZY_CONSERVATIVE || 3766 sweeper == LAZY_CONSERVATIVE ||
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;
3774 int pages_swept = 0; 3773 int pages_swept = 0;
3775 bool lazy_sweeping_active = false; 3774 bool lazy_sweeping_active = false;
3776 bool unused_page_present = false; 3775 bool unused_page_present = false;
3776 bool parallel_sweeping_active = false;
3777 3777
3778 while (it.has_next()) { 3778 while (it.has_next()) {
3779 Page* p = it.next(); 3779 Page* p = it.next();
3780 3780
3781 ASSERT(p->parallel_sweeping() == 0); 3781 ASSERT(p->parallel_sweeping() == 0);
3782 // Clear sweeping flags indicating that marking bits are still intact. 3782 // Clear sweeping flags indicating that marking bits are still intact.
3783 p->ClearSweptPrecisely(); 3783 p->ClearSweptPrecisely();
3784 p->ClearSweptConservatively(); 3784 p->ClearSweptConservatively();
3785 3785
3786 if (p->IsEvacuationCandidate()) { 3786 if (p->IsEvacuationCandidate()) {
(...skipping 15 matching lines...) Expand all
3802 } 3802 }
3803 // Adjust unswept free bytes because releasing a page expects said 3803 // Adjust unswept free bytes because releasing a page expects said
3804 // counter to be accurate for unswept pages. 3804 // counter to be accurate for unswept pages.
3805 space->IncreaseUnsweptFreeBytes(p); 3805 space->IncreaseUnsweptFreeBytes(p);
3806 space->ReleasePage(p); 3806 space->ReleasePage(p);
3807 continue; 3807 continue;
3808 } 3808 }
3809 unused_page_present = true; 3809 unused_page_present = true;
3810 } 3810 }
3811 3811
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) { 3812 switch (sweeper) {
3822 case CONSERVATIVE: { 3813 case CONSERVATIVE: {
3823 if (FLAG_gc_verbose) { 3814 if (FLAG_gc_verbose) {
3824 PrintF("Sweeping 0x%" V8PRIxPTR " conservatively.\n", 3815 PrintF("Sweeping 0x%" V8PRIxPTR " conservatively.\n",
3825 reinterpret_cast<intptr_t>(p)); 3816 reinterpret_cast<intptr_t>(p));
3826 } 3817 }
3827 SweepConservatively<SWEEP_SEQUENTIALLY>(space, NULL, p); 3818 SweepConservatively<SWEEP_SEQUENTIALLY>(space, NULL, p);
3828 pages_swept++; 3819 pages_swept++;
3829 break; 3820 break;
3830 } 3821 }
3831 case LAZY_CONSERVATIVE: { 3822 case LAZY_CONSERVATIVE: {
3832 if (FLAG_gc_verbose) { 3823 if (lazy_sweeping_active) {
3833 PrintF("Sweeping 0x%" V8PRIxPTR " conservatively as needed.\n", 3824 if (FLAG_gc_verbose) {
3834 reinterpret_cast<intptr_t>(p)); 3825 PrintF("Sweeping 0x%" V8PRIxPTR " lazily postponed.\n",
3826 reinterpret_cast<intptr_t>(p));
3827 }
3828 space->IncreaseUnsweptFreeBytes(p);
3829 } else {
3830 if (FLAG_gc_verbose) {
3831 PrintF("Sweeping 0x%" V8PRIxPTR " conservatively.\n",
3832 reinterpret_cast<intptr_t>(p));
3833 }
3834 SweepConservatively<SWEEP_SEQUENTIALLY>(space, NULL, p);
3835 pages_swept++;
3836 space->SetPagesToSweep(p->next_page());
3837 lazy_sweeping_active = true;
3835 } 3838 }
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; 3839 break;
3841 } 3840 }
3842 case CONCURRENT_CONSERVATIVE: 3841 case CONCURRENT_CONSERVATIVE:
3843 case PARALLEL_CONSERVATIVE: { 3842 case PARALLEL_CONSERVATIVE: {
3844 if (FLAG_gc_verbose) { 3843 if (!parallel_sweeping_active) {
3845 PrintF("Sweeping 0x%" V8PRIxPTR " conservatively in parallel.\n", 3844 if (FLAG_gc_verbose) {
3846 reinterpret_cast<intptr_t>(p)); 3845 PrintF("Sweeping 0x%" V8PRIxPTR " conservatively.\n",
3846 reinterpret_cast<intptr_t>(p));
3847 }
3848 SweepConservatively<SWEEP_SEQUENTIALLY>(space, NULL, p);
3849 pages_swept++;
3850 parallel_sweeping_active = true;
3851 } else {
3852 if (FLAG_gc_verbose) {
3853 PrintF("Sweeping 0x%" V8PRIxPTR " conservatively in parallel.\n",
3854 reinterpret_cast<intptr_t>(p));
3855 }
3856 p->set_parallel_sweeping(1);
3857 space->IncreaseUnsweptFreeBytes(p);
3847 } 3858 }
3848 p->set_parallel_sweeping(1);
3849 space->IncreaseUnsweptFreeBytes(p);
3850 break; 3859 break;
3851 } 3860 }
3852 case PRECISE: { 3861 case PRECISE: {
3853 if (FLAG_gc_verbose) { 3862 if (FLAG_gc_verbose) {
3854 PrintF("Sweeping 0x%" V8PRIxPTR " precisely.\n", 3863 PrintF("Sweeping 0x%" V8PRIxPTR " precisely.\n",
3855 reinterpret_cast<intptr_t>(p)); 3864 reinterpret_cast<intptr_t>(p));
3856 } 3865 }
3857 if (space->identity() == CODE_SPACE) { 3866 if (space->identity() == CODE_SPACE) {
3858 SweepPrecisely<SWEEP_ONLY, REBUILD_SKIP_LIST>(space, p, NULL); 3867 SweepPrecisely<SWEEP_ONLY, REBUILD_SKIP_LIST>(space, p, NULL);
3859 } else { 3868 } else {
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
4120 while (buffer != NULL) { 4129 while (buffer != NULL) {
4121 SlotsBuffer* next_buffer = buffer->next(); 4130 SlotsBuffer* next_buffer = buffer->next();
4122 DeallocateBuffer(buffer); 4131 DeallocateBuffer(buffer);
4123 buffer = next_buffer; 4132 buffer = next_buffer;
4124 } 4133 }
4125 *buffer_address = NULL; 4134 *buffer_address = NULL;
4126 } 4135 }
4127 4136
4128 4137
4129 } } // namespace v8::internal 4138 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698