Index: src/heap.cc |
=================================================================== |
--- src/heap.cc (revision 11422) |
+++ src/heap.cc (working copy) |
@@ -238,12 +238,17 @@ |
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()) { |
isolate_->counters()->gc_compactor_caused_by_promoted_data()->Increment(); |
@@ -5695,6 +5700,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; |
@@ -6131,6 +6141,9 @@ |
void Heap::TearDown() { |
+ if (FLAG_verify_heap) { |
+ Verify(); |
+ } |
if (FLAG_print_cumulative_gc_stat) { |
PrintF("\n\n"); |
PrintF("gc_count=%d ", gc_count_); |