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 2222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2233 v8::Utils::OpenHandle( | 2233 v8::Utils::OpenHandle( |
2234 *v8::Handle<v8::Function>::Cast( | 2234 *v8::Handle<v8::Function>::Cast( |
2235 CcTest::global()->Get(v8_str("f")))); | 2235 CcTest::global()->Get(v8_str("f")))); |
2236 CHECK(f->IsOptimized()); | 2236 CHECK(f->IsOptimized()); |
2237 | 2237 |
2238 IncrementalMarking* marking = CcTest::heap()->incremental_marking(); | 2238 IncrementalMarking* marking = CcTest::heap()->incremental_marking(); |
2239 marking->Abort(); | 2239 marking->Abort(); |
2240 marking->Start(); | 2240 marking->Start(); |
2241 | 2241 |
2242 // The following two calls will increment CcTest::heap()->global_ic_age(). | 2242 // The following two calls will increment CcTest::heap()->global_ic_age(). |
2243 const int kLongIdlePauseInMs = 1000; | 2243 const double kLongIdlePauseInSeconds = 1.0; |
2244 CcTest::isolate()->ContextDisposedNotification(); | 2244 CcTest::isolate()->ContextDisposedNotification(); |
2245 CcTest::isolate()->IdleNotification(kLongIdlePauseInMs); | 2245 CcTest::isolate()->IdleNotificationDeadline( |
| 2246 (v8::base::TimeTicks::HighResolutionNow().ToInternalValue() / |
| 2247 static_cast<double>(v8::base::Time::kMicrosecondsPerSecond)) + |
| 2248 kLongIdlePauseInSeconds); |
2246 | 2249 |
2247 while (!marking->IsStopped() && !marking->IsComplete()) { | 2250 while (!marking->IsStopped() && !marking->IsComplete()) { |
2248 marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 2251 marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); |
2249 } | 2252 } |
2250 if (!marking->IsStopped() || marking->should_hurry()) { | 2253 if (!marking->IsStopped() || marking->should_hurry()) { |
2251 // We don't normally finish a GC via Step(), we normally finish by | 2254 // We don't normally finish a GC via Step(), we normally finish by |
2252 // setting the stack guard and then do the final steps in the stack | 2255 // setting the stack guard and then do the final steps in the stack |
2253 // guard interrupt. But here we didn't ask for that, and there is no | 2256 // guard interrupt. But here we didn't ask for that, and there is no |
2254 // JS code running to trigger the interrupt, so we explicitly finalize | 2257 // JS code running to trigger the interrupt, so we explicitly finalize |
2255 // here. | 2258 // here. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2289 Handle<JSFunction> f = | 2292 Handle<JSFunction> f = |
2290 v8::Utils::OpenHandle( | 2293 v8::Utils::OpenHandle( |
2291 *v8::Handle<v8::Function>::Cast( | 2294 *v8::Handle<v8::Function>::Cast( |
2292 CcTest::global()->Get(v8_str("f")))); | 2295 CcTest::global()->Get(v8_str("f")))); |
2293 CHECK(f->IsOptimized()); | 2296 CHECK(f->IsOptimized()); |
2294 | 2297 |
2295 CcTest::heap()->incremental_marking()->Abort(); | 2298 CcTest::heap()->incremental_marking()->Abort(); |
2296 | 2299 |
2297 // The following two calls will increment CcTest::heap()->global_ic_age(). | 2300 // The following two calls will increment CcTest::heap()->global_ic_age(). |
2298 // Since incremental marking is off, IdleNotification will do full GC. | 2301 // Since incremental marking is off, IdleNotification will do full GC. |
2299 const int kLongIdlePauseInMs = 1000; | 2302 const double kLongIdlePauseInSeconds = 1.0; |
2300 CcTest::isolate()->ContextDisposedNotification(); | 2303 CcTest::isolate()->ContextDisposedNotification(); |
2301 CcTest::isolate()->IdleNotification(kLongIdlePauseInMs); | 2304 CcTest::isolate()->IdleNotificationDeadline( |
| 2305 (v8::base::TimeTicks::HighResolutionNow().ToInternalValue() / |
| 2306 static_cast<double>(v8::base::Time::kMicrosecondsPerSecond)) + |
| 2307 kLongIdlePauseInSeconds); |
2302 | 2308 |
2303 CHECK_EQ(CcTest::heap()->global_ic_age(), f->shared()->ic_age()); | 2309 CHECK_EQ(CcTest::heap()->global_ic_age(), f->shared()->ic_age()); |
2304 CHECK_EQ(0, f->shared()->opt_count()); | 2310 CHECK_EQ(0, f->shared()->opt_count()); |
2305 CHECK_EQ(0, f->shared()->code()->profiler_ticks()); | 2311 CHECK_EQ(0, f->shared()->code()->profiler_ticks()); |
2306 } | 2312 } |
2307 | 2313 |
2308 | 2314 |
2309 TEST(IdleNotificationFinishMarking) { | 2315 TEST(IdleNotificationFinishMarking) { |
2310 i::FLAG_allow_natives_syntax = true; | 2316 i::FLAG_allow_natives_syntax = true; |
2311 CcTest::InitializeVM(); | 2317 CcTest::InitializeVM(); |
(...skipping 25 matching lines...) Expand all Loading... |
2337 i++) { | 2343 i++) { |
2338 marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 2344 marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
2339 IncrementalMarking::FORCE_MARKING, | 2345 IncrementalMarking::FORCE_MARKING, |
2340 IncrementalMarking::DO_NOT_FORCE_COMPLETION); | 2346 IncrementalMarking::DO_NOT_FORCE_COMPLETION); |
2341 CHECK(!marking->IsIdleMarkingDelayCounterLimitReached()); | 2347 CHECK(!marking->IsIdleMarkingDelayCounterLimitReached()); |
2342 } | 2348 } |
2343 | 2349 |
2344 marking->SetWeakClosureWasOverApproximatedForTesting(true); | 2350 marking->SetWeakClosureWasOverApproximatedForTesting(true); |
2345 | 2351 |
2346 // The next idle notification has to finish incremental marking. | 2352 // The next idle notification has to finish incremental marking. |
2347 const int kLongIdleTime = 1000000; | 2353 const double kLongIdleTime = 1000.0; |
2348 CcTest::isolate()->IdleNotification(kLongIdleTime); | 2354 CcTest::isolate()->IdleNotificationDeadline( |
| 2355 (v8::base::TimeTicks::HighResolutionNow().ToInternalValue() / |
| 2356 static_cast<double>(v8::base::Time::kMicrosecondsPerSecond)) + |
| 2357 kLongIdleTime); |
2349 CHECK_EQ(CcTest::heap()->gc_count(), 1); | 2358 CHECK_EQ(CcTest::heap()->gc_count(), 1); |
2350 } | 2359 } |
2351 | 2360 |
2352 | 2361 |
2353 // Test that HAllocateObject will always return an object in new-space. | 2362 // Test that HAllocateObject will always return an object in new-space. |
2354 TEST(OptimizedAllocationAlwaysInNewSpace) { | 2363 TEST(OptimizedAllocationAlwaysInNewSpace) { |
2355 i::FLAG_allow_natives_syntax = true; | 2364 i::FLAG_allow_natives_syntax = true; |
2356 CcTest::InitializeVM(); | 2365 CcTest::InitializeVM(); |
2357 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2366 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
2358 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2367 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
(...skipping 2753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5112 | 5121 |
5113 TEST(WritableVsImmortalRoots) { | 5122 TEST(WritableVsImmortalRoots) { |
5114 for (int i = 0; i < Heap::kStrongRootListLength; ++i) { | 5123 for (int i = 0; i < Heap::kStrongRootListLength; ++i) { |
5115 Heap::RootListIndex root_index = static_cast<Heap::RootListIndex>(i); | 5124 Heap::RootListIndex root_index = static_cast<Heap::RootListIndex>(i); |
5116 bool writable = Heap::RootCanBeWrittenAfterInitialization(root_index); | 5125 bool writable = Heap::RootCanBeWrittenAfterInitialization(root_index); |
5117 bool immortal = Heap::RootIsImmortalImmovable(root_index); | 5126 bool immortal = Heap::RootIsImmortalImmovable(root_index); |
5118 // A root value can be writable, immortal, or neither, but not both. | 5127 // A root value can be writable, immortal, or neither, but not both. |
5119 CHECK(!immortal || !writable); | 5128 CHECK(!immortal || !writable); |
5120 } | 5129 } |
5121 } | 5130 } |
OLD | NEW |