Revision: 11431
Author:   [email protected]
Date:     Wed Apr 25 04:35:32 2012
Log:      Make --stress-compaction more stressful.
Review URL: https://chromiumcodereview.appspot.com/10141007
http://code.google.com/p/v8/source/detail?r=11431

Modified:
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/heap.h
 /branches/bleeding_edge/src/spaces-inl.h
 /branches/bleeding_edge/test/mjsunit/regexp-capture-3.js

=======================================
--- /branches/bleeding_edge/src/heap.cc Tue Apr 24 07:05:07 2012
+++ /branches/bleeding_edge/src/heap.cc Wed Apr 25 04:35:32 2012
@@ -238,11 +238,16 @@
 GarbageCollector Heap::SelectGarbageCollector(AllocationSpace space,
                                               const char** reason) {
   // Is global GC requested?
-  if (space != NEW_SPACE || FLAG_gc_global) {
+  if (space != NEW_SPACE) {
     isolate_->counters()->gc_compactor_caused_by_request()->Increment();
     *reason = "GC in old space requested";
     return MARK_COMPACTOR;
   }
+
+  if (FLAG_gc_global || (FLAG_stress_compaction && (gc_count_ & 1) != 0)) {
+    *reason = "GC in old space forced by flags";
+    return MARK_COMPACTOR;
+  }

   // Is enough data promoted to justify a global GC?
   if (OldGenerationPromotionLimitReached()) {
@@ -5696,6 +5701,11 @@
                          intptr_t max_executable_size) {
   if (HasBeenSetUp()) return false;

+  if (FLAG_stress_compaction) {
+    // This will cause more frequent GCs when stressing.
+    max_semispace_size_ = Page::kPageSize;
+  }
+
   if (max_semispace_size > 0) {
     if (max_semispace_size < Page::kPageSize) {
       max_semispace_size = Page::kPageSize;
@@ -6132,6 +6142,9 @@


 void Heap::TearDown() {
+  if (FLAG_verify_heap) {
+    Verify();
+  }
   if (FLAG_print_cumulative_gc_stat) {
     PrintF("\n\n");
     PrintF("gc_count=%d ", gc_count_);
=======================================
--- /branches/bleeding_edge/src/heap.h  Wed Apr 25 01:45:45 2012
+++ /branches/bleeding_edge/src/heap.h  Wed Apr 25 04:35:32 2012
@@ -1456,6 +1456,8 @@
   inline bool NextGCIsLikelyToBeFull() {
     if (FLAG_gc_global) return true;

+    if (FLAG_stress_compaction && (gc_count_ & 1) != 0) return true;
+
     intptr_t total_promoted = PromotedTotalSize();

     intptr_t adjusted_promotion_limit =
=======================================
--- /branches/bleeding_edge/src/spaces-inl.h    Mon Apr  2 01:32:31 2012
+++ /branches/bleeding_edge/src/spaces-inl.h    Wed Apr 25 04:35:32 2012
@@ -295,11 +295,25 @@

 MaybeObject* NewSpace::AllocateRaw(int size_in_bytes) {
   Address old_top = allocation_info_.top;
+#ifdef DEBUG
+  if (FLAG_stress_compaction && !HEAP->linear_allocation()) {
+    if (allocation_info_.limit - old_top >= size_in_bytes * 4) {
+      int filler_size = size_in_bytes * 4;
+      for (int i = 0; i < filler_size; i += kPointerSize) {
+        *(reinterpret_cast<Object**>(old_top + i)) =
+            HEAP->one_pointer_filler_map();
+      }
+      old_top += filler_size;
+      allocation_info_.top += filler_size;
+    }
+  }
+#endif
+
   if (allocation_info_.limit - old_top < size_in_bytes) {
     return SlowAllocateRaw(size_in_bytes);
   }

-  Object* obj = HeapObject::FromAddress(allocation_info_.top);
+  Object* obj = HeapObject::FromAddress(old_top);
   allocation_info_.top += size_in_bytes;
   ASSERT_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_);

=======================================
--- /branches/bleeding_edge/test/mjsunit/regexp-capture-3.js Mon Apr 23 11:56:07 2012 +++ /branches/bleeding_edge/test/mjsunit/regexp-capture-3.js Wed Apr 25 04:35:32 2012
@@ -149,6 +149,8 @@
 assertEquals("bar", RegExp.$1);


+// A test that initially does a zero width match, but later does a non-zero
+// width match.
 var a = "foo bar baz".replace(/^|bar/g, "");
 assertEquals("foo  baz", a);

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

Reply via email to