Commit 1d8c83e7 authored by hpayer@chromium.org's avatar hpayer@chromium.org

Enable concurrent sweeping. Added some extra debugging checks for concurrent sweeping.

BUG=
R=titzer@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18722 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ae65c838
......@@ -529,8 +529,8 @@ DEFINE_bool(trace_incremental_marking, false,
"trace progress of the incremental marking")
DEFINE_bool(track_gc_object_stats, false,
"track object counts and memory usage")
DEFINE_bool(parallel_sweeping, true, "enable parallel sweeping")
DEFINE_bool(concurrent_sweeping, false, "enable concurrent sweeping")
DEFINE_bool(parallel_sweeping, false, "enable parallel sweeping")
DEFINE_bool(concurrent_sweeping, true, "enable concurrent sweeping")
DEFINE_int(sweeper_threads, 0,
"number of parallel and concurrent sweeping threads")
#ifdef VERIFY_HEAP
......
......@@ -570,6 +570,11 @@ void MarkCompactCollector::ClearMarkbits() {
void MarkCompactCollector::StartSweeperThreads() {
// TODO(hpayer): This check is just used for debugging purpose and
// should be removed or turned into an assert after investigating the
// crash in concurrent sweeping.
CHECK(free_list_old_pointer_space_.get()->IsEmpty());
CHECK(free_list_old_data_space_.get()->IsEmpty());
sweeping_pending_ = true;
for (int i = 0; i < isolate()->num_sweeper_threads(); i++) {
isolate()->sweeper_threads()[i]->StartSweeping();
......@@ -3068,8 +3073,12 @@ void MarkCompactCollector::EvacuatePages() {
int npages = evacuation_candidates_.length();
for (int i = 0; i < npages; i++) {
Page* p = evacuation_candidates_[i];
ASSERT(p->IsEvacuationCandidate() ||
p->IsFlagSet(Page::RESCAN_ON_EVACUATION));
// TODO(hpayer): This check is just used for debugging purpose and
// should be removed or turned into an assert after investigating the
// crash in concurrent sweeping.
CHECK(p->IsEvacuationCandidate() ||
p->IsFlagSet(Page::RESCAN_ON_EVACUATION));
CHECK_EQ(p->parallel_sweeping(), 0);
if (p->IsEvacuationCandidate()) {
// During compaction we might have to request a new page.
// Check that space still have room for that.
......@@ -3900,7 +3909,10 @@ template<MarkCompactCollector::SweepingParallelism mode>
intptr_t MarkCompactCollector::SweepConservatively(PagedSpace* space,
FreeList* free_list,
Page* p) {
ASSERT(!p->IsEvacuationCandidate() && !p->WasSwept());
// TODO(hpayer): This check is just used for debugging purpose and
// should be removed or turned into an assert after investigating the
// crash in concurrent sweeping.
CHECK(!p->IsEvacuationCandidate() && !p->WasSwept());
ASSERT((mode == MarkCompactCollector::SWEEP_IN_PARALLEL &&
free_list != NULL) ||
(mode == MarkCompactCollector::SWEEP_SEQUENTIALLY &&
......
......@@ -1142,6 +1142,11 @@ void PagedSpace::ReleasePage(Page* page, bool unlink) {
DecreaseUnsweptFreeBytes(page);
}
// TODO(hpayer): This check is just used for debugging purpose and
// should be removed or turned into an assert after investigating the
// crash in concurrent sweeping.
CHECK(!free_list_.ContainsPageFreeListItems(page));
if (Page::FromAllocationTop(allocation_info_.top()) == page) {
allocation_info_.set_top(NULL);
allocation_info_.set_limit(NULL);
......@@ -2125,6 +2130,16 @@ intptr_t FreeListCategory::EvictFreeListItemsInList(Page* p) {
}
bool FreeListCategory::ContainsPageFreeListItemsInList(Page* p) {
FreeListNode** n = &top_;
while (*n != NULL) {
if (Page::FromAddress((*n)->address()) == p) return true;
n = (*n)->next_address();
}
return false;
}
FreeListNode* FreeListCategory::PickNodeFromList(int *node_size) {
FreeListNode* node = top_;
......@@ -2452,6 +2467,14 @@ intptr_t FreeList::EvictFreeListItems(Page* p) {
}
bool FreeList::ContainsPageFreeListItems(Page* p) {
return huge_list_.EvictFreeListItemsInList(p) ||
small_list_.EvictFreeListItemsInList(p) ||
medium_list_.EvictFreeListItemsInList(p) ||
large_list_.EvictFreeListItemsInList(p);
}
void FreeList::RepairLists(Heap* heap) {
small_list_.RepairFreeList(heap);
medium_list_.RepairFreeList(heap);
......
......@@ -1521,6 +1521,7 @@ class FreeListCategory {
FreeListNode* PickNodeFromList(int size_in_bytes, int *node_size);
intptr_t EvictFreeListItemsInList(Page* p);
bool ContainsPageFreeListItemsInList(Page* p);
void RepairFreeList(Heap* heap);
......@@ -1538,6 +1539,10 @@ class FreeListCategory {
Mutex* mutex() { return &mutex_; }
bool IsEmpty() {
return top_ == NULL;
}
#ifdef DEBUG
intptr_t SumFreeList();
int FreeListLength();
......@@ -1605,6 +1610,11 @@ class FreeList {
// 'wasted_bytes'. The size should be a non-zero multiple of the word size.
MUST_USE_RESULT HeapObject* Allocate(int size_in_bytes);
bool IsEmpty() {
return small_list_.IsEmpty() && medium_list_.IsEmpty() &&
large_list_.IsEmpty() && huge_list_.IsEmpty();
}
#ifdef DEBUG
void Zap();
intptr_t SumFreeLists();
......@@ -1615,6 +1625,7 @@ class FreeList {
void RepairLists(Heap* heap);
intptr_t EvictFreeListItems(Page* p);
bool ContainsPageFreeListItems(Page* p);
FreeListCategory* small_list() { return &small_list_; }
FreeListCategory* medium_list() { return &medium_list_; }
......
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