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

Unified Diff: test/cctest/test-heap.cc

Issue 629903003: Check if there is still time before finalizing an incremental collection. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | « src/heap/mark-compact.cc ('k') | test/unittests/heap/gc-idle-time-handler-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « src/heap/mark-compact.cc ('k') | test/unittests/heap/gc-idle-time-handler-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698