Commit 80382cdb authored by hpayer@chromium.org's avatar hpayer@chromium.org

Presweep one page before parallel/concurrent sweeping.

BUG=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13832 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 34697f5b
...@@ -3761,10 +3761,10 @@ void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) { ...@@ -3761,10 +3761,10 @@ void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) {
PageIterator it(space); PageIterator it(space);
intptr_t freed_bytes = 0;
int pages_swept = 0; int pages_swept = 0;
bool lazy_sweeping_active = false; bool lazy_sweeping_active = false;
bool unused_page_present = false; bool unused_page_present = false;
bool parallel_sweeping_active = false;
while (it.has_next()) { while (it.has_next()) {
Page* p = it.next(); Page* p = it.next();
...@@ -3800,15 +3800,6 @@ void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) { ...@@ -3800,15 +3800,6 @@ void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) {
unused_page_present = true; unused_page_present = true;
} }
if (lazy_sweeping_active) {
if (FLAG_gc_verbose) {
PrintF("Sweeping 0x%" V8PRIxPTR " lazily postponed.\n",
reinterpret_cast<intptr_t>(p));
}
space->IncreaseUnsweptFreeBytes(p);
continue;
}
switch (sweeper) { switch (sweeper) {
case CONSERVATIVE: { case CONSERVATIVE: {
if (FLAG_gc_verbose) { if (FLAG_gc_verbose) {
...@@ -3820,24 +3811,42 @@ void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) { ...@@ -3820,24 +3811,42 @@ void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) {
break; break;
} }
case LAZY_CONSERVATIVE: { case LAZY_CONSERVATIVE: {
if (lazy_sweeping_active) {
if (FLAG_gc_verbose) {
PrintF("Sweeping 0x%" V8PRIxPTR " lazily postponed.\n",
reinterpret_cast<intptr_t>(p));
}
space->IncreaseUnsweptFreeBytes(p);
} else {
if (FLAG_gc_verbose) { if (FLAG_gc_verbose) {
PrintF("Sweeping 0x%" V8PRIxPTR " conservatively as needed.\n", PrintF("Sweeping 0x%" V8PRIxPTR " conservatively.\n",
reinterpret_cast<intptr_t>(p)); reinterpret_cast<intptr_t>(p));
} }
freed_bytes += SweepConservatively<SWEEP_SEQUENTIALLY>(space, NULL, p); SweepConservatively<SWEEP_SEQUENTIALLY>(space, NULL, p);
pages_swept++; pages_swept++;
space->SetPagesToSweep(p->next_page()); space->SetPagesToSweep(p->next_page());
lazy_sweeping_active = true; lazy_sweeping_active = true;
}
break; break;
} }
case CONCURRENT_CONSERVATIVE: case CONCURRENT_CONSERVATIVE:
case PARALLEL_CONSERVATIVE: { case PARALLEL_CONSERVATIVE: {
if (!parallel_sweeping_active) {
if (FLAG_gc_verbose) {
PrintF("Sweeping 0x%" V8PRIxPTR " conservatively.\n",
reinterpret_cast<intptr_t>(p));
}
SweepConservatively<SWEEP_SEQUENTIALLY>(space, NULL, p);
pages_swept++;
parallel_sweeping_active = true;
} else {
if (FLAG_gc_verbose) { if (FLAG_gc_verbose) {
PrintF("Sweeping 0x%" V8PRIxPTR " conservatively in parallel.\n", PrintF("Sweeping 0x%" V8PRIxPTR " conservatively in parallel.\n",
reinterpret_cast<intptr_t>(p)); reinterpret_cast<intptr_t>(p));
} }
p->set_parallel_sweeping(1); p->set_parallel_sweeping(1);
space->IncreaseUnsweptFreeBytes(p); space->IncreaseUnsweptFreeBytes(p);
}
break; break;
} }
case PRECISE: { case PRECISE: {
......
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