OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 <cmath> | 5 #include <cmath> |
6 #include <limits> | 6 #include <limits> |
7 | 7 |
8 #include "src/globals.h" | 8 #include "src/globals.h" |
9 #include "src/heap/gc-tracer.h" | 9 #include "src/heap/gc-tracer.h" |
10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 tracer->AddIncrementalMarkingStep(100, 1000000); | 256 tracer->AddIncrementalMarkingStep(100, 1000000); |
257 EXPECT_EQ(1000000 / 100, | 257 EXPECT_EQ(1000000 / 100, |
258 tracer->IncrementalMarkingSpeedInBytesPerMillisecond()); | 258 tracer->IncrementalMarkingSpeedInBytesPerMillisecond()); |
259 // Scavenger has no impact on incremental marking details. | 259 // Scavenger has no impact on incremental marking details. |
260 tracer->Start(SCAVENGER, GarbageCollectionReason::kTesting, | 260 tracer->Start(SCAVENGER, GarbageCollectionReason::kTesting, |
261 "collector unittest"); | 261 "collector unittest"); |
262 tracer->Stop(SCAVENGER); | 262 tracer->Stop(SCAVENGER); |
263 // 1000000 bytes in 100ms. | 263 // 1000000 bytes in 100ms. |
264 tracer->AddIncrementalMarkingStep(100, 1000000); | 264 tracer->AddIncrementalMarkingStep(100, 1000000); |
265 EXPECT_EQ(300, tracer->incremental_marking_duration_); | 265 EXPECT_EQ(300, tracer->incremental_marking_duration_); |
266 EXPECT_EQ(3000000, tracer->incremental_marking_bytes_); | 266 EXPECT_EQ(3000000u, tracer->incremental_marking_bytes_); |
267 EXPECT_EQ(1000000 / 100, | 267 EXPECT_EQ(1000000 / 100, |
268 tracer->IncrementalMarkingSpeedInBytesPerMillisecond()); | 268 tracer->IncrementalMarkingSpeedInBytesPerMillisecond()); |
269 tracer->Start(MARK_COMPACTOR, GarbageCollectionReason::kTesting, | 269 tracer->Start(MARK_COMPACTOR, GarbageCollectionReason::kTesting, |
270 "collector unittest"); | 270 "collector unittest"); |
271 // Switch to incremental MC. | 271 // Switch to incremental MC. |
272 tracer->current_.type = GCTracer::Event::INCREMENTAL_MARK_COMPACTOR; | 272 tracer->current_.type = GCTracer::Event::INCREMENTAL_MARK_COMPACTOR; |
273 // 1000000 bytes in 100ms. | 273 // 1000000 bytes in 100ms. |
274 tracer->AddIncrementalMarkingStep(100, 1000000); | 274 tracer->AddIncrementalMarkingStep(100, 1000000); |
275 EXPECT_EQ(400, tracer->incremental_marking_duration_); | 275 EXPECT_EQ(400, tracer->incremental_marking_duration_); |
276 EXPECT_EQ(4000000, tracer->incremental_marking_bytes_); | 276 EXPECT_EQ(4000000u, tracer->incremental_marking_bytes_); |
277 tracer->Stop(MARK_COMPACTOR); | 277 tracer->Stop(MARK_COMPACTOR); |
278 EXPECT_EQ(400, tracer->current_.incremental_marking_duration); | 278 EXPECT_EQ(400, tracer->current_.incremental_marking_duration); |
279 EXPECT_EQ(4000000, tracer->current_.incremental_marking_bytes); | 279 EXPECT_EQ(4000000u, tracer->current_.incremental_marking_bytes); |
280 EXPECT_EQ(0, tracer->incremental_marking_duration_); | 280 EXPECT_EQ(0, tracer->incremental_marking_duration_); |
281 EXPECT_EQ(0, tracer->incremental_marking_bytes_); | 281 EXPECT_EQ(0u, tracer->incremental_marking_bytes_); |
282 EXPECT_EQ(1000000 / 100, | 282 EXPECT_EQ(1000000 / 100, |
283 tracer->IncrementalMarkingSpeedInBytesPerMillisecond()); | 283 tracer->IncrementalMarkingSpeedInBytesPerMillisecond()); |
284 | 284 |
285 // Round 2. | 285 // Round 2. |
286 tracer->AddIncrementalMarkingStep(2000, 1000); | 286 tracer->AddIncrementalMarkingStep(2000, 1000); |
287 tracer->Start(MARK_COMPACTOR, GarbageCollectionReason::kTesting, | 287 tracer->Start(MARK_COMPACTOR, GarbageCollectionReason::kTesting, |
288 "collector unittest"); | 288 "collector unittest"); |
289 // Switch to incremental MC. | 289 // Switch to incremental MC. |
290 tracer->current_.type = GCTracer::Event::INCREMENTAL_MARK_COMPACTOR; | 290 tracer->current_.type = GCTracer::Event::INCREMENTAL_MARK_COMPACTOR; |
291 tracer->Stop(MARK_COMPACTOR); | 291 tracer->Stop(MARK_COMPACTOR); |
292 EXPECT_DOUBLE_EQ((4000000.0 / 400 + 1000.0 / 2000) / 2, | 292 EXPECT_DOUBLE_EQ((4000000.0 / 400 + 1000.0 / 2000) / 2, |
293 static_cast<double>( | 293 static_cast<double>( |
294 tracer->IncrementalMarkingSpeedInBytesPerMillisecond())); | 294 tracer->IncrementalMarkingSpeedInBytesPerMillisecond())); |
295 } | 295 } |
296 | 296 |
297 } // namespace internal | 297 } // namespace internal |
298 } // namespace v8 | 298 } // namespace v8 |
OLD | NEW |