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

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

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

Powered by Google App Engine
This is Rietveld 408576698