Revision: 9582
Author:   [email protected]
Date:     Tue Oct 11 08:52:15 2011
Log:      New flag --stress-compaction
Review URL: http://codereview.chromium.org/8234002
http://code.google.com/p/v8/source/detail?r=9582

Modified:
 /branches/bleeding_edge/src/flag-definitions.h
 /branches/bleeding_edge/src/heap.h
 /branches/bleeding_edge/src/incremental-marking.cc
 /branches/bleeding_edge/src/mark-compact.cc
 /branches/bleeding_edge/src/v8.cc

=======================================
--- /branches/bleeding_edge/src/flag-definitions.h      Tue Oct 11 04:35:04 2011
+++ /branches/bleeding_edge/src/flag-definitions.h      Tue Oct 11 08:52:15 2011
@@ -394,6 +394,15 @@
 DEFINE_string(gdbjit_dump_filter, "",
               "dump only objects containing this substring")

+// mark-compact.cc
+DEFINE_bool(force_marking_deque_overflows, false,
+            "force overflows of marking deque by reducing it's size "
+            "to 64 words")
+
+DEFINE_bool(stress_compaction, false,
+            "stress the GC compactor to flush out bugs (implies "
+            "--force_marking_deque_overflows)")
+
 //
 // Debug only flags
 //
@@ -441,11 +450,6 @@
 // ic.cc
 DEFINE_bool(trace_ic, false, "trace inline cache state transitions")

-// mark-compact.cc
-DEFINE_bool(force_marking_deque_overflows, false,
-            "force overflows of marking deque by reducing it's size "
-            "to 64 words")
-
 // objects.cc
 DEFINE_bool(trace_normalization,
             false,
=======================================
--- /branches/bleeding_edge/src/heap.h  Mon Oct 10 02:21:48 2011
+++ /branches/bleeding_edge/src/heap.h  Tue Oct 11 08:52:15 2011
@@ -1030,6 +1030,9 @@
     global_contexts_list_ = object;
   }
   Object* global_contexts_list() { return global_contexts_list_; }
+
+  // Number of mark-sweeps.
+  int ms_count() { return ms_count_; }

   // Iterates over all roots in the heap.
   void IterateRoots(ObjectVisitor* v, VisitMode mode);
@@ -1243,16 +1246,18 @@
   }

   intptr_t OldGenPromotionLimit(intptr_t old_gen_size) {
+    const int divisor = FLAG_stress_compaction ? 10 : 3;
     intptr_t limit =
-        Max(old_gen_size + old_gen_size / 3, kMinimumPromotionLimit);
+        Max(old_gen_size + old_gen_size / divisor, kMinimumPromotionLimit);
     limit += new_space_.Capacity();
     limit *= old_gen_limit_factor_;
     return limit;
   }

   intptr_t OldGenAllocationLimit(intptr_t old_gen_size) {
+    const int divisor = FLAG_stress_compaction ? 8 : 2;
     intptr_t limit =
-        Max(old_gen_size + old_gen_size / 2, kMinimumAllocationLimit);
+ Max(old_gen_size + old_gen_size / divisor, kMinimumAllocationLimit);
     limit += new_space_.Capacity();
     limit *= old_gen_limit_factor_;
     return limit;
=======================================
--- /branches/bleeding_edge/src/incremental-marking.cc Tue Oct 11 04:38:00 2011 +++ /branches/bleeding_edge/src/incremental-marking.cc Tue Oct 11 08:52:15 2011
@@ -346,6 +346,7 @@
 #endif

   return FLAG_incremental_marking &&
+      !Serializer::enabled() &&
       heap_->PromotedSpaceSize() > kActivationThreshold;
 }

=======================================
--- /branches/bleeding_edge/src/mark-compact.cc Tue Oct 11 04:35:04 2011
+++ /branches/bleeding_edge/src/mark-compact.cc Tue Oct 11 08:52:15 2011
@@ -433,7 +433,15 @@
   if (it.has_next()) it.next();  // Never compact the first page.
   while (it.has_next()) {
     Page* p = it.next();
-    if (space->IsFragmented(p)) {
+    bool evacuate = false;
+    if (FLAG_stress_compaction) {
+      int counter = space->heap()->ms_count();
+ uintptr_t page_number = reinterpret_cast<uintptr_t>(p) >> kPageSizeBits;
+      if ((counter & 1) == (page_number & 1)) evacuate = true;
+    } else {
+      if (space->IsFragmented(p)) evacuate = true;
+    }
+    if (evacuate) {
       AddEvacuationCandidate(p);
       count++;
     } else {
=======================================
--- /branches/bleeding_edge/src/v8.cc   Mon Sep 19 11:36:47 2011
+++ /branches/bleeding_edge/src/v8.cc   Tue Oct 11 08:52:15 2011
@@ -216,6 +216,12 @@
   FLAG_peephole_optimization = !use_crankshaft_;

   ElementsAccessor::InitializeOncePerProcess();
+
+  if (FLAG_stress_compaction) {
+    FLAG_force_marking_deque_overflows = true;
+    FLAG_gc_global = true;
+    FLAG_max_new_space_size = (1 << (kPageSizeBits - 10)) * 2;
+  }
 }

 } }  // namespace v8::internal

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to