Commit 395db159 authored by hpayer@chromium.org's avatar hpayer@chromium.org

Remove eager sweeping for lazy swept spaces. Try to find in SlowAllocateRaw a...

Remove eager sweeping for lazy swept spaces. Try to find in SlowAllocateRaw a bounded number of times a big enough memory slot.

BUG=v8:2194

Review URL: https://codereview.chromium.org/11420036

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13058 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 569b9c4c
......@@ -3525,7 +3525,6 @@ void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) {
intptr_t freed_bytes = 0;
int pages_swept = 0;
intptr_t newspace_size = space->heap()->new_space()->Size();
bool lazy_sweeping_active = false;
bool unused_page_present = false;
......@@ -3588,15 +3587,8 @@ void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) {
}
freed_bytes += SweepConservatively(space, p);
pages_swept++;
if (freed_bytes > 2 * newspace_size) {
space->SetPagesToSweep(p->next_page());
lazy_sweeping_active = true;
} else {
if (FLAG_gc_verbose) {
PrintF("Only %" V8PRIdPTR " bytes freed. Still sweeping.\n",
freed_bytes);
}
}
space->SetPagesToSweep(p->next_page());
lazy_sweeping_active = true;
break;
}
case PRECISE: {
......
......@@ -2391,10 +2391,13 @@ void PagedSpace::EvictEvacuationCandidatesFromFreeLists() {
HeapObject* PagedSpace::SlowAllocateRaw(int size_in_bytes) {
// Allocation in this space has failed.
// If there are unswept pages advance lazy sweeper then sweep one page before
// allocating a new page.
if (first_unswept_page_->is_valid()) {
AdvanceSweeper(size_in_bytes);
// If there are unswept pages advance lazy sweeper a bounded number of times
// until we find a size_in_bytes contiguous piece of memory
const int kMaxSweepingTries = 5;
bool sweeping_complete = false;
for (int i = 0; i < kMaxSweepingTries && !sweeping_complete; i++) {
sweeping_complete = AdvanceSweeper(size_in_bytes);
// Retry the free list allocation.
HeapObject* object = free_list_.Allocate(size_in_bytes);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment