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

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

Issue 1105293004: Add mode to reduce memory usage in idle notification. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add checks in tests Created 5 years, 7 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/heap.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 2225 matching lines...) Expand 10 before | Expand all | Expand 10 after
2236 } 2236 }
2237 Handle<JSFunction> f = 2237 Handle<JSFunction> f =
2238 v8::Utils::OpenHandle( 2238 v8::Utils::OpenHandle(
2239 *v8::Handle<v8::Function>::Cast( 2239 *v8::Handle<v8::Function>::Cast(
2240 CcTest::global()->Get(v8_str("f")))); 2240 CcTest::global()->Get(v8_str("f"))));
2241 CHECK(f->IsOptimized()); 2241 CHECK(f->IsOptimized());
2242 2242
2243 IncrementalMarking* marking = CcTest::heap()->incremental_marking(); 2243 IncrementalMarking* marking = CcTest::heap()->incremental_marking();
2244 marking->Abort(); 2244 marking->Abort();
2245 marking->Start(); 2245 marking->Start();
2246 2246 // The following calls will increment CcTest::heap()->global_ic_age().
2247 // The following two calls will increment CcTest::heap()->global_ic_age().
2248 const double kLongIdlePauseInSeconds = 1.0;
2249 CcTest::isolate()->ContextDisposedNotification(); 2247 CcTest::isolate()->ContextDisposedNotification();
2250 CcTest::isolate()->IdleNotificationDeadline( 2248 SimulateIncrementalMarking(CcTest::heap());
2251 (v8::base::TimeTicks::HighResolutionNow().ToInternalValue() / 2249 CcTest::heap()->CollectAllGarbage();
2252 static_cast<double>(v8::base::Time::kMicrosecondsPerSecond)) +
2253 kLongIdlePauseInSeconds);
2254
2255 while (!marking->IsStopped() && !marking->IsComplete()) {
2256 marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD);
2257 }
2258 if (!marking->IsStopped() || marking->should_hurry()) {
2259 // We don't normally finish a GC via Step(), we normally finish by
2260 // setting the stack guard and then do the final steps in the stack
2261 // guard interrupt. But here we didn't ask for that, and there is no
2262 // JS code running to trigger the interrupt, so we explicitly finalize
2263 // here.
2264 CcTest::heap()->CollectAllGarbage(Heap::kFinalizeIncrementalMarkingMask,
2265 "Test finalizing incremental mark-sweep");
2266 }
2267
2268 CHECK_EQ(CcTest::heap()->global_ic_age(), f->shared()->ic_age()); 2250 CHECK_EQ(CcTest::heap()->global_ic_age(), f->shared()->ic_age());
2269 CHECK_EQ(0, f->shared()->opt_count()); 2251 CHECK_EQ(0, f->shared()->opt_count());
2270 CHECK_EQ(0, f->shared()->code()->profiler_ticks()); 2252 CHECK_EQ(0, f->shared()->code()->profiler_ticks());
2271 } 2253 }
2272 2254
2273 2255
2274 TEST(ResetSharedFunctionInfoCountersDuringMarkSweep) { 2256 TEST(ResetSharedFunctionInfoCountersDuringMarkSweep) {
2275 i::FLAG_stress_compaction = false; 2257 i::FLAG_stress_compaction = false;
2276 i::FLAG_allow_natives_syntax = true; 2258 i::FLAG_allow_natives_syntax = true;
2277 #ifdef VERIFY_HEAP 2259 #ifdef VERIFY_HEAP
(...skipping 18 matching lines...) Expand all
2296 } 2278 }
2297 Handle<JSFunction> f = 2279 Handle<JSFunction> f =
2298 v8::Utils::OpenHandle( 2280 v8::Utils::OpenHandle(
2299 *v8::Handle<v8::Function>::Cast( 2281 *v8::Handle<v8::Function>::Cast(
2300 CcTest::global()->Get(v8_str("f")))); 2282 CcTest::global()->Get(v8_str("f"))));
2301 CHECK(f->IsOptimized()); 2283 CHECK(f->IsOptimized());
2302 2284
2303 CcTest::heap()->incremental_marking()->Abort(); 2285 CcTest::heap()->incremental_marking()->Abort();
2304 2286
2305 // The following two calls will increment CcTest::heap()->global_ic_age(). 2287 // The following two calls will increment CcTest::heap()->global_ic_age().
2306 // Since incremental marking is off, IdleNotification will do full GC.
2307 const double kLongIdlePauseInSeconds = 1.0;
2308 CcTest::isolate()->ContextDisposedNotification(); 2288 CcTest::isolate()->ContextDisposedNotification();
2309 CcTest::isolate()->IdleNotificationDeadline( 2289 CcTest::heap()->CollectAllGarbage();
2310 (v8::base::TimeTicks::HighResolutionNow().ToInternalValue() /
2311 static_cast<double>(v8::base::Time::kMicrosecondsPerSecond)) +
2312 kLongIdlePauseInSeconds);
2313 2290
2314 CHECK_EQ(CcTest::heap()->global_ic_age(), f->shared()->ic_age()); 2291 CHECK_EQ(CcTest::heap()->global_ic_age(), f->shared()->ic_age());
2315 CHECK_EQ(0, f->shared()->opt_count()); 2292 CHECK_EQ(0, f->shared()->opt_count());
2316 CHECK_EQ(0, f->shared()->code()->profiler_ticks()); 2293 CHECK_EQ(0, f->shared()->code()->profiler_ticks());
2317 } 2294 }
2318 2295
2319 2296
2320 TEST(IdleNotificationFinishMarking) { 2297 TEST(IdleNotificationFinishMarking) {
2321 i::FLAG_allow_natives_syntax = true; 2298 i::FLAG_allow_natives_syntax = true;
2322 CcTest::InitializeVM(); 2299 CcTest::InitializeVM();
(...skipping 3088 matching lines...) Expand 10 before | Expand all | Expand 10 after
5411 CHECK(pos->IsSmi()); 5388 CHECK(pos->IsSmi());
5412 5389
5413 Handle<JSArray> stack_trace_array = Handle<JSArray>::cast(stack_trace); 5390 Handle<JSArray> stack_trace_array = Handle<JSArray>::cast(stack_trace);
5414 int array_length = Smi::cast(stack_trace_array->length())->value(); 5391 int array_length = Smi::cast(stack_trace_array->length())->value();
5415 for (int i = 0; i < array_length; i++) { 5392 for (int i = 0; i < array_length; i++) {
5416 Handle<Object> element = 5393 Handle<Object> element =
5417 Object::GetElement(isolate, stack_trace, i).ToHandleChecked(); 5394 Object::GetElement(isolate, stack_trace, i).ToHandleChecked();
5418 CHECK(!element->IsCode()); 5395 CHECK(!element->IsCode());
5419 } 5396 }
5420 } 5397 }
OLDNEW
« no previous file with comments | « src/heap/heap.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