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 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, | |
ulan
2014/10/13 13:40:04
"100 * MB" looks fragile, but I guess it is suffic
Hannes Payer (out of office)
2014/10/13 13:53:32
Done.
| |
2202 IncrementalMarking::FORCE_MARKING, | |
2203 IncrementalMarking::DO_NOT_FORCE_COMPLETION); | |
2204 CHECK(!marking->IsIdleMarkingDelayCounterLimitReached()); | |
2205 | |
2206 // The next invocations of incremental marking are not going to complete | |
2207 // marking | |
2208 // since the completion threshold is not reached | |
2209 for (size_t i = 0; i < IncrementalMarking::kMaxIdleMarkingDelayCounter - 1; | |
2210 i++) { | |
2211 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, | |
2212 IncrementalMarking::FORCE_MARKING, | |
2213 IncrementalMarking::DO_NOT_FORCE_COMPLETION); | |
2214 CHECK(!marking->IsIdleMarkingDelayCounterLimitReached()); | |
2215 } | |
2216 | |
2217 // The next idle notification has to finish incremental marking. | |
2218 const int kShortIdleTimeInMs = 1; | |
2219 CcTest::isolate()->IdleNotification(kShortIdleTimeInMs); | |
2220 CHECK_EQ(CcTest::heap()->gc_count(), kShortIdleTimeInMs); | |
ulan
2014/10/13 13:40:04
Did you mean CHECK_EQ(CcTest::heap()->gc_count(),
Hannes Payer (out of office)
2014/10/13 13:53:32
lol, yes. Done.
| |
2221 } | |
2222 | |
2223 | |
2186 // Test that HAllocateObject will always return an object in new-space. | 2224 // Test that HAllocateObject will always return an object in new-space. |
2187 TEST(OptimizedAllocationAlwaysInNewSpace) { | 2225 TEST(OptimizedAllocationAlwaysInNewSpace) { |
2188 i::FLAG_allow_natives_syntax = true; | 2226 i::FLAG_allow_natives_syntax = true; |
2189 CcTest::InitializeVM(); | 2227 CcTest::InitializeVM(); |
2190 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2228 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
2191 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2229 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
2192 v8::HandleScope scope(CcTest::isolate()); | 2230 v8::HandleScope scope(CcTest::isolate()); |
2193 | 2231 |
2194 SimulateFullSpace(CcTest::heap()->new_space()); | 2232 SimulateFullSpace(CcTest::heap()->new_space()); |
2195 AlwaysAllocateScope always_allocate(CcTest::i_isolate()); | 2233 AlwaysAllocateScope always_allocate(CcTest::i_isolate()); |
(...skipping 2309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4505 #ifdef DEBUG | 4543 #ifdef DEBUG |
4506 TEST(PathTracer) { | 4544 TEST(PathTracer) { |
4507 CcTest::InitializeVM(); | 4545 CcTest::InitializeVM(); |
4508 v8::HandleScope scope(CcTest::isolate()); | 4546 v8::HandleScope scope(CcTest::isolate()); |
4509 | 4547 |
4510 v8::Local<v8::Value> result = CompileRun("'abc'"); | 4548 v8::Local<v8::Value> result = CompileRun("'abc'"); |
4511 Handle<Object> o = v8::Utils::OpenHandle(*result); | 4549 Handle<Object> o = v8::Utils::OpenHandle(*result); |
4512 CcTest::i_isolate()->heap()->TracePathToObject(*o); | 4550 CcTest::i_isolate()->heap()->TracePathToObject(*o); |
4513 } | 4551 } |
4514 #endif // DEBUG | 4552 #endif // DEBUG |
OLD | NEW |