Reviewers: Michael Starzinger, jochen,
Description:
Enable concurrent sweeping. Added some extra debugging checks for concurrent
sweeping.
BUG=
Please review this at https://codereview.chromium.org/138903009/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+49, -3 lines):
M src/flag-definitions.h
M src/mark-compact.cc
M src/spaces.h
M src/spaces.cc
Index: src/flag-definitions.h
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index
1136daa4e9dacfe16b0543eccfd2f69c4d143e41..1c0a3e1229c88dba7b31c2f4660edcaabbb79b1a
100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -530,7 +530,7 @@ DEFINE_bool(trace_incremental_marking, false,
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(concurrent_sweeping, true, "enable concurrent sweeping")
DEFINE_int(sweeper_threads, 0,
"number of parallel and concurrent sweeping threads")
#ifdef VERIFY_HEAP
Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index
9670925045205c89ecfd49cd19714d6a1fd4d07c..71c7a6fadbe058fdc7624a9a1239277c2849f658
100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -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() ||
+ // 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 &&
Index: src/spaces.cc
diff --git a/src/spaces.cc b/src/spaces.cc
index
9af09270698ed00ae5f38c74044f1015f0f788fc..a80341bd7fc6baa7750e76c89528ba6cbbeb29fe
100644
--- a/src/spaces.cc
+++ b/src/spaces.cc
@@ -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);
Index: src/spaces.h
diff --git a/src/spaces.h b/src/spaces.h
index
2ba567d27f83ae136b668ba71e2ea91543e2f609..44e8cb6e33161393f5d494537a31929181ed44a0
100644
--- a/src/spaces.h
+++ b/src/spaces.h
@@ -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_; }
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.