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

Side by Side Diff: test/cctest/heap/test-incremental-marking.cc

Issue 2313273002: [heap] Test fixes (Closed)
Patch Set: Created 4 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
« no previous file with comments | « test/cctest/heap/test-heap.cc ('k') | test/cctest/heap/test-mark-compact.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdlib.h> 5 #include <stdlib.h>
6 6
7 #ifdef __linux__ 7 #ifdef __linux__
8 #include <errno.h> 8 #include <errno.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <sys/stat.h> 10 #include <sys/stat.h>
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 while (platform.PendingIdleTask()) { 133 while (platform.PendingIdleTask()) {
134 platform.PerformIdleTask(kLongIdleTimeInSeconds); 134 platform.PerformIdleTask(kLongIdleTimeInSeconds);
135 } 135 }
136 CHECK(marking->IsStopped()); 136 CHECK(marking->IsStopped());
137 i::V8::SetPlatformForTesting(old_platform); 137 i::V8::SetPlatformForTesting(old_platform);
138 } 138 }
139 139
140 140
141 TEST(IncrementalMarkingUsingIdleTasksAfterGC) { 141 TEST(IncrementalMarkingUsingIdleTasksAfterGC) {
142 if (!i::FLAG_incremental_marking) return; 142 if (!i::FLAG_incremental_marking) return;
143
144 const double kLongIdleTimeInSeconds = 1;
145 const double kShortIdleTimeInSeconds = 0.010;
146
143 CcTest::InitializeVM(); 147 CcTest::InitializeVM();
144 v8::Platform* old_platform = i::V8::GetCurrentPlatform(); 148 v8::Platform* old_platform = i::V8::GetCurrentPlatform();
145 MockPlatform platform(old_platform); 149 MockPlatform platform(old_platform);
146 i::V8::SetPlatformForTesting(&platform); 150 i::V8::SetPlatformForTesting(&platform);
147 i::heap::SimulateFullSpace(CcTest::heap()->old_space()); 151 i::heap::SimulateFullSpace(CcTest::heap()->old_space());
148 CcTest::heap()->CollectAllGarbage(); 152 CcTest::heap()->CollectAllGarbage();
153 // Perform any pending idle tasks.
154 while (platform.PendingIdleTask()) {
155 platform.PerformIdleTask(kLongIdleTimeInSeconds);
156 }
157 CHECK(!platform.PendingIdleTask());
149 i::IncrementalMarking* marking = CcTest::heap()->incremental_marking(); 158 i::IncrementalMarking* marking = CcTest::heap()->incremental_marking();
150 marking->Stop(); 159 marking->Stop();
151 marking->Start(); 160 marking->Start();
152 CHECK(platform.PendingIdleTask()); 161 CHECK(platform.PendingIdleTask());
153 const double kLongIdleTimeInSeconds = 1;
154 const double kShortIdleTimeInSeconds = 0.010;
155 const int kShortStepCount = 10; 162 const int kShortStepCount = 10;
156 for (int i = 0; i < kShortStepCount && platform.PendingIdleTask(); i++) { 163 for (int i = 0; i < kShortStepCount && platform.PendingIdleTask(); i++) {
157 platform.PerformIdleTask(kShortIdleTimeInSeconds); 164 platform.PerformIdleTask(kShortIdleTimeInSeconds);
158 } 165 }
159 while (platform.PendingIdleTask()) { 166 while (platform.PendingIdleTask()) {
160 platform.PerformIdleTask(kLongIdleTimeInSeconds); 167 platform.PerformIdleTask(kLongIdleTimeInSeconds);
161 } 168 }
162 CHECK(marking->IsStopped()); 169 CHECK(marking->IsStopped());
163 i::V8::SetPlatformForTesting(old_platform); 170 i::V8::SetPlatformForTesting(old_platform);
164 } 171 }
(...skipping 23 matching lines...) Expand all
188 while (!marking->IsStopped() && platform.PendingDelayedTask()) { 195 while (!marking->IsStopped() && platform.PendingDelayedTask()) {
189 platform.PerformDelayedTask(); 196 platform.PerformDelayedTask();
190 } 197 }
191 // There could be pending delayed task from memory reducer after GC finishes. 198 // There could be pending delayed task from memory reducer after GC finishes.
192 CHECK(marking->IsStopped()); 199 CHECK(marking->IsStopped());
193 i::V8::SetPlatformForTesting(old_platform); 200 i::V8::SetPlatformForTesting(old_platform);
194 } 201 }
195 202
196 } // namespace internal 203 } // namespace internal
197 } // namespace v8 204 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/heap/test-heap.cc ('k') | test/cctest/heap/test-mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698