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

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..969fd8824d2b20ed76bac324a4a91d8535af9b21 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -2183,6 +2183,48 @@ 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.
+ intptr_t bytes_processed = 0;
+ do {
+ bytes_processed =
+ marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
+ IncrementalMarking::FORCE_MARKING,
+ IncrementalMarking::DO_NOT_FORCE_COMPLETION);
+ CHECK(!marking->IsIdleMarkingDelayCounterLimitReached());
+ } while (bytes_processed);
+
+ // 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 - 2;
+ i++) {
+ marking->Step(1 * 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(), 1);
+}
+
+
// 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