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 17803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17814 finished = env->GetIsolate()->IdleNotification(IdlePauseInMs); | 17814 finished = env->GetIsolate()->IdleNotification(IdlePauseInMs); |
17815 } | 17815 } |
17816 intptr_t final_size = CcTest::heap()->SizeOfObjects(); | 17816 intptr_t final_size = CcTest::heap()->SizeOfObjects(); |
17817 CHECK(finished); | 17817 CHECK(finished); |
17818 CHECK_LT(final_size, initial_size + 1); | 17818 CHECK_LT(final_size, initial_size + 1); |
17819 } | 17819 } |
17820 | 17820 |
17821 | 17821 |
17822 TEST(Regress2107) { | 17822 TEST(Regress2107) { |
17823 const intptr_t MB = 1024 * 1024; | 17823 const intptr_t MB = 1024 * 1024; |
17824 const int kShortIdlePauseInMs = 100; | 17824 const int kIdlePauseInMs = 1000; |
17825 const int kLongIdlePauseInMs = 1000; | |
17826 LocalContext env; | 17825 LocalContext env; |
17827 v8::Isolate* isolate = env->GetIsolate(); | 17826 v8::Isolate* isolate = env->GetIsolate(); |
17828 v8::HandleScope scope(env->GetIsolate()); | 17827 v8::HandleScope scope(env->GetIsolate()); |
17829 intptr_t initial_size = CcTest::heap()->SizeOfObjects(); | 17828 intptr_t initial_size = CcTest::heap()->SizeOfObjects(); |
17830 // Send idle notification to start a round of incremental GCs. | 17829 // Send idle notification to start a round of incremental GCs. |
17831 env->GetIsolate()->IdleNotification(kShortIdlePauseInMs); | 17830 env->GetIsolate()->IdleNotification(kIdlePauseInMs); |
17832 // Emulate 7 page reloads. | 17831 // Emulate 7 page reloads. |
17833 for (int i = 0; i < 7; i++) { | 17832 for (int i = 0; i < 7; i++) { |
17834 { | 17833 { |
17835 v8::HandleScope inner_scope(env->GetIsolate()); | 17834 v8::HandleScope inner_scope(env->GetIsolate()); |
17836 v8::Local<v8::Context> ctx = v8::Context::New(isolate); | 17835 v8::Local<v8::Context> ctx = v8::Context::New(isolate); |
17837 ctx->Enter(); | 17836 ctx->Enter(); |
17838 CreateGarbageInOldSpace(); | 17837 CreateGarbageInOldSpace(); |
17839 ctx->Exit(); | 17838 ctx->Exit(); |
17840 } | 17839 } |
17841 env->GetIsolate()->ContextDisposedNotification(); | 17840 env->GetIsolate()->ContextDisposedNotification(); |
17842 env->GetIsolate()->IdleNotification(kLongIdlePauseInMs); | 17841 env->GetIsolate()->IdleNotification(kIdlePauseInMs); |
17843 } | 17842 } |
17844 // Create garbage and check that idle notification still collects it. | 17843 // Create garbage and check that idle notification still collects it. |
17845 CreateGarbageInOldSpace(); | 17844 CreateGarbageInOldSpace(); |
17846 intptr_t size_with_garbage = CcTest::heap()->SizeOfObjects(); | 17845 intptr_t size_with_garbage = CcTest::heap()->SizeOfObjects(); |
17847 CHECK_GT(size_with_garbage, initial_size + MB); | 17846 CHECK_GT(size_with_garbage, initial_size + MB); |
17848 bool finished = false; | 17847 bool finished = false; |
17849 for (int i = 0; i < 200 && !finished; i++) { | 17848 for (int i = 0; i < 200 && !finished; i++) { |
17850 finished = env->GetIsolate()->IdleNotification(kShortIdlePauseInMs); | 17849 finished = env->GetIsolate()->IdleNotification(kIdlePauseInMs); |
17851 } | 17850 } |
17852 intptr_t final_size = CcTest::heap()->SizeOfObjects(); | 17851 intptr_t final_size = CcTest::heap()->SizeOfObjects(); |
17853 CHECK_LT(final_size, initial_size + 1); | 17852 CHECK_LT(final_size, initial_size + 1); |
17854 } | 17853 } |
17855 | 17854 |
17856 | 17855 |
17857 TEST(Regress2333) { | 17856 TEST(Regress2333) { |
17858 LocalContext env; | 17857 LocalContext env; |
17859 for (int i = 0; i < 3; i++) { | 17858 for (int i = 0; i < 3; i++) { |
17860 CcTest::heap()->CollectGarbage(i::NEW_SPACE); | 17859 CcTest::heap()->CollectGarbage(i::NEW_SPACE); |
(...skipping 5485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
23346 // TestSourceStream::GetMoreData won't block, so it's OK to just run the | 23345 // TestSourceStream::GetMoreData won't block, so it's OK to just run the |
23347 // task here in the main thread. | 23346 // task here in the main thread. |
23348 task->Run(); | 23347 task->Run(); |
23349 delete task; | 23348 delete task; |
23350 | 23349 |
23351 const v8::ScriptCompiler::CachedData* cached_data = source.GetCachedData(); | 23350 const v8::ScriptCompiler::CachedData* cached_data = source.GetCachedData(); |
23352 CHECK(cached_data != NULL); | 23351 CHECK(cached_data != NULL); |
23353 CHECK(cached_data->data != NULL); | 23352 CHECK(cached_data->data != NULL); |
23354 CHECK_GT(cached_data->length, 0); | 23353 CHECK_GT(cached_data->length, 0); |
23355 } | 23354 } |
OLD | NEW |