New flag --stress-compaction

Review URL: http://codereview.chromium.org/8234002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9582 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
erik.corry@gmail.com 2011-10-11 15:52:15 +00:00
parent 95efb334ac
commit 3ce33aacc6
5 changed files with 32 additions and 8 deletions

View File

@ -394,6 +394,15 @@ DEFINE_bool(gdbjit_dump, false, "dump elf objects with debug info to disk")
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 @@ DEFINE_bool(print_global_handles, false, "report global handles after GC")
// 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,

View File

@ -1031,6 +1031,9 @@ class Heap {
}
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);
// Iterates over all strong roots in the heap.
@ -1243,16 +1246,18 @@ class Heap {
}
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;

View File

@ -346,6 +346,7 @@ bool IncrementalMarking::WorthActivating() {
#endif
return FLAG_incremental_marking &&
!Serializer::enabled() &&
heap_->PromotedSpaceSize() > kActivationThreshold;
}

View File

@ -433,7 +433,15 @@ void MarkCompactCollector::CollectEvacuationCandidates(PagedSpace* space) {
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 {

View File

@ -216,6 +216,12 @@ void V8::InitializeOncePerProcess() {
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