Revision: 18722
Author:   [email protected]
Date:     Tue Jan 21 19:30:27 2014 UTC
Log: Enable concurrent sweeping. Added some extra debugging checks for concurrent sweeping.

BUG=
[email protected]

Review URL: https://codereview.chromium.org/138903009
http://code.google.com/p/v8/source/detail?r=18722

Modified:
 /branches/bleeding_edge/src/flag-definitions.h
 /branches/bleeding_edge/src/mark-compact.cc
 /branches/bleeding_edge/src/spaces.cc
 /branches/bleeding_edge/src/spaces.h

=======================================
--- /branches/bleeding_edge/src/flag-definitions.h Thu Jan 16 13:18:28 2014 UTC +++ /branches/bleeding_edge/src/flag-definitions.h Tue Jan 21 19:30:27 2014 UTC
@@ -529,8 +529,8 @@
             "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
=======================================
--- /branches/bleeding_edge/src/mark-compact.cc Tue Jan 21 16:19:04 2014 UTC
+++ /branches/bleeding_edge/src/mark-compact.cc Tue Jan 21 19:30:27 2014 UTC
@@ -570,6 +570,11 @@


 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 @@
   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 @@
 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 &&
=======================================
--- /branches/bleeding_edge/src/spaces.cc       Tue Jan 21 12:48:10 2014 UTC
+++ /branches/bleeding_edge/src/spaces.cc       Tue Jan 21 19:30:27 2014 UTC
@@ -1141,6 +1141,11 @@
   } else {
     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);
@@ -2123,6 +2128,16 @@
   available_ -= sum;
   return sum;
 }
+
+
+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) {
@@ -2450,6 +2465,14 @@

   return sum;
 }
+
+
+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) {
=======================================
--- /branches/bleeding_edge/src/spaces.h        Tue Jan 21 11:41:18 2014 UTC
+++ /branches/bleeding_edge/src/spaces.h        Tue Jan 21 19:30:27 2014 UTC
@@ -1521,6 +1521,7 @@
   FreeListNode* PickNodeFromList(int size_in_bytes, int *node_size);

   intptr_t EvictFreeListItemsInList(Page* p);
+  bool ContainsPageFreeListItemsInList(Page* p);

   void RepairFreeList(Heap* heap);

@@ -1537,6 +1538,10 @@
   void set_available(int available) { available_ = available; }

   Mutex* mutex() { return &mutex_; }
+
+  bool IsEmpty() {
+    return top_ == NULL;
+  }

 #ifdef DEBUG
   intptr_t SumFreeList();
@@ -1605,6 +1610,11 @@
// '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 @@
   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.

Reply via email to