| 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 #include "v8.h" | 5 #include "v8.h" | 
| 6 #include "cpu-profiler-inl.h" | 6 #include "cpu-profiler-inl.h" | 
| 7 #include "cctest.h" | 7 #include "cctest.h" | 
| 8 #include "../include/v8-profiler.h" | 8 #include "../include/v8-profiler.h" | 
| 9 | 9 | 
| 10 using i::CodeEntry; | 10 using i::CodeEntry; | 
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 209   CHECK_EQ(1, bottom_up_ddd_stub_children->length()); | 209   CHECK_EQ(1, bottom_up_ddd_stub_children->length()); | 
| 210   CHECK_EQ("bbb", bottom_up_ddd_stub_children->last()->entry()->name()); | 210   CHECK_EQ("bbb", bottom_up_ddd_stub_children->last()->entry()->name()); | 
| 211 } | 211 } | 
| 212 | 212 | 
| 213 | 213 | 
| 214 // http://crbug/51594 | 214 // http://crbug/51594 | 
| 215 // This test must not crash. | 215 // This test must not crash. | 
| 216 TEST(CrashIfStoppingLastNonExistentProfile) { | 216 TEST(CrashIfStoppingLastNonExistentProfile) { | 
| 217   InitializeVM(); | 217   InitializeVM(); | 
| 218   TestSetup test_setup; | 218   TestSetup test_setup; | 
| 219   CpuProfiler::Setup(); | 219   CpuProfiler::SetUp(); | 
| 220   CpuProfiler::StartProfiling("1"); | 220   CpuProfiler::StartProfiling("1"); | 
| 221   CpuProfiler::StopProfiling("2"); | 221   CpuProfiler::StopProfiling("2"); | 
| 222   CpuProfiler::StartProfiling("1"); | 222   CpuProfiler::StartProfiling("1"); | 
| 223   CpuProfiler::StopProfiling(""); | 223   CpuProfiler::StopProfiling(""); | 
| 224   CpuProfiler::TearDown(); | 224   CpuProfiler::TearDown(); | 
| 225 } | 225 } | 
| 226 | 226 | 
| 227 | 227 | 
| 228 // http://code.google.com/p/v8/issues/detail?id=1398 | 228 // http://code.google.com/p/v8/issues/detail?id=1398 | 
| 229 // Long stacks (exceeding max frames limit) must not be erased. | 229 // Long stacks (exceeding max frames limit) must not be erased. | 
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 261     ++actual_depth; | 261     ++actual_depth; | 
| 262   } | 262   } | 
| 263 | 263 | 
| 264   CHECK_EQ(1 + i::TickSample::kMaxFramesCount, actual_depth);  // +1 for PC. | 264   CHECK_EQ(1 + i::TickSample::kMaxFramesCount, actual_depth);  // +1 for PC. | 
| 265 } | 265 } | 
| 266 | 266 | 
| 267 | 267 | 
| 268 TEST(DeleteAllCpuProfiles) { | 268 TEST(DeleteAllCpuProfiles) { | 
| 269   InitializeVM(); | 269   InitializeVM(); | 
| 270   TestSetup test_setup; | 270   TestSetup test_setup; | 
| 271   CpuProfiler::Setup(); | 271   CpuProfiler::SetUp(); | 
| 272   CHECK_EQ(0, CpuProfiler::GetProfilesCount()); | 272   CHECK_EQ(0, CpuProfiler::GetProfilesCount()); | 
| 273   CpuProfiler::DeleteAllProfiles(); | 273   CpuProfiler::DeleteAllProfiles(); | 
| 274   CHECK_EQ(0, CpuProfiler::GetProfilesCount()); | 274   CHECK_EQ(0, CpuProfiler::GetProfilesCount()); | 
| 275 | 275 | 
| 276   CpuProfiler::StartProfiling("1"); | 276   CpuProfiler::StartProfiling("1"); | 
| 277   CpuProfiler::StopProfiling("1"); | 277   CpuProfiler::StopProfiling("1"); | 
| 278   CHECK_EQ(1, CpuProfiler::GetProfilesCount()); | 278   CHECK_EQ(1, CpuProfiler::GetProfilesCount()); | 
| 279   CpuProfiler::DeleteAllProfiles(); | 279   CpuProfiler::DeleteAllProfiles(); | 
| 280   CHECK_EQ(0, CpuProfiler::GetProfilesCount()); | 280   CHECK_EQ(0, CpuProfiler::GetProfilesCount()); | 
| 281   CpuProfiler::StartProfiling("1"); | 281   CpuProfiler::StartProfiling("1"); | 
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 390   CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid2)); | 390   CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid2)); | 
| 391   CHECK_EQ(p3, v8::CpuProfiler::FindProfile(uid3)); | 391   CHECK_EQ(p3, v8::CpuProfiler::FindProfile(uid3)); | 
| 392   const_cast<v8::CpuProfile*>(p2)->Delete(); | 392   const_cast<v8::CpuProfile*>(p2)->Delete(); | 
| 393   CHECK_EQ(1, v8::CpuProfiler::GetProfilesCount()); | 393   CHECK_EQ(1, v8::CpuProfiler::GetProfilesCount()); | 
| 394   CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid2)); | 394   CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid2)); | 
| 395   CHECK_EQ(p3, v8::CpuProfiler::FindProfile(uid3)); | 395   CHECK_EQ(p3, v8::CpuProfiler::FindProfile(uid3)); | 
| 396   const_cast<v8::CpuProfile*>(p3)->Delete(); | 396   const_cast<v8::CpuProfile*>(p3)->Delete(); | 
| 397   CHECK_EQ(0, CpuProfiler::GetProfilesCount()); | 397   CHECK_EQ(0, CpuProfiler::GetProfilesCount()); | 
| 398   CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid3)); | 398   CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid3)); | 
| 399 } | 399 } | 
| OLD | NEW | 
|---|