Commit f6f95448 authored by erik.corry@gmail.com's avatar erik.corry@gmail.com

Make --stress-compaction more stressful.

Review URL: https://chromiumcodereview.appspot.com/10141007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11431 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent f7f81c46
...@@ -238,12 +238,17 @@ int Heap::GcSafeSizeOfOldObject(HeapObject* object) { ...@@ -238,12 +238,17 @@ int Heap::GcSafeSizeOfOldObject(HeapObject* object) {
GarbageCollector Heap::SelectGarbageCollector(AllocationSpace space, GarbageCollector Heap::SelectGarbageCollector(AllocationSpace space,
const char** reason) { const char** reason) {
// Is global GC requested? // Is global GC requested?
if (space != NEW_SPACE || FLAG_gc_global) { if (space != NEW_SPACE) {
isolate_->counters()->gc_compactor_caused_by_request()->Increment(); isolate_->counters()->gc_compactor_caused_by_request()->Increment();
*reason = "GC in old space requested"; *reason = "GC in old space requested";
return MARK_COMPACTOR; 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? // Is enough data promoted to justify a global GC?
if (OldGenerationPromotionLimitReached()) { if (OldGenerationPromotionLimitReached()) {
isolate_->counters()->gc_compactor_caused_by_promoted_data()->Increment(); isolate_->counters()->gc_compactor_caused_by_promoted_data()->Increment();
...@@ -5696,6 +5701,11 @@ bool Heap::ConfigureHeap(int max_semispace_size, ...@@ -5696,6 +5701,11 @@ bool Heap::ConfigureHeap(int max_semispace_size,
intptr_t max_executable_size) { intptr_t max_executable_size) {
if (HasBeenSetUp()) return false; 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 > 0) {
if (max_semispace_size < Page::kPageSize) { if (max_semispace_size < Page::kPageSize) {
max_semispace_size = Page::kPageSize; max_semispace_size = Page::kPageSize;
...@@ -6132,6 +6142,9 @@ void Heap::SetStackLimits() { ...@@ -6132,6 +6142,9 @@ void Heap::SetStackLimits() {
void Heap::TearDown() { void Heap::TearDown() {
if (FLAG_verify_heap) {
Verify();
}
if (FLAG_print_cumulative_gc_stat) { if (FLAG_print_cumulative_gc_stat) {
PrintF("\n\n"); PrintF("\n\n");
PrintF("gc_count=%d ", gc_count_); PrintF("gc_count=%d ", gc_count_);
......
...@@ -1456,6 +1456,8 @@ class Heap { ...@@ -1456,6 +1456,8 @@ class Heap {
inline bool NextGCIsLikelyToBeFull() { inline bool NextGCIsLikelyToBeFull() {
if (FLAG_gc_global) return true; if (FLAG_gc_global) return true;
if (FLAG_stress_compaction && (gc_count_ & 1) != 0) return true;
intptr_t total_promoted = PromotedTotalSize(); intptr_t total_promoted = PromotedTotalSize();
intptr_t adjusted_promotion_limit = intptr_t adjusted_promotion_limit =
......
...@@ -295,11 +295,25 @@ MaybeObject* PagedSpace::AllocateRaw(int size_in_bytes) { ...@@ -295,11 +295,25 @@ MaybeObject* PagedSpace::AllocateRaw(int size_in_bytes) {
MaybeObject* NewSpace::AllocateRaw(int size_in_bytes) { MaybeObject* NewSpace::AllocateRaw(int size_in_bytes) {
Address old_top = allocation_info_.top; 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) { if (allocation_info_.limit - old_top < size_in_bytes) {
return SlowAllocateRaw(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; allocation_info_.top += size_in_bytes;
ASSERT_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_); ASSERT_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_);
......
...@@ -149,6 +149,8 @@ no_last_match(function() { cons.replace("e", "E"); }); ...@@ -149,6 +149,8 @@ no_last_match(function() { cons.replace("e", "E"); });
assertEquals("bar", RegExp.$1); 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, ""); var a = "foo bar baz".replace(/^|bar/g, "");
assertEquals("foo baz", a); assertEquals("foo baz", a);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment