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

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

Issue 1214813004: Version 4.5.95.1 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.5.95
Patch Set: Created 5 years, 5 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
« no previous file with comments | « src/heap/memory-reducer.cc ('k') | test/unittests/heap/gc-idle-time-handler-unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 15276 matching lines...) Expand 10 before | Expand all | Expand 10 after
15287 v8::HandleScope scope(CcTest::isolate()); 15287 v8::HandleScope scope(CcTest::isolate());
15288 i::AlwaysAllocateScope always_allocate(CcTest::i_isolate()); 15288 i::AlwaysAllocateScope always_allocate(CcTest::i_isolate());
15289 for (int i = 0; i < 1000; i++) { 15289 for (int i = 0; i < 1000; i++) {
15290 factory->NewFixedArray(1000, i::TENURED); 15290 factory->NewFixedArray(1000, i::TENURED);
15291 } 15291 }
15292 } 15292 }
15293 15293
15294 15294
15295 // Test that idle notification can be handled and eventually collects garbage. 15295 // Test that idle notification can be handled and eventually collects garbage.
15296 TEST(TestIdleNotification) { 15296 TEST(TestIdleNotification) {
15297 if (!i::FLAG_incremental_marking) return;
15298 const intptr_t MB = 1024 * 1024; 15297 const intptr_t MB = 1024 * 1024;
15299 const double IdlePauseInSeconds = 1.0; 15298 const double IdlePauseInSeconds = 1.0;
15300 LocalContext env; 15299 LocalContext env;
15301 v8::HandleScope scope(env->GetIsolate()); 15300 v8::HandleScope scope(env->GetIsolate());
15302 intptr_t initial_size = CcTest::heap()->SizeOfObjects(); 15301 intptr_t initial_size = CcTest::heap()->SizeOfObjects();
15303 CreateGarbageInOldSpace(); 15302 CreateGarbageInOldSpace();
15304 intptr_t size_with_garbage = CcTest::heap()->SizeOfObjects(); 15303 intptr_t size_with_garbage = CcTest::heap()->SizeOfObjects();
15305 CHECK_GT(size_with_garbage, initial_size + MB); 15304 CHECK_GT(size_with_garbage, initial_size + MB);
15306 bool finished = false; 15305 bool finished = false;
15307 for (int i = 0; i < 200 && !finished; i++) { 15306 for (int i = 0; i < 200 && !finished; i++) {
15308 if (i < 10 && CcTest::heap()->incremental_marking()->IsStopped()) {
15309 CcTest::heap()->StartIdleIncrementalMarking();
15310 }
15311 finished = env->GetIsolate()->IdleNotificationDeadline( 15307 finished = env->GetIsolate()->IdleNotificationDeadline(
15312 (v8::base::TimeTicks::HighResolutionNow().ToInternalValue() / 15308 (v8::base::TimeTicks::HighResolutionNow().ToInternalValue() /
15313 static_cast<double>(v8::base::Time::kMicrosecondsPerSecond)) + 15309 static_cast<double>(v8::base::Time::kMicrosecondsPerSecond)) +
15314 IdlePauseInSeconds); 15310 IdlePauseInSeconds);
15315 } 15311 }
15316 intptr_t final_size = CcTest::heap()->SizeOfObjects(); 15312 intptr_t final_size = CcTest::heap()->SizeOfObjects();
15317 CHECK(finished); 15313 CHECK(finished);
15318 CHECK_LT(final_size, initial_size + 1); 15314 CHECK_LT(final_size, initial_size + 1);
15319 } 15315 }
15320 15316
(...skipping 6421 matching lines...) Expand 10 before | Expand all | Expand 10 after
21742 CHECK(set->Has(env.local(), set).FromJust()); 21738 CHECK(set->Has(env.local(), set).FromJust());
21743 21739
21744 CHECK(set->Delete(env.local(), set).FromJust()); 21740 CHECK(set->Delete(env.local(), set).FromJust());
21745 CHECK_EQ(2U, set->Size()); 21741 CHECK_EQ(2U, set->Size());
21746 CHECK(!set->Has(env.local(), set).FromJust()); 21742 CHECK(!set->Has(env.local(), set).FromJust());
21747 CHECK(!set->Delete(env.local(), set).FromJust()); 21743 CHECK(!set->Delete(env.local(), set).FromJust());
21748 21744
21749 set->Clear(); 21745 set->Clear();
21750 CHECK_EQ(0U, set->Size()); 21746 CHECK_EQ(0U, set->Size());
21751 } 21747 }
OLDNEW
« no previous file with comments | « src/heap/memory-reducer.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