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 2165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2176 const int kLongIdlePauseInMs = 1000; | 2176 const int kLongIdlePauseInMs = 1000; |
2177 CcTest::isolate()->ContextDisposedNotification(); | 2177 CcTest::isolate()->ContextDisposedNotification(); |
2178 CcTest::isolate()->IdleNotification(kLongIdlePauseInMs); | 2178 CcTest::isolate()->IdleNotification(kLongIdlePauseInMs); |
2179 | 2179 |
2180 CHECK_EQ(CcTest::heap()->global_ic_age(), f->shared()->ic_age()); | 2180 CHECK_EQ(CcTest::heap()->global_ic_age(), f->shared()->ic_age()); |
2181 CHECK_EQ(0, f->shared()->opt_count()); | 2181 CHECK_EQ(0, f->shared()->opt_count()); |
2182 CHECK_EQ(0, f->shared()->code()->profiler_ticks()); | 2182 CHECK_EQ(0, f->shared()->code()->profiler_ticks()); |
2183 } | 2183 } |
2184 | 2184 |
2185 | 2185 |
| 2186 TEST(IdleNotificationFinishMarking) { |
| 2187 i::FLAG_allow_natives_syntax = true; |
| 2188 CcTest::InitializeVM(); |
| 2189 SimulateFullSpace(CcTest::heap()->old_pointer_space()); |
| 2190 IncrementalMarking* marking = CcTest::heap()->incremental_marking(); |
| 2191 marking->Abort(); |
| 2192 marking->Start(); |
| 2193 |
| 2194 CHECK_EQ(CcTest::heap()->gc_count(), 0); |
| 2195 |
| 2196 // TODO(hpayer): We cannot write proper unit test right now for heap. |
| 2197 // The ideal test would call kMaxIdleMarkingDelayCounter to test the |
| 2198 // marking delay counter. |
| 2199 |
| 2200 // Perform a huge incremental marking step but don't complete marking. |
| 2201 intptr_t bytes_processed = 0; |
| 2202 do { |
| 2203 bytes_processed = |
| 2204 marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
| 2205 IncrementalMarking::FORCE_MARKING, |
| 2206 IncrementalMarking::DO_NOT_FORCE_COMPLETION); |
| 2207 CHECK(!marking->IsIdleMarkingDelayCounterLimitReached()); |
| 2208 } while (bytes_processed); |
| 2209 |
| 2210 // The next invocations of incremental marking are not going to complete |
| 2211 // marking |
| 2212 // since the completion threshold is not reached |
| 2213 for (size_t i = 0; i < IncrementalMarking::kMaxIdleMarkingDelayCounter - 2; |
| 2214 i++) { |
| 2215 marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
| 2216 IncrementalMarking::FORCE_MARKING, |
| 2217 IncrementalMarking::DO_NOT_FORCE_COMPLETION); |
| 2218 CHECK(!marking->IsIdleMarkingDelayCounterLimitReached()); |
| 2219 } |
| 2220 |
| 2221 // The next idle notification has to finish incremental marking. |
| 2222 const int kShortIdleTimeInMs = 1; |
| 2223 CcTest::isolate()->IdleNotification(kShortIdleTimeInMs); |
| 2224 CHECK_EQ(CcTest::heap()->gc_count(), 1); |
| 2225 } |
| 2226 |
| 2227 |
2186 // Test that HAllocateObject will always return an object in new-space. | 2228 // Test that HAllocateObject will always return an object in new-space. |
2187 TEST(OptimizedAllocationAlwaysInNewSpace) { | 2229 TEST(OptimizedAllocationAlwaysInNewSpace) { |
2188 i::FLAG_allow_natives_syntax = true; | 2230 i::FLAG_allow_natives_syntax = true; |
2189 CcTest::InitializeVM(); | 2231 CcTest::InitializeVM(); |
2190 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2232 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
2191 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2233 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
2192 v8::HandleScope scope(CcTest::isolate()); | 2234 v8::HandleScope scope(CcTest::isolate()); |
2193 | 2235 |
2194 SimulateFullSpace(CcTest::heap()->new_space()); | 2236 SimulateFullSpace(CcTest::heap()->new_space()); |
2195 AlwaysAllocateScope always_allocate(CcTest::i_isolate()); | 2237 AlwaysAllocateScope always_allocate(CcTest::i_isolate()); |
(...skipping 2309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4505 #ifdef DEBUG | 4547 #ifdef DEBUG |
4506 TEST(PathTracer) { | 4548 TEST(PathTracer) { |
4507 CcTest::InitializeVM(); | 4549 CcTest::InitializeVM(); |
4508 v8::HandleScope scope(CcTest::isolate()); | 4550 v8::HandleScope scope(CcTest::isolate()); |
4509 | 4551 |
4510 v8::Local<v8::Value> result = CompileRun("'abc'"); | 4552 v8::Local<v8::Value> result = CompileRun("'abc'"); |
4511 Handle<Object> o = v8::Utils::OpenHandle(*result); | 4553 Handle<Object> o = v8::Utils::OpenHandle(*result); |
4512 CcTest::i_isolate()->heap()->TracePathToObject(*o); | 4554 CcTest::i_isolate()->heap()->TracePathToObject(*o); |
4513 } | 4555 } |
4514 #endif // DEBUG | 4556 #endif // DEBUG |
OLD | NEW |