Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Unified Diff: test/cctest/test-mark-compact.cc

Issue 42543008: Simplify test-mark-compact/NoPromotion test. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Minor fix. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-mark-compact.cc
diff --git a/test/cctest/test-mark-compact.cc b/test/cctest/test-mark-compact.cc
index 624969f45f09820ee4a22183e77f1431a1619e06..e62bdeb074d57a5bba30ff91873357014c4c2e4f 100644
--- a/test/cctest/test-mark-compact.cc
+++ b/test/cctest/test-mark-compact.cc
@@ -73,33 +73,23 @@ TEST(MarkingDeque) {
TEST(Promotion) {
- // This test requires compaction. If compaction is turned off, we
- // skip the entire test.
- if (FLAG_never_compact) return;
-
CcTest::InitializeVM();
-
- // Ensure that we get a compacting collection so that objects are promoted
- // from new space.
- FLAG_gc_global = true;
- FLAG_always_compact = true;
Heap* heap = CcTest::heap();
- heap->ConfigureHeap(2*256*KB, 8*MB, 8*MB);
+ heap->ConfigureHeap(2*256*KB, 1*MB, 1*MB);
v8::HandleScope sc(CcTest::isolate());
// Allocate a fixed array in the new space.
- int array_size =
+ int array_length =
(Page::kMaxNonCodeHeapObjectSize - FixedArray::kHeaderSize) /
- (kPointerSize * 4);
- Object* obj = heap->AllocateFixedArray(array_size)->ToObjectChecked();
-
+ (4 * kPointerSize);
+ Object* obj = heap->AllocateFixedArray(array_length)->ToObjectChecked();
Handle<FixedArray> array(FixedArray::cast(obj));
// Array should be in the new space.
CHECK(heap->InSpace(*array, NEW_SPACE));
- // Call the m-c collector, so array becomes an old object.
+ // Call mark compact GC, so array becomes an old object.
heap->CollectGarbage(OLD_POINTER_SPACE);
// Array now sits in the old space
@@ -108,42 +98,27 @@ TEST(Promotion) {
TEST(NoPromotion) {
- // Test the situation that some objects in new space are promoted to
- // the old space
CcTest::InitializeVM();
-
- CcTest::heap()->ConfigureHeap(2*256*KB, 8*MB, 8*MB);
+ Heap* heap = CcTest::heap();
+ heap->ConfigureHeap(2*256*KB, 1*MB, 1*MB);
v8::HandleScope sc(CcTest::isolate());
- // Do a mark compact GC to shrink the heap.
- CcTest::heap()->CollectGarbage(OLD_POINTER_SPACE);
-
- // Allocate a big Fixed array in the new space.
- int length = (Page::kMaxNonCodeHeapObjectSize -
- FixedArray::kHeaderSize) / (2 * kPointerSize);
- Object* obj = CcTest::heap()->AllocateFixedArray(length)->
- ToObjectChecked();
-
+ // Allocate a big fixed array in the new space.
+ int array_length =
+ (Page::kMaxNonCodeHeapObjectSize - FixedArray::kHeaderSize) /
+ (2 * kPointerSize);
+ Object* obj = heap->AllocateFixedArray(array_length)->ToObjectChecked();
Handle<FixedArray> array(FixedArray::cast(obj));
- // Array still stays in the new space.
- CHECK(CcTest::heap()->InSpace(*array, NEW_SPACE));
-
- // Allocate objects in the old space until out of memory.
- FixedArray* host = *array;
- while (true) {
- Object* obj;
- { MaybeObject* maybe_obj = CcTest::heap()->AllocateFixedArray(100, TENURED);
- if (!maybe_obj->ToObject(&obj)) break;
- }
+ // Array should be in the new space.
+ CHECK(heap->InSpace(*array, NEW_SPACE));
- host->set(0, obj);
- host = FixedArray::cast(obj);
- }
+ // Simulate a full old space to make promotion fail.
+ SimulateFullSpace(heap->old_pointer_space());
// Call mark compact GC, and it should pass.
- CcTest::heap()->CollectGarbage(OLD_POINTER_SPACE);
+ heap->CollectGarbage(OLD_POINTER_SPACE);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698