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
This commit is contained in:
parent
ae65c83822
commit
1d8c83e7ab
@ -529,8 +529,8 @@ DEFINE_bool(trace_incremental_marking, false,
|
|||||||
"trace progress of the incremental marking")
|
"trace progress of the incremental marking")
|
||||||
DEFINE_bool(track_gc_object_stats, false,
|
DEFINE_bool(track_gc_object_stats, false,
|
||||||
"track object counts and memory usage")
|
"track object counts and memory usage")
|
||||||
DEFINE_bool(parallel_sweeping, true, "enable parallel sweeping")
|
DEFINE_bool(parallel_sweeping, false, "enable parallel sweeping")
|
||||||
DEFINE_bool(concurrent_sweeping, false, "enable concurrent sweeping")
|
DEFINE_bool(concurrent_sweeping, true, "enable concurrent sweeping")
|
||||||
DEFINE_int(sweeper_threads, 0,
|
DEFINE_int(sweeper_threads, 0,
|
||||||
"number of parallel and concurrent sweeping threads")
|
"number of parallel and concurrent sweeping threads")
|
||||||
#ifdef VERIFY_HEAP
|
#ifdef VERIFY_HEAP
|
||||||
|
@ -570,6 +570,11 @@ void MarkCompactCollector::ClearMarkbits() {
|
|||||||
|
|
||||||
|
|
||||||
void MarkCompactCollector::StartSweeperThreads() {
|
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;
|
sweeping_pending_ = true;
|
||||||
for (int i = 0; i < isolate()->num_sweeper_threads(); i++) {
|
for (int i = 0; i < isolate()->num_sweeper_threads(); i++) {
|
||||||
isolate()->sweeper_threads()[i]->StartSweeping();
|
isolate()->sweeper_threads()[i]->StartSweeping();
|
||||||
@ -3068,8 +3073,12 @@ void MarkCompactCollector::EvacuatePages() {
|
|||||||
int npages = evacuation_candidates_.length();
|
int npages = evacuation_candidates_.length();
|
||||||
for (int i = 0; i < npages; i++) {
|
for (int i = 0; i < npages; i++) {
|
||||||
Page* p = evacuation_candidates_[i];
|
Page* p = evacuation_candidates_[i];
|
||||||
ASSERT(p->IsEvacuationCandidate() ||
|
// TODO(hpayer): This check is just used for debugging purpose and
|
||||||
p->IsFlagSet(Page::RESCAN_ON_EVACUATION));
|
// 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()) {
|
if (p->IsEvacuationCandidate()) {
|
||||||
// During compaction we might have to request a new page.
|
// During compaction we might have to request a new page.
|
||||||
// Check that space still have room for that.
|
// Check that space still have room for that.
|
||||||
@ -3900,7 +3909,10 @@ template<MarkCompactCollector::SweepingParallelism mode>
|
|||||||
intptr_t MarkCompactCollector::SweepConservatively(PagedSpace* space,
|
intptr_t MarkCompactCollector::SweepConservatively(PagedSpace* space,
|
||||||
FreeList* free_list,
|
FreeList* free_list,
|
||||||
Page* p) {
|
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 &&
|
ASSERT((mode == MarkCompactCollector::SWEEP_IN_PARALLEL &&
|
||||||
free_list != NULL) ||
|
free_list != NULL) ||
|
||||||
(mode == MarkCompactCollector::SWEEP_SEQUENTIALLY &&
|
(mode == MarkCompactCollector::SWEEP_SEQUENTIALLY &&
|
||||||
|
@ -1142,6 +1142,11 @@ void PagedSpace::ReleasePage(Page* page, bool unlink) {
|
|||||||
DecreaseUnsweptFreeBytes(page);
|
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) {
|
if (Page::FromAllocationTop(allocation_info_.top()) == page) {
|
||||||
allocation_info_.set_top(NULL);
|
allocation_info_.set_top(NULL);
|
||||||
allocation_info_.set_limit(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* FreeListCategory::PickNodeFromList(int *node_size) {
|
||||||
FreeListNode* node = top_;
|
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) {
|
void FreeList::RepairLists(Heap* heap) {
|
||||||
small_list_.RepairFreeList(heap);
|
small_list_.RepairFreeList(heap);
|
||||||
medium_list_.RepairFreeList(heap);
|
medium_list_.RepairFreeList(heap);
|
||||||
|
11
src/spaces.h
11
src/spaces.h
@ -1521,6 +1521,7 @@ class FreeListCategory {
|
|||||||
FreeListNode* PickNodeFromList(int size_in_bytes, int *node_size);
|
FreeListNode* PickNodeFromList(int size_in_bytes, int *node_size);
|
||||||
|
|
||||||
intptr_t EvictFreeListItemsInList(Page* p);
|
intptr_t EvictFreeListItemsInList(Page* p);
|
||||||
|
bool ContainsPageFreeListItemsInList(Page* p);
|
||||||
|
|
||||||
void RepairFreeList(Heap* heap);
|
void RepairFreeList(Heap* heap);
|
||||||
|
|
||||||
@ -1538,6 +1539,10 @@ class FreeListCategory {
|
|||||||
|
|
||||||
Mutex* mutex() { return &mutex_; }
|
Mutex* mutex() { return &mutex_; }
|
||||||
|
|
||||||
|
bool IsEmpty() {
|
||||||
|
return top_ == NULL;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
intptr_t SumFreeList();
|
intptr_t SumFreeList();
|
||||||
int FreeListLength();
|
int FreeListLength();
|
||||||
@ -1605,6 +1610,11 @@ class FreeList {
|
|||||||
// 'wasted_bytes'. The size should be a non-zero multiple of the word size.
|
// 'wasted_bytes'. The size should be a non-zero multiple of the word size.
|
||||||
MUST_USE_RESULT HeapObject* Allocate(int size_in_bytes);
|
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
|
#ifdef DEBUG
|
||||||
void Zap();
|
void Zap();
|
||||||
intptr_t SumFreeLists();
|
intptr_t SumFreeLists();
|
||||||
@ -1615,6 +1625,7 @@ class FreeList {
|
|||||||
void RepairLists(Heap* heap);
|
void RepairLists(Heap* heap);
|
||||||
|
|
||||||
intptr_t EvictFreeListItems(Page* p);
|
intptr_t EvictFreeListItems(Page* p);
|
||||||
|
bool ContainsPageFreeListItems(Page* p);
|
||||||
|
|
||||||
FreeListCategory* small_list() { return &small_list_; }
|
FreeListCategory* small_list() { return &small_list_; }
|
||||||
FreeListCategory* medium_list() { return &medium_list_; }
|
FreeListCategory* medium_list() { return &medium_list_; }
|
||||||
|
Loading…
Reference in New Issue
Block a user