Reviewers: Hannes Payer,

Description:
Track how many pages trigger fallback strategies in GC

[email protected]
BUG=

Please review this at https://codereview.chromium.org/1029323003/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+32, -22 lines):
  M include/v8.h
  M src/heap/mark-compact.h
  M src/heap/mark-compact.cc
  M src/heap/store-buffer.cc


Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index a44b094f4ee06accc4004634277df9622eda2e63..ca6be7f85fe99f4571d52b24bbd034a035050ac2 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -5063,7 +5063,7 @@ class V8_EXPORT Isolate {
   };

   /**
-   * Features reported via the SetUseCounterCallback callback. Do not chang
+ * Features reported via the SetUseCounterCallback callback. Do not change * assigned numbers of existing items; add new features to the end of this
    * list.
    */
@@ -5071,6 +5071,9 @@ class V8_EXPORT Isolate {
     kUseAsm = 0,
     kBreakIterator = 1,
     kLegacyConst = 2,
+    kMarkStackOverflow = 3,
+    kStoreBufferOverflow = 4,
+    kSlotsBufferOverflow = 5,
     kUseCounterFeatureCount  // This enum value must be last.
   };

Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index de381aab356657374f1e62f083173045d949ded0..785132478136dee00fbd1eeaf0d8d51d46e01af3 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -2032,6 +2032,7 @@ void MarkCompactCollector::EmptyMarkingDeque() {
// overflowed objects in the heap so the overflow flag on the markings stack
 // is cleared.
 void MarkCompactCollector::RefillMarkingDeque() {
+ isolate()->CountUsage(v8::Isolate::UseCounterFeature::kMarkStackOverflow);
   DCHECK(marking_deque_.overflowed());

   DiscoverGreyObjectsInNewSpace(heap(), &marking_deque_);
@@ -4508,6 +4509,30 @@ void MarkCompactCollector::RecordRelocSlot(RelocInfo* rinfo, Object* target) {
 }


+void MarkCompactCollector::EvictEvacuationCandidate(Page* page) {
+  if (FLAG_trace_fragmentation) {
+    PrintF("Page %p is too popular. Disabling evacuation.\n",
+           reinterpret_cast<void*>(page));
+  }
+
+ isolate()->CountUsage(v8::Isolate::UseCounterFeature::kSlotsBufferOverflow);
+
+  // TODO(gc) If all evacuation candidates are too popular we
+  // should stop slots recording entirely.
+  page->ClearEvacuationCandidate();
+
+  // We were not collecting slots on this page that point
+  // to other evacuation candidates thus we have to
+  // rescan the page after evacuation to discover and update all
+  // pointers to evacuated objects.
+  if (page->owner()->identity() == OLD_DATA_SPACE) {
+    evacuation_candidates_.RemoveElement(page);
+  } else {
+    page->SetFlag(Page::RESCAN_ON_EVACUATION);
+  }
+}
+
+
void MarkCompactCollector::RecordCodeEntrySlot(Address slot, Code* target) {
   Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target));
   if (target_page->IsEvacuationCandidate() &&
Index: src/heap/mark-compact.h
diff --git a/src/heap/mark-compact.h b/src/heap/mark-compact.h
index ddb993f5a2f676491e732da2a1a39cae26c48b59..9e2730a205ac4328d8f6f68818abe173d4ab699c 100644
--- a/src/heap/mark-compact.h
+++ b/src/heap/mark-compact.h
@@ -589,27 +589,6 @@ class MarkCompactCollector {
         ->IsEvacuationCandidate();
   }

-  INLINE(void EvictEvacuationCandidate(Page* page)) {
-    if (FLAG_trace_fragmentation) {
-      PrintF("Page %p is too popular. Disabling evacuation.\n",
-             reinterpret_cast<void*>(page));
-    }
-
-    // TODO(gc) If all evacuation candidates are too popular we
-    // should stop slots recording entirely.
-    page->ClearEvacuationCandidate();
-
-    // We were not collecting slots on this page that point
-    // to other evacuation candidates thus we have to
-    // rescan the page after evacuation to discover and update all
-    // pointers to evacuated objects.
-    if (page->owner()->identity() == OLD_DATA_SPACE) {
-      evacuation_candidates_.RemoveElement(page);
-    } else {
-      page->SetFlag(Page::RESCAN_ON_EVACUATION);
-    }
-  }
-
   void RecordRelocSlot(RelocInfo* rinfo, Object* target);
   void RecordCodeEntrySlot(Address slot, Code* target);
   void RecordCodeTargetPatch(Address pc, Code* target);
@@ -694,6 +673,7 @@ class MarkCompactCollector {
   bool WillBeDeoptimized(Code* code);
   void RemoveDeadInvalidatedCode();
   void ProcessInvalidatedCode(ObjectVisitor* visitor);
+  void EvictEvacuationCandidate(Page* page);

   void StartSweeperThreads();

Index: src/heap/store-buffer.cc
diff --git a/src/heap/store-buffer.cc b/src/heap/store-buffer.cc
index dec11daa90674b922d1a5510abd637323c08d654..b21bf27c13966184abec0cbec5d454c5ed5c7e4d 100644
--- a/src/heap/store-buffer.cc
+++ b/src/heap/store-buffer.cc
@@ -197,6 +197,8 @@ void StoreBuffer::ExemptPopularPages(int prime_sample_step, int threshold) {
   }
   if (created_new_scan_on_scavenge_pages) {
     Filter(MemoryChunk::SCAN_ON_SCAVENGE);
+    heap_->isolate()->CountUsage(
+        v8::Isolate::UseCounterFeature::kStoreBufferOverflow);
   }
   old_buffer_is_filtered_ = true;
 }


--
--
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/d/optout.

Reply via email to