Chromium Code Reviews| Index: test/cctest/test-heap.cc |
| diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc |
| index ee476db6cdc4729b1a65a560fe03734a65f2bfdb..96a57227fb06fa8dd12bccb34b24939dea8b332c 100644 |
| --- a/test/cctest/test-heap.cc |
| +++ b/test/cctest/test-heap.cc |
| @@ -2183,6 +2183,44 @@ TEST(ResetSharedFunctionInfoCountersDuringMarkSweep) { |
| } |
| +TEST(IdleNotificationFinishMarking) { |
| + i::FLAG_allow_natives_syntax = true; |
| + CcTest::InitializeVM(); |
| + SimulateFullSpace(CcTest::heap()->old_pointer_space()); |
| + IncrementalMarking* marking = CcTest::heap()->incremental_marking(); |
| + marking->Abort(); |
| + marking->Start(); |
| + |
| + CHECK_EQ(CcTest::heap()->gc_count(), 0); |
| + |
| + // TODO(hpayer): We cannot write proper unit test right now for heap. |
| + // The ideal test would call kMaxIdleMarkingDelayCounter to test the |
| + // marking delay counter. |
| + |
| + // Perform a huge incremental marking step but don't complete marking. |
| + marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
|
ulan
2014/10/13 13:40:04
"100 * MB" looks fragile, but I guess it is suffic
Hannes Payer (out of office)
2014/10/13 13:53:32
Done.
|
| + IncrementalMarking::FORCE_MARKING, |
| + IncrementalMarking::DO_NOT_FORCE_COMPLETION); |
| + CHECK(!marking->IsIdleMarkingDelayCounterLimitReached()); |
| + |
| + // The next invocations of incremental marking are not going to complete |
| + // marking |
| + // since the completion threshold is not reached |
| + for (size_t i = 0; i < IncrementalMarking::kMaxIdleMarkingDelayCounter - 1; |
| + i++) { |
| + marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
| + IncrementalMarking::FORCE_MARKING, |
| + IncrementalMarking::DO_NOT_FORCE_COMPLETION); |
| + CHECK(!marking->IsIdleMarkingDelayCounterLimitReached()); |
| + } |
| + |
| + // The next idle notification has to finish incremental marking. |
| + const int kShortIdleTimeInMs = 1; |
| + CcTest::isolate()->IdleNotification(kShortIdleTimeInMs); |
| + CHECK_EQ(CcTest::heap()->gc_count(), kShortIdleTimeInMs); |
|
ulan
2014/10/13 13:40:04
Did you mean CHECK_EQ(CcTest::heap()->gc_count(),
Hannes Payer (out of office)
2014/10/13 13:53:32
lol, yes. Done.
|
| +} |
| + |
| + |
| // Test that HAllocateObject will always return an object in new-space. |
| TEST(OptimizedAllocationAlwaysInNewSpace) { |
| i::FLAG_allow_natives_syntax = true; |