OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 15345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15356 v8::HandleScope scope(CcTest::isolate()); | 15356 v8::HandleScope scope(CcTest::isolate()); |
15357 i::AlwaysAllocateScope always_allocate(CcTest::i_isolate()); | 15357 i::AlwaysAllocateScope always_allocate(CcTest::i_isolate()); |
15358 for (int i = 0; i < 1000; i++) { | 15358 for (int i = 0; i < 1000; i++) { |
15359 factory->NewFixedArray(1000, i::TENURED); | 15359 factory->NewFixedArray(1000, i::TENURED); |
15360 } | 15360 } |
15361 } | 15361 } |
15362 | 15362 |
15363 | 15363 |
15364 // Test that idle notification can be handled and eventually collects garbage. | 15364 // Test that idle notification can be handled and eventually collects garbage. |
15365 TEST(TestIdleNotification) { | 15365 TEST(TestIdleNotification) { |
| 15366 if (!i::FLAG_incremental_marking) return; |
15366 const intptr_t MB = 1024 * 1024; | 15367 const intptr_t MB = 1024 * 1024; |
15367 const double IdlePauseInSeconds = 1.0; | 15368 const double IdlePauseInSeconds = 1.0; |
15368 LocalContext env; | 15369 LocalContext env; |
15369 v8::HandleScope scope(env->GetIsolate()); | 15370 v8::HandleScope scope(env->GetIsolate()); |
15370 intptr_t initial_size = CcTest::heap()->SizeOfObjects(); | 15371 intptr_t initial_size = CcTest::heap()->SizeOfObjects(); |
15371 CreateGarbageInOldSpace(); | 15372 CreateGarbageInOldSpace(); |
15372 intptr_t size_with_garbage = CcTest::heap()->SizeOfObjects(); | 15373 intptr_t size_with_garbage = CcTest::heap()->SizeOfObjects(); |
15373 CHECK_GT(size_with_garbage, initial_size + MB); | 15374 CHECK_GT(size_with_garbage, initial_size + MB); |
15374 bool finished = false; | 15375 bool finished = false; |
15375 for (int i = 0; i < 200 && !finished; i++) { | 15376 for (int i = 0; i < 200 && !finished; i++) { |
| 15377 if (i < 10 && CcTest::heap()->incremental_marking()->IsStopped()) { |
| 15378 CcTest::heap()->StartIdleIncrementalMarking(); |
| 15379 } |
15376 finished = env->GetIsolate()->IdleNotificationDeadline( | 15380 finished = env->GetIsolate()->IdleNotificationDeadline( |
15377 (v8::base::TimeTicks::HighResolutionNow().ToInternalValue() / | 15381 (v8::base::TimeTicks::HighResolutionNow().ToInternalValue() / |
15378 static_cast<double>(v8::base::Time::kMicrosecondsPerSecond)) + | 15382 static_cast<double>(v8::base::Time::kMicrosecondsPerSecond)) + |
15379 IdlePauseInSeconds); | 15383 IdlePauseInSeconds); |
15380 } | 15384 } |
15381 intptr_t final_size = CcTest::heap()->SizeOfObjects(); | 15385 intptr_t final_size = CcTest::heap()->SizeOfObjects(); |
15382 CHECK(finished); | 15386 CHECK(finished); |
15383 CHECK_LT(final_size, initial_size + 1); | 15387 CHECK_LT(final_size, initial_size + 1); |
15384 } | 15388 } |
15385 | 15389 |
(...skipping 6274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21660 CHECK(set->Has(env.local(), set).FromJust()); | 21664 CHECK(set->Has(env.local(), set).FromJust()); |
21661 | 21665 |
21662 CHECK(set->Delete(env.local(), set).FromJust()); | 21666 CHECK(set->Delete(env.local(), set).FromJust()); |
21663 CHECK_EQ(2U, set->Size()); | 21667 CHECK_EQ(2U, set->Size()); |
21664 CHECK(!set->Has(env.local(), set).FromJust()); | 21668 CHECK(!set->Has(env.local(), set).FromJust()); |
21665 CHECK(!set->Delete(env.local(), set).FromJust()); | 21669 CHECK(!set->Delete(env.local(), set).FromJust()); |
21666 | 21670 |
21667 set->Clear(); | 21671 set->Clear(); |
21668 CHECK_EQ(0U, set->Size()); | 21672 CHECK_EQ(0U, set->Size()); |
21669 } | 21673 } |
OLD | NEW |