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 15343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15354 v8::HandleScope scope(CcTest::isolate()); | 15354 v8::HandleScope scope(CcTest::isolate()); |
15355 i::AlwaysAllocateScope always_allocate(CcTest::i_isolate()); | 15355 i::AlwaysAllocateScope always_allocate(CcTest::i_isolate()); |
15356 for (int i = 0; i < 1000; i++) { | 15356 for (int i = 0; i < 1000; i++) { |
15357 factory->NewFixedArray(1000, i::TENURED); | 15357 factory->NewFixedArray(1000, i::TENURED); |
15358 } | 15358 } |
15359 } | 15359 } |
15360 | 15360 |
15361 | 15361 |
15362 // Test that idle notification can be handled and eventually collects garbage. | 15362 // Test that idle notification can be handled and eventually collects garbage. |
15363 TEST(TestIdleNotification) { | 15363 TEST(TestIdleNotification) { |
| 15364 if (!i::FLAG_incremental_marking) return; |
15364 const intptr_t MB = 1024 * 1024; | 15365 const intptr_t MB = 1024 * 1024; |
15365 const double IdlePauseInSeconds = 1.0; | 15366 const double IdlePauseInSeconds = 1.0; |
15366 LocalContext env; | 15367 LocalContext env; |
15367 v8::HandleScope scope(env->GetIsolate()); | 15368 v8::HandleScope scope(env->GetIsolate()); |
15368 intptr_t initial_size = CcTest::heap()->SizeOfObjects(); | 15369 intptr_t initial_size = CcTest::heap()->SizeOfObjects(); |
15369 CreateGarbageInOldSpace(); | 15370 CreateGarbageInOldSpace(); |
15370 intptr_t size_with_garbage = CcTest::heap()->SizeOfObjects(); | 15371 intptr_t size_with_garbage = CcTest::heap()->SizeOfObjects(); |
15371 CHECK_GT(size_with_garbage, initial_size + MB); | 15372 CHECK_GT(size_with_garbage, initial_size + MB); |
15372 bool finished = false; | 15373 bool finished = false; |
15373 for (int i = 0; i < 200 && !finished; i++) { | 15374 for (int i = 0; i < 200 && !finished; i++) { |
| 15375 if (i < 10 && CcTest::heap()->incremental_marking()->IsStopped()) { |
| 15376 CcTest::heap()->StartIdleIncrementalMarking(); |
| 15377 } |
15374 finished = env->GetIsolate()->IdleNotificationDeadline( | 15378 finished = env->GetIsolate()->IdleNotificationDeadline( |
15375 (v8::base::TimeTicks::HighResolutionNow().ToInternalValue() / | 15379 (v8::base::TimeTicks::HighResolutionNow().ToInternalValue() / |
15376 static_cast<double>(v8::base::Time::kMicrosecondsPerSecond)) + | 15380 static_cast<double>(v8::base::Time::kMicrosecondsPerSecond)) + |
15377 IdlePauseInSeconds); | 15381 IdlePauseInSeconds); |
15378 } | 15382 } |
15379 intptr_t final_size = CcTest::heap()->SizeOfObjects(); | 15383 intptr_t final_size = CcTest::heap()->SizeOfObjects(); |
15380 CHECK(finished); | 15384 CHECK(finished); |
15381 CHECK_LT(final_size, initial_size + 1); | 15385 CHECK_LT(final_size, initial_size + 1); |
15382 } | 15386 } |
15383 | 15387 |
(...skipping 6460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21844 " fake.age;\n" | 21848 " fake.age;\n" |
21845 " result = 1;\n" | 21849 " result = 1;\n" |
21846 " } catch (e) {\n" | 21850 " } catch (e) {\n" |
21847 " }\n" | 21851 " }\n" |
21848 " test(d+1);\n" | 21852 " test(d+1);\n" |
21849 "}\n" | 21853 "}\n" |
21850 "test(0);\n" | 21854 "test(0);\n" |
21851 "result;\n", | 21855 "result;\n", |
21852 0); | 21856 0); |
21853 } | 21857 } |
OLD | NEW |