| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 70   } | 70   } | 
| 71 | 71 | 
| 72  private: | 72  private: | 
| 73   bool old_flag_prof_browser_mode_; | 73   bool old_flag_prof_browser_mode_; | 
| 74 }; | 74 }; | 
| 75 | 75 | 
| 76 }  // namespace | 76 }  // namespace | 
| 77 | 77 | 
| 78 TEST(CodeEvents) { | 78 TEST(CodeEvents) { | 
| 79   InitializeVM(); | 79   InitializeVM(); | 
|  | 80   i::Isolate* isolate = i::Isolate::Current(); | 
|  | 81   i::Heap* heap = isolate->heap(); | 
|  | 82   i::Factory* factory = isolate->factory(); | 
| 80   TestSetup test_setup; | 83   TestSetup test_setup; | 
| 81   CpuProfilesCollection profiles; | 84   CpuProfilesCollection profiles; | 
| 82   profiles.StartProfiling("", 1); | 85   profiles.StartProfiling("", 1); | 
| 83   ProfileGenerator generator(&profiles); | 86   ProfileGenerator generator(&profiles); | 
| 84   ProfilerEventsProcessor processor(&generator); | 87   ProfilerEventsProcessor processor(&generator); | 
| 85   processor.Start(); | 88   processor.Start(); | 
| 86 | 89 | 
| 87   // Enqueue code creation events. | 90   // Enqueue code creation events. | 
| 88   i::HandleScope scope; | 91   i::HandleScope scope(isolate); | 
| 89   const char* aaa_str = "aaa"; | 92   const char* aaa_str = "aaa"; | 
| 90   i::Handle<i::String> aaa_name = FACTORY->NewStringFromAscii( | 93   i::Handle<i::String> aaa_name = factory->NewStringFromAscii( | 
| 91       i::Vector<const char>(aaa_str, i::StrLength(aaa_str))); | 94       i::Vector<const char>(aaa_str, i::StrLength(aaa_str))); | 
| 92   processor.CodeCreateEvent(i::Logger::FUNCTION_TAG, | 95   processor.CodeCreateEvent(i::Logger::FUNCTION_TAG, | 
| 93                             *aaa_name, | 96                             *aaa_name, | 
| 94                             HEAP->empty_string(), | 97                             heap->empty_string(), | 
| 95                             0, | 98                             0, | 
| 96                             ToAddress(0x1000), | 99                             ToAddress(0x1000), | 
| 97                             0x100, | 100                             0x100, | 
| 98                             ToAddress(0x10000)); | 101                             ToAddress(0x10000)); | 
| 99   processor.CodeCreateEvent(i::Logger::BUILTIN_TAG, | 102   processor.CodeCreateEvent(i::Logger::BUILTIN_TAG, | 
| 100                             "bbb", | 103                             "bbb", | 
| 101                             ToAddress(0x1200), | 104                             ToAddress(0x1200), | 
| 102                             0x80); | 105                             0x80); | 
| 103   processor.CodeCreateEvent(i::Logger::STUB_TAG, 5, ToAddress(0x1300), 0x10); | 106   processor.CodeCreateEvent(i::Logger::STUB_TAG, 5, ToAddress(0x1300), 0x10); | 
| 104   processor.CodeCreateEvent(i::Logger::BUILTIN_TAG, | 107   processor.CodeCreateEvent(i::Logger::BUILTIN_TAG, | 
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 390   CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid2)); | 393   CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid2)); | 
| 391   CHECK_EQ(p3, v8::CpuProfiler::FindProfile(uid3)); | 394   CHECK_EQ(p3, v8::CpuProfiler::FindProfile(uid3)); | 
| 392   const_cast<v8::CpuProfile*>(p2)->Delete(); | 395   const_cast<v8::CpuProfile*>(p2)->Delete(); | 
| 393   CHECK_EQ(1, v8::CpuProfiler::GetProfilesCount()); | 396   CHECK_EQ(1, v8::CpuProfiler::GetProfilesCount()); | 
| 394   CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid2)); | 397   CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid2)); | 
| 395   CHECK_EQ(p3, v8::CpuProfiler::FindProfile(uid3)); | 398   CHECK_EQ(p3, v8::CpuProfiler::FindProfile(uid3)); | 
| 396   const_cast<v8::CpuProfile*>(p3)->Delete(); | 399   const_cast<v8::CpuProfile*>(p3)->Delete(); | 
| 397   CHECK_EQ(0, CpuProfiler::GetProfilesCount()); | 400   CHECK_EQ(0, CpuProfiler::GetProfilesCount()); | 
| 398   CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid3)); | 401   CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid3)); | 
| 399 } | 402 } | 
| OLD | NEW | 
|---|