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

Side by Side Diff: test/cctest/test-mark-compact.cc

Issue 23519010: cleanup cctest generally and remove ctest::context (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: arm fix Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-log-stack-tracer.cc ('k') | test/cctest/test-strings.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 CHECK_EQ(original_address, current_address); 70 CHECK_EQ(original_address, current_address);
71 DeleteArray(mem); 71 DeleteArray(mem);
72 } 72 }
73 73
74 74
75 TEST(Promotion) { 75 TEST(Promotion) {
76 // This test requires compaction. If compaction is turned off, we 76 // This test requires compaction. If compaction is turned off, we
77 // skip the entire test. 77 // skip the entire test.
78 if (FLAG_never_compact) return; 78 if (FLAG_never_compact) return;
79 79
80 CcTest::InitializeVM();
81
80 // Ensure that we get a compacting collection so that objects are promoted 82 // Ensure that we get a compacting collection so that objects are promoted
81 // from new space. 83 // from new space.
82 FLAG_gc_global = true; 84 FLAG_gc_global = true;
83 FLAG_always_compact = true; 85 FLAG_always_compact = true;
84 Heap* heap = CcTest::heap(); 86 Heap* heap = CcTest::heap();
85 heap->ConfigureHeap(2*256*KB, 8*MB, 8*MB); 87 heap->ConfigureHeap(2*256*KB, 8*MB, 8*MB);
86 88
87 CcTest::InitializeVM();
88
89 v8::HandleScope sc(CcTest::isolate()); 89 v8::HandleScope sc(CcTest::isolate());
90 90
91 // Allocate a fixed array in the new space. 91 // Allocate a fixed array in the new space.
92 int array_size = 92 int array_size =
93 (Page::kMaxNonCodeHeapObjectSize - FixedArray::kHeaderSize) / 93 (Page::kMaxNonCodeHeapObjectSize - FixedArray::kHeaderSize) /
94 (kPointerSize * 4); 94 (kPointerSize * 4);
95 Object* obj = heap->AllocateFixedArray(array_size)->ToObjectChecked(); 95 Object* obj = heap->AllocateFixedArray(array_size)->ToObjectChecked();
96 96
97 Handle<FixedArray> array(FixedArray::cast(obj)); 97 Handle<FixedArray> array(FixedArray::cast(obj));
98 98
99 // Array should be in the new space. 99 // Array should be in the new space.
100 CHECK(heap->InSpace(*array, NEW_SPACE)); 100 CHECK(heap->InSpace(*array, NEW_SPACE));
101 101
102 // Call the m-c collector, so array becomes an old object. 102 // Call the m-c collector, so array becomes an old object.
103 heap->CollectGarbage(OLD_POINTER_SPACE); 103 heap->CollectGarbage(OLD_POINTER_SPACE);
104 104
105 // Array now sits in the old space 105 // Array now sits in the old space
106 CHECK(heap->InSpace(*array, OLD_POINTER_SPACE)); 106 CHECK(heap->InSpace(*array, OLD_POINTER_SPACE));
107 } 107 }
108 108
109 109
110 TEST(NoPromotion) { 110 TEST(NoPromotion) {
111 CcTest::heap()->ConfigureHeap(2*256*KB, 8*MB, 8*MB);
112
113 // Test the situation that some objects in new space are promoted to 111 // Test the situation that some objects in new space are promoted to
114 // the old space 112 // the old space
115 CcTest::InitializeVM(); 113 CcTest::InitializeVM();
116 114
115 CcTest::heap()->ConfigureHeap(2*256*KB, 8*MB, 8*MB);
116
117 v8::HandleScope sc(CcTest::isolate()); 117 v8::HandleScope sc(CcTest::isolate());
118 118
119 // Do a mark compact GC to shrink the heap. 119 // Do a mark compact GC to shrink the heap.
120 CcTest::heap()->CollectGarbage(OLD_POINTER_SPACE); 120 CcTest::heap()->CollectGarbage(OLD_POINTER_SPACE);
121 121
122 // Allocate a big Fixed array in the new space. 122 // Allocate a big Fixed array in the new space.
123 int length = (Page::kMaxNonCodeHeapObjectSize - 123 int length = (Page::kMaxNonCodeHeapObjectSize -
124 FixedArray::kHeaderSize) / (2 * kPointerSize); 124 FixedArray::kHeaderSize) / (2 * kPointerSize);
125 Object* obj = CcTest::heap()->AllocateFixedArray(length)-> 125 Object* obj = CcTest::heap()->AllocateFixedArray(length)->
126 ToObjectChecked(); 126 ToObjectChecked();
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 550
551 551
552 TEST(RegressJoinThreadsOnIsolateDeinit) { 552 TEST(RegressJoinThreadsOnIsolateDeinit) {
553 intptr_t size_limit = ShortLivingIsolate() * 2; 553 intptr_t size_limit = ShortLivingIsolate() * 2;
554 for (int i = 0; i < 10; i++) { 554 for (int i = 0; i < 10; i++) {
555 CHECK_GT(size_limit, ShortLivingIsolate()); 555 CHECK_GT(size_limit, ShortLivingIsolate());
556 } 556 }
557 } 557 }
558 558
559 #endif // __linux__ and !USE_SIMULATOR 559 #endif // __linux__ and !USE_SIMULATOR
OLDNEW
« no previous file with comments | « test/cctest/test-log-stack-tracer.cc ('k') | test/cctest/test-strings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698