OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // | 2 // |
3 // Tests of profiles generator and utilities. | 3 // Tests of profiles generator and utilities. |
4 | 4 |
5 #ifdef ENABLE_LOGGING_AND_PROFILING | 5 #ifdef ENABLE_LOGGING_AND_PROFILING |
6 | 6 |
7 #include "v8.h" | 7 #include "v8.h" |
8 #include "cpu-profiler-inl.h" | 8 #include "cpu-profiler-inl.h" |
9 #include "cctest.h" | 9 #include "cctest.h" |
10 | 10 |
11 namespace i = v8::internal; | 11 namespace i = v8::internal; |
12 | 12 |
13 using i::CodeEntry; | 13 using i::CodeEntry; |
14 using i::CpuProfile; | 14 using i::CpuProfile; |
| 15 using i::CpuProfiler; |
15 using i::CpuProfilesCollection; | 16 using i::CpuProfilesCollection; |
16 using i::ProfileGenerator; | 17 using i::ProfileGenerator; |
17 using i::ProfileNode; | 18 using i::ProfileNode; |
18 using i::ProfilerEventsProcessor; | 19 using i::ProfilerEventsProcessor; |
19 using i::TokenEnumerator; | 20 using i::TokenEnumerator; |
20 | 21 |
21 | 22 |
22 TEST(StartStop) { | 23 TEST(StartStop) { |
23 CpuProfilesCollection profiles; | 24 CpuProfilesCollection profiles; |
24 ProfileGenerator generator(&profiles); | 25 ProfileGenerator generator(&profiles); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 const i::List<ProfileNode*>* bottom_up_ddd_children = | 219 const i::List<ProfileNode*>* bottom_up_ddd_children = |
219 bottom_up_root_children[2]->children(); | 220 bottom_up_root_children[2]->children(); |
220 CHECK_EQ(1, bottom_up_ddd_children->length()); | 221 CHECK_EQ(1, bottom_up_ddd_children->length()); |
221 CHECK_EQ("5", bottom_up_ddd_children->last()->entry()->name()); | 222 CHECK_EQ("5", bottom_up_ddd_children->last()->entry()->name()); |
222 const i::List<ProfileNode*>* bottom_up_ddd_stub_children = | 223 const i::List<ProfileNode*>* bottom_up_ddd_stub_children = |
223 bottom_up_ddd_children->last()->children(); | 224 bottom_up_ddd_children->last()->children(); |
224 CHECK_EQ(1, bottom_up_ddd_stub_children->length()); | 225 CHECK_EQ(1, bottom_up_ddd_stub_children->length()); |
225 CHECK_EQ("bbb", bottom_up_ddd_stub_children->last()->entry()->name()); | 226 CHECK_EQ("bbb", bottom_up_ddd_stub_children->last()->entry()->name()); |
226 } | 227 } |
227 | 228 |
| 229 |
| 230 // http://crbug/51594 |
| 231 // This test must not crash. |
| 232 TEST(CrashIfStoppingLastNonExistentProfile) { |
| 233 InitializeVM(); |
| 234 TestSetup test_setup; |
| 235 CpuProfiler::Setup(); |
| 236 CpuProfiler::StartProfiling("1"); |
| 237 CpuProfiler::StopProfiling("2"); |
| 238 CpuProfiler::StartProfiling("1"); |
| 239 CpuProfiler::StopProfiling(""); |
| 240 CpuProfiler::TearDown(); |
| 241 } |
| 242 |
228 #endif // ENABLE_LOGGING_AND_PROFILING | 243 #endif // ENABLE_LOGGING_AND_PROFILING |
OLD | NEW |