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

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

Issue 11413009: Remove eager sweeping for lazy swept spaces. Try to find in SlowAllocateRaw a bounded number of tim… (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 8 years, 1 month 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 | src/spaces.cc » ('j') | src/spaces.cc » ('J')
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 3506 matching lines...) Expand 10 before | Expand all | Expand 10 after
3517 void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) { 3517 void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) {
3518 space->set_was_swept_conservatively(sweeper == CONSERVATIVE || 3518 space->set_was_swept_conservatively(sweeper == CONSERVATIVE ||
3519 sweeper == LAZY_CONSERVATIVE); 3519 sweeper == LAZY_CONSERVATIVE);
3520 3520
3521 space->ClearStats(); 3521 space->ClearStats();
3522 3522
3523 PageIterator it(space); 3523 PageIterator it(space);
3524 3524
3525 intptr_t freed_bytes = 0; 3525 intptr_t freed_bytes = 0;
3526 int pages_swept = 0; 3526 int pages_swept = 0;
3527 intptr_t newspace_size = space->heap()->new_space()->Size();
3528 bool lazy_sweeping_active = false; 3527 bool lazy_sweeping_active = false;
3529 bool unused_page_present = false; 3528 bool unused_page_present = false;
3530 3529
3531 while (it.has_next()) { 3530 while (it.has_next()) {
3532 Page* p = it.next(); 3531 Page* p = it.next();
3533 3532
3534 // Clear sweeping flags indicating that marking bits are still intact. 3533 // Clear sweeping flags indicating that marking bits are still intact.
3535 p->ClearSweptPrecisely(); 3534 p->ClearSweptPrecisely();
3536 p->ClearSweptConservatively(); 3535 p->ClearSweptConservatively();
3537 3536
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
3580 pages_swept++; 3579 pages_swept++;
3581 break; 3580 break;
3582 } 3581 }
3583 case LAZY_CONSERVATIVE: { 3582 case LAZY_CONSERVATIVE: {
3584 if (FLAG_gc_verbose) { 3583 if (FLAG_gc_verbose) {
3585 PrintF("Sweeping 0x%" V8PRIxPTR " conservatively as needed.\n", 3584 PrintF("Sweeping 0x%" V8PRIxPTR " conservatively as needed.\n",
3586 reinterpret_cast<intptr_t>(p)); 3585 reinterpret_cast<intptr_t>(p));
3587 } 3586 }
3588 freed_bytes += SweepConservatively(space, p); 3587 freed_bytes += SweepConservatively(space, p);
3589 pages_swept++; 3588 pages_swept++;
3590 if (freed_bytes > 2 * newspace_size) { 3589 space->SetPagesToSweep(p->next_page());
3591 space->SetPagesToSweep(p->next_page()); 3590 lazy_sweeping_active = true;
3592 lazy_sweeping_active = true;
3593 } else {
3594 if (FLAG_gc_verbose) {
3595 PrintF("Only %" V8PRIdPTR " bytes freed. Still sweeping.\n",
3596 freed_bytes);
3597 }
3598 }
3599 break; 3591 break;
3600 } 3592 }
3601 case PRECISE: { 3593 case PRECISE: {
3602 if (FLAG_gc_verbose) { 3594 if (FLAG_gc_verbose) {
3603 PrintF("Sweeping 0x%" V8PRIxPTR " precisely.\n", 3595 PrintF("Sweeping 0x%" V8PRIxPTR " precisely.\n",
3604 reinterpret_cast<intptr_t>(p)); 3596 reinterpret_cast<intptr_t>(p));
3605 } 3597 }
3606 if (space->identity() == CODE_SPACE) { 3598 if (space->identity() == CODE_SPACE) {
3607 SweepPrecisely<SWEEP_ONLY, REBUILD_SKIP_LIST>(space, p, NULL); 3599 SweepPrecisely<SWEEP_ONLY, REBUILD_SKIP_LIST>(space, p, NULL);
3608 } else { 3600 } else {
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
3852 while (buffer != NULL) { 3844 while (buffer != NULL) {
3853 SlotsBuffer* next_buffer = buffer->next(); 3845 SlotsBuffer* next_buffer = buffer->next();
3854 DeallocateBuffer(buffer); 3846 DeallocateBuffer(buffer);
3855 buffer = next_buffer; 3847 buffer = next_buffer;
3856 } 3848 }
3857 *buffer_address = NULL; 3849 *buffer_address = NULL;
3858 } 3850 }
3859 3851
3860 3852
3861 } } // namespace v8::internal 3853 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/spaces.cc » ('j') | src/spaces.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698