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

Side by Side Diff: test/cctest/test-api.cc

Issue 1024043003: Simplified garbage collection idle handler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
OLDNEW
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 15724 matching lines...) Expand 10 before | Expand all | Expand 10 after
15735 bool finished = false; 15735 bool finished = false;
15736 for (int i = 0; i < 200 && !finished; i++) { 15736 for (int i = 0; i < 200 && !finished; i++) {
15737 finished = env->GetIsolate()->IdleNotification(IdlePauseInMs); 15737 finished = env->GetIsolate()->IdleNotification(IdlePauseInMs);
15738 } 15738 }
15739 intptr_t final_size = CcTest::heap()->SizeOfObjects(); 15739 intptr_t final_size = CcTest::heap()->SizeOfObjects();
15740 CHECK(finished); 15740 CHECK(finished);
15741 CHECK_LT(final_size, initial_size + 1); 15741 CHECK_LT(final_size, initial_size + 1);
15742 } 15742 }
15743 15743
15744 15744
15745 // Test that idle notification can be handled and eventually collects garbage.
15746 TEST(IdleNotificationWithSmallHint) {
15747 const intptr_t MB = 1024 * 1024;
15748 const int IdlePauseInMs = 900;
15749 LocalContext env;
15750 v8::HandleScope scope(env->GetIsolate());
15751 intptr_t initial_size = CcTest::heap()->SizeOfObjects();
15752 CreateGarbageInOldSpace();
15753 intptr_t size_with_garbage = CcTest::heap()->SizeOfObjects();
15754 CHECK_GT(size_with_garbage, initial_size + MB);
15755 bool finished = false;
15756 for (int i = 0; i < 200 && !finished; i++) {
15757 finished = env->GetIsolate()->IdleNotification(IdlePauseInMs);
15758 }
15759 intptr_t final_size = CcTest::heap()->SizeOfObjects();
15760 CHECK(finished);
15761 CHECK_LT(final_size, initial_size + 1);
15762 }
15763
Hannes Payer (out of office) 2015/03/23 10:55:25 These tests are identical and do not test anything
15764
15765 // Test that idle notification can be handled and eventually collects garbage.
15766 TEST(IdleNotificationWithLargeHint) {
15767 const intptr_t MB = 1024 * 1024;
15768 const int IdlePauseInMs = 900;
15769 LocalContext env;
15770 v8::HandleScope scope(env->GetIsolate());
15771 intptr_t initial_size = CcTest::heap()->SizeOfObjects();
15772 CreateGarbageInOldSpace();
15773 intptr_t size_with_garbage = CcTest::heap()->SizeOfObjects();
15774 CHECK_GT(size_with_garbage, initial_size + MB);
15775 bool finished = false;
15776 for (int i = 0; i < 200 && !finished; i++) {
15777 finished = env->GetIsolate()->IdleNotification(IdlePauseInMs);
15778 }
15779 intptr_t final_size = CcTest::heap()->SizeOfObjects();
15780 CHECK(finished);
15781 CHECK_LT(final_size, initial_size + 1);
15782 }
15783
15784
15785 TEST(Regress2333) { 15745 TEST(Regress2333) {
15786 LocalContext env; 15746 LocalContext env;
15787 for (int i = 0; i < 3; i++) { 15747 for (int i = 0; i < 3; i++) {
15788 CcTest::heap()->CollectGarbage(i::NEW_SPACE); 15748 CcTest::heap()->CollectGarbage(i::NEW_SPACE);
15789 } 15749 }
15790 } 15750 }
15791 15751
15792 static uint32_t* stack_limit; 15752 static uint32_t* stack_limit;
15793 15753
15794 static void GetStackLimitCallback( 15754 static void GetStackLimitCallback(
(...skipping 5839 matching lines...) Expand 10 before | Expand all | Expand 10 after
21634 } 21594 }
21635 { 21595 {
21636 v8::TryCatch try_catch; 21596 v8::TryCatch try_catch;
21637 uint16_t* data = reinterpret_cast<uint16_t*>(buffer); 21597 uint16_t* data = reinterpret_cast<uint16_t*>(buffer);
21638 CHECK(v8::String::NewFromTwoByte(isolate, data, v8::String::kNormalString, 21598 CHECK(v8::String::NewFromTwoByte(isolate, data, v8::String::kNormalString,
21639 length).IsEmpty()); 21599 length).IsEmpty());
21640 CHECK(!try_catch.HasCaught()); 21600 CHECK(!try_catch.HasCaught());
21641 } 21601 }
21642 free(buffer); 21602 free(buffer);
21643 } 21603 }
OLDNEW
« src/heap/gc-idle-time-handler.cc ('K') | « src/heap/gc-idle-time-handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698