| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 15 matching lines...) Expand all Loading... |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 // | 27 // |
| 28 // Tests of profiles generator and utilities. | 28 // Tests of profiles generator and utilities. |
| 29 | 29 |
| 30 #include "src/v8.h" | 30 #include "src/v8.h" |
| 31 | 31 |
| 32 #include "include/v8-profiler.h" | 32 #include "include/v8-profiler.h" |
| 33 #include "src/base/platform/platform.h" | 33 #include "src/base/platform/platform.h" |
| 34 #include "src/deoptimizer.h" | 34 #include "src/deoptimizer.h" |
| 35 #include "src/profiler/cpu-profiler-inl.h" | 35 #include "src/profiler/cpu-profiler-inl.h" |
| 36 #include "src/profiler/profiler-listener.h" |
| 36 #include "src/utils.h" | 37 #include "src/utils.h" |
| 37 #include "test/cctest/cctest.h" | 38 #include "test/cctest/cctest.h" |
| 38 #include "test/cctest/profiler-extension.h" | 39 #include "test/cctest/profiler-extension.h" |
| 39 | 40 |
| 40 using i::CodeEntry; | 41 using i::CodeEntry; |
| 41 using i::CpuProfile; | 42 using i::CpuProfile; |
| 42 using i::CpuProfiler; | 43 using i::CpuProfiler; |
| 43 using i::CpuProfilesCollection; | 44 using i::CpuProfilesCollection; |
| 44 using i::Heap; | 45 using i::Heap; |
| 45 using i::ProfileGenerator; | 46 using i::ProfileGenerator; |
| 46 using i::ProfileNode; | 47 using i::ProfileNode; |
| 47 using i::ProfilerEventsProcessor; | 48 using i::ProfilerEventsProcessor; |
| 49 using i::ProfilerListener; |
| 48 using i::ScopedVector; | 50 using i::ScopedVector; |
| 49 using i::Vector; | 51 using i::Vector; |
| 50 | 52 |
| 51 // Helper methods | 53 // Helper methods |
| 52 static v8::Local<v8::Function> GetFunction(v8::Local<v8::Context> env, | 54 static v8::Local<v8::Function> GetFunction(v8::Local<v8::Context> env, |
| 53 const char* name) { | 55 const char* name) { |
| 54 return v8::Local<v8::Function>::Cast( | 56 return v8::Local<v8::Function>::Cast( |
| 55 env->Global()->Get(env, v8_str(name)).ToLocalChecked()); | 57 env->Global()->Get(env, v8_str(name)).ToLocalChecked()); |
| 56 } | 58 } |
| 57 | 59 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 i::AbstractCode* args3_code = CreateCode(&env); | 153 i::AbstractCode* args3_code = CreateCode(&env); |
| 152 i::AbstractCode* args4_code = CreateCode(&env); | 154 i::AbstractCode* args4_code = CreateCode(&env); |
| 153 | 155 |
| 154 CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate); | 156 CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate); |
| 155 ProfileGenerator* generator = new ProfileGenerator(profiles); | 157 ProfileGenerator* generator = new ProfileGenerator(profiles); |
| 156 ProfilerEventsProcessor* processor = new ProfilerEventsProcessor( | 158 ProfilerEventsProcessor* processor = new ProfilerEventsProcessor( |
| 157 generator, nullptr, v8::base::TimeDelta::FromMicroseconds(100)); | 159 generator, nullptr, v8::base::TimeDelta::FromMicroseconds(100)); |
| 158 CpuProfiler profiler(isolate, profiles, generator, processor); | 160 CpuProfiler profiler(isolate, profiles, generator, processor); |
| 159 profiles->StartProfiling("", false); | 161 profiles->StartProfiling("", false); |
| 160 processor->Start(); | 162 processor->Start(); |
| 163 ProfilerListener* profiler_listener = new ProfilerListener(isolate); |
| 164 isolate->code_event_dispatcher()->AddListener(profiler_listener); |
| 165 profiler_listener->AddObserver(&profiler); |
| 161 | 166 |
| 162 // Enqueue code creation events. | 167 // Enqueue code creation events. |
| 163 const char* aaa_str = "aaa"; | 168 const char* aaa_str = "aaa"; |
| 164 i::Handle<i::String> aaa_name = factory->NewStringFromAsciiChecked(aaa_str); | 169 i::Handle<i::String> aaa_name = factory->NewStringFromAsciiChecked(aaa_str); |
| 165 profiler.CodeCreateEvent(i::CodeEventListener::FUNCTION_TAG, aaa_code, | 170 profiler_listener->CodeCreateEvent(i::Logger::FUNCTION_TAG, aaa_code, |
| 166 *aaa_name); | 171 *aaa_name); |
| 167 profiler.CodeCreateEvent(i::CodeEventListener::BUILTIN_TAG, comment_code, | 172 profiler_listener->CodeCreateEvent(i::Logger::BUILTIN_TAG, comment_code, |
| 168 "comment"); | 173 "comment"); |
| 169 profiler.CodeCreateEvent(i::CodeEventListener::STUB_TAG, args5_code, 5); | 174 profiler_listener->CodeCreateEvent(i::Logger::STUB_TAG, args5_code, 5); |
| 170 profiler.CodeCreateEvent(i::CodeEventListener::BUILTIN_TAG, comment2_code, | 175 profiler_listener->CodeCreateEvent(i::Logger::BUILTIN_TAG, comment2_code, |
| 171 "comment2"); | 176 "comment2"); |
| 172 profiler.CodeMoveEvent(comment2_code, moved_code->address()); | 177 profiler_listener->CodeMoveEvent(comment2_code, moved_code->address()); |
| 173 profiler.CodeCreateEvent(i::CodeEventListener::STUB_TAG, args3_code, 3); | 178 profiler_listener->CodeCreateEvent(i::Logger::STUB_TAG, args3_code, 3); |
| 174 profiler.CodeCreateEvent(i::CodeEventListener::STUB_TAG, args4_code, 4); | 179 profiler_listener->CodeCreateEvent(i::Logger::STUB_TAG, args4_code, 4); |
| 175 | 180 |
| 176 // Enqueue a tick event to enable code events processing. | 181 // Enqueue a tick event to enable code events processing. |
| 177 EnqueueTickSampleEvent(processor, aaa_code->address()); | 182 EnqueueTickSampleEvent(processor, aaa_code->address()); |
| 178 | 183 |
| 184 profiler_listener->RemoveObserver(&profiler); |
| 179 processor->StopSynchronously(); | 185 processor->StopSynchronously(); |
| 180 | 186 |
| 181 // Check the state of profile generator. | 187 // Check the state of profile generator. |
| 182 CodeEntry* aaa = generator->code_map()->FindEntry(aaa_code->address()); | 188 CodeEntry* aaa = generator->code_map()->FindEntry(aaa_code->address()); |
| 183 CHECK(aaa); | 189 CHECK(aaa); |
| 184 CHECK_EQ(0, strcmp(aaa_str, aaa->name())); | 190 CHECK_EQ(0, strcmp(aaa_str, aaa->name())); |
| 185 | 191 |
| 186 CodeEntry* comment = | 192 CodeEntry* comment = |
| 187 generator->code_map()->FindEntry(comment_code->address()); | 193 generator->code_map()->FindEntry(comment_code->address()); |
| 188 CHECK(comment); | 194 CHECK(comment); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 214 i::AbstractCode* frame2_code = CreateCode(&env); | 220 i::AbstractCode* frame2_code = CreateCode(&env); |
| 215 i::AbstractCode* frame3_code = CreateCode(&env); | 221 i::AbstractCode* frame3_code = CreateCode(&env); |
| 216 | 222 |
| 217 CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate); | 223 CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate); |
| 218 ProfileGenerator* generator = new ProfileGenerator(profiles); | 224 ProfileGenerator* generator = new ProfileGenerator(profiles); |
| 219 ProfilerEventsProcessor* processor = new ProfilerEventsProcessor( | 225 ProfilerEventsProcessor* processor = new ProfilerEventsProcessor( |
| 220 generator, nullptr, v8::base::TimeDelta::FromMicroseconds(100)); | 226 generator, nullptr, v8::base::TimeDelta::FromMicroseconds(100)); |
| 221 CpuProfiler profiler(isolate, profiles, generator, processor); | 227 CpuProfiler profiler(isolate, profiles, generator, processor); |
| 222 profiles->StartProfiling("", false); | 228 profiles->StartProfiling("", false); |
| 223 processor->Start(); | 229 processor->Start(); |
| 230 ProfilerListener* profiler_listener = new ProfilerListener(isolate); |
| 231 isolate->code_event_dispatcher()->AddListener(profiler_listener); |
| 232 profiler_listener->AddObserver(&profiler); |
| 224 | 233 |
| 225 profiler.CodeCreateEvent(i::CodeEventListener::BUILTIN_TAG, frame1_code, | 234 profiler_listener->CodeCreateEvent(i::Logger::BUILTIN_TAG, frame1_code, |
| 226 "bbb"); | 235 "bbb"); |
| 227 profiler.CodeCreateEvent(i::CodeEventListener::STUB_TAG, frame2_code, 5); | 236 profiler_listener->CodeCreateEvent(i::Logger::STUB_TAG, frame2_code, 5); |
| 228 profiler.CodeCreateEvent(i::CodeEventListener::BUILTIN_TAG, frame3_code, | 237 profiler_listener->CodeCreateEvent(i::Logger::BUILTIN_TAG, frame3_code, |
| 229 "ddd"); | 238 "ddd"); |
| 230 | 239 |
| 231 EnqueueTickSampleEvent(processor, frame1_code->instruction_start()); | 240 EnqueueTickSampleEvent(processor, frame1_code->instruction_start()); |
| 232 EnqueueTickSampleEvent( | 241 EnqueueTickSampleEvent( |
| 233 processor, | 242 processor, |
| 234 frame2_code->instruction_start() + frame2_code->ExecutableSize() / 2, | 243 frame2_code->instruction_start() + frame2_code->ExecutableSize() / 2, |
| 235 frame1_code->instruction_start() + frame2_code->ExecutableSize() / 2); | 244 frame1_code->instruction_start() + frame2_code->ExecutableSize() / 2); |
| 236 EnqueueTickSampleEvent(processor, frame3_code->instruction_end() - 1, | 245 EnqueueTickSampleEvent(processor, frame3_code->instruction_end() - 1, |
| 237 frame2_code->instruction_end() - 1, | 246 frame2_code->instruction_end() - 1, |
| 238 frame1_code->instruction_end() - 1); | 247 frame1_code->instruction_end() - 1); |
| 239 | 248 |
| 249 profiler_listener->RemoveObserver(&profiler); |
| 240 processor->StopSynchronously(); | 250 processor->StopSynchronously(); |
| 241 CpuProfile* profile = profiles->StopProfiling(""); | 251 CpuProfile* profile = profiles->StopProfiling(""); |
| 242 CHECK(profile); | 252 CHECK(profile); |
| 243 | 253 |
| 244 // Check call trees. | 254 // Check call trees. |
| 245 const i::List<ProfileNode*>* top_down_root_children = | 255 const i::List<ProfileNode*>* top_down_root_children = |
| 246 profile->top_down()->root()->children(); | 256 profile->top_down()->root()->children(); |
| 247 CHECK_EQ(1, top_down_root_children->length()); | 257 CHECK_EQ(1, top_down_root_children->length()); |
| 248 CHECK_EQ(0, strcmp("bbb", top_down_root_children->last()->entry()->name())); | 258 CHECK_EQ(0, strcmp("bbb", top_down_root_children->last()->entry()->name())); |
| 249 const i::List<ProfileNode*>* top_down_bbb_children = | 259 const i::List<ProfileNode*>* top_down_bbb_children = |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 | 291 |
| 282 i::AbstractCode* code = CreateCode(&env); | 292 i::AbstractCode* code = CreateCode(&env); |
| 283 | 293 |
| 284 CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate); | 294 CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate); |
| 285 ProfileGenerator* generator = new ProfileGenerator(profiles); | 295 ProfileGenerator* generator = new ProfileGenerator(profiles); |
| 286 ProfilerEventsProcessor* processor = new ProfilerEventsProcessor( | 296 ProfilerEventsProcessor* processor = new ProfilerEventsProcessor( |
| 287 generator, nullptr, v8::base::TimeDelta::FromMicroseconds(100)); | 297 generator, nullptr, v8::base::TimeDelta::FromMicroseconds(100)); |
| 288 CpuProfiler profiler(isolate, profiles, generator, processor); | 298 CpuProfiler profiler(isolate, profiles, generator, processor); |
| 289 profiles->StartProfiling("", false); | 299 profiles->StartProfiling("", false); |
| 290 processor->Start(); | 300 processor->Start(); |
| 301 ProfilerListener* profiler_listener = new ProfilerListener(isolate); |
| 302 isolate->code_event_dispatcher()->AddListener(profiler_listener); |
| 303 profiler_listener->AddObserver(&profiler); |
| 291 | 304 |
| 292 profiler.CodeCreateEvent(i::CodeEventListener::BUILTIN_TAG, code, "bbb"); | 305 profiler_listener->CodeCreateEvent(i::Logger::BUILTIN_TAG, code, "bbb"); |
| 293 | 306 |
| 294 i::TickSample* sample = processor->StartTickSample(); | 307 i::TickSample* sample = processor->StartTickSample(); |
| 295 sample->pc = code->address(); | 308 sample->pc = code->address(); |
| 296 sample->tos = 0; | 309 sample->tos = 0; |
| 297 sample->frames_count = i::TickSample::kMaxFramesCount; | 310 sample->frames_count = i::TickSample::kMaxFramesCount; |
| 298 for (unsigned i = 0; i < sample->frames_count; ++i) { | 311 for (unsigned i = 0; i < sample->frames_count; ++i) { |
| 299 sample->stack[i] = code->address(); | 312 sample->stack[i] = code->address(); |
| 300 } | 313 } |
| 301 processor->FinishTickSample(); | 314 processor->FinishTickSample(); |
| 302 | 315 |
| 316 profiler_listener->RemoveObserver(&profiler); |
| 303 processor->StopSynchronously(); | 317 processor->StopSynchronously(); |
| 304 CpuProfile* profile = profiles->StopProfiling(""); | 318 CpuProfile* profile = profiles->StopProfiling(""); |
| 305 CHECK(profile); | 319 CHECK(profile); |
| 306 | 320 |
| 307 unsigned actual_depth = 0; | 321 unsigned actual_depth = 0; |
| 308 const ProfileNode* node = profile->top_down()->root(); | 322 const ProfileNode* node = profile->top_down()->root(); |
| 309 while (node->children()->length() > 0) { | 323 while (node->children()->length() > 0) { |
| 310 node = node->children()->last(); | 324 node = node->children()->last(); |
| 311 ++actual_depth; | 325 ++actual_depth; |
| 312 } | 326 } |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 i::Address code_address = code->instruction_start(); | 1033 i::Address code_address = code->instruction_start(); |
| 1020 CHECK(code_address); | 1034 CHECK(code_address); |
| 1021 | 1035 |
| 1022 CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate); | 1036 CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate); |
| 1023 ProfileGenerator* generator = new ProfileGenerator(profiles); | 1037 ProfileGenerator* generator = new ProfileGenerator(profiles); |
| 1024 ProfilerEventsProcessor* processor = new ProfilerEventsProcessor( | 1038 ProfilerEventsProcessor* processor = new ProfilerEventsProcessor( |
| 1025 generator, nullptr, v8::base::TimeDelta::FromMicroseconds(100)); | 1039 generator, nullptr, v8::base::TimeDelta::FromMicroseconds(100)); |
| 1026 CpuProfiler profiler(isolate, profiles, generator, processor); | 1040 CpuProfiler profiler(isolate, profiles, generator, processor); |
| 1027 profiles->StartProfiling("", false); | 1041 profiles->StartProfiling("", false); |
| 1028 processor->Start(); | 1042 processor->Start(); |
| 1043 ProfilerListener* profiler_listener = new ProfilerListener(isolate); |
| 1044 isolate->code_event_dispatcher()->AddListener(profiler_listener); |
| 1045 profiler_listener->AddObserver(&profiler); |
| 1029 | 1046 |
| 1030 // Enqueue code creation events. | 1047 // Enqueue code creation events. |
| 1031 i::Handle<i::String> str = factory->NewStringFromAsciiChecked(func_name); | 1048 i::Handle<i::String> str = factory->NewStringFromAsciiChecked(func_name); |
| 1032 int line = 1; | 1049 int line = 1; |
| 1033 int column = 1; | 1050 int column = 1; |
| 1034 profiler.CodeCreateEvent(i::CodeEventListener::FUNCTION_TAG, code, | 1051 profiler_listener->CodeCreateEvent(i::Logger::FUNCTION_TAG, code, |
| 1035 func->shared(), *str, line, column); | 1052 func->shared(), *str, line, column); |
| 1036 | 1053 |
| 1037 // Enqueue a tick event to enable code events processing. | 1054 // Enqueue a tick event to enable code events processing. |
| 1038 EnqueueTickSampleEvent(processor, code_address); | 1055 EnqueueTickSampleEvent(processor, code_address); |
| 1039 | 1056 |
| 1057 profiler_listener->RemoveObserver(&profiler); |
| 1040 processor->StopSynchronously(); | 1058 processor->StopSynchronously(); |
| 1041 | 1059 |
| 1042 CpuProfile* profile = profiles->StopProfiling(""); | 1060 CpuProfile* profile = profiles->StopProfiling(""); |
| 1043 CHECK(profile); | 1061 CHECK(profile); |
| 1044 | 1062 |
| 1045 // Check the state of profile generator. | 1063 // Check the state of profile generator. |
| 1046 CodeEntry* func_entry = generator->code_map()->FindEntry(code_address); | 1064 CodeEntry* func_entry = generator->code_map()->FindEntry(code_address); |
| 1047 CHECK(func_entry); | 1065 CHECK(func_entry); |
| 1048 CHECK_EQ(0, strcmp(func_name, func_entry->name())); | 1066 CHECK_EQ(0, strcmp(func_name, func_entry->name())); |
| 1049 const i::JITLineInfoTable* line_info = func_entry->line_info(); | 1067 const i::JITLineInfoTable* line_info = func_entry->line_info(); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1122 int32_t duration_ms = 100; | 1140 int32_t duration_ms = 100; |
| 1123 v8::Local<v8::Value> args[] = { | 1141 v8::Local<v8::Value> args[] = { |
| 1124 v8::Integer::New(env->GetIsolate(), duration_ms)}; | 1142 v8::Integer::New(env->GetIsolate(), duration_ms)}; |
| 1125 v8::CpuProfile* profile = | 1143 v8::CpuProfile* profile = |
| 1126 RunProfiler(env.local(), function, args, arraysize(args), 1000); | 1144 RunProfiler(env.local(), function, args, arraysize(args), 1000); |
| 1127 | 1145 |
| 1128 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); | 1146 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); |
| 1129 const v8::CpuProfileNode* start_node = GetChild(env.local(), root, "start"); | 1147 const v8::CpuProfileNode* start_node = GetChild(env.local(), root, "start"); |
| 1130 GetChild(env.local(), start_node, "bar"); | 1148 GetChild(env.local(), start_node, "bar"); |
| 1131 | 1149 |
| 1132 const v8::CpuProfileNode* unresolved_node = FindChild( | 1150 const v8::CpuProfileNode* unresolved_node = |
| 1133 env.local(), root, i::ProfileGenerator::kUnresolvedFunctionName); | 1151 FindChild(env.local(), root, i::CodeEntry::kUnresolvedFunctionName); |
| 1134 CHECK(!unresolved_node || GetChild(env.local(), unresolved_node, "call")); | 1152 CHECK(!unresolved_node || GetChild(env.local(), unresolved_node, "call")); |
| 1135 | 1153 |
| 1136 profile->Delete(); | 1154 profile->Delete(); |
| 1137 } | 1155 } |
| 1138 | 1156 |
| 1139 static const char* function_apply_test_source = | 1157 static const char* function_apply_test_source = |
| 1140 "%NeverOptimizeFunction(bar);\n" | 1158 "%NeverOptimizeFunction(bar);\n" |
| 1141 "%NeverOptimizeFunction(test);\n" | 1159 "%NeverOptimizeFunction(test);\n" |
| 1142 "%NeverOptimizeFunction(start);\n" | 1160 "%NeverOptimizeFunction(start);\n" |
| 1143 "function bar(n) {\n" | 1161 "function bar(n) {\n" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1178 | 1196 |
| 1179 v8::CpuProfile* profile = | 1197 v8::CpuProfile* profile = |
| 1180 RunProfiler(env.local(), function, args, arraysize(args), 1000); | 1198 RunProfiler(env.local(), function, args, arraysize(args), 1000); |
| 1181 | 1199 |
| 1182 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); | 1200 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); |
| 1183 const v8::CpuProfileNode* start_node = GetChild(env.local(), root, "start"); | 1201 const v8::CpuProfileNode* start_node = GetChild(env.local(), root, "start"); |
| 1184 const v8::CpuProfileNode* test_node = | 1202 const v8::CpuProfileNode* test_node = |
| 1185 GetChild(env.local(), start_node, "test"); | 1203 GetChild(env.local(), start_node, "test"); |
| 1186 GetChild(env.local(), test_node, "bar"); | 1204 GetChild(env.local(), test_node, "bar"); |
| 1187 | 1205 |
| 1188 const v8::CpuProfileNode* unresolved_node = FindChild( | 1206 const v8::CpuProfileNode* unresolved_node = |
| 1189 env.local(), start_node, ProfileGenerator::kUnresolvedFunctionName); | 1207 FindChild(env.local(), start_node, CodeEntry::kUnresolvedFunctionName); |
| 1190 CHECK(!unresolved_node || GetChild(env.local(), unresolved_node, "apply")); | 1208 CHECK(!unresolved_node || GetChild(env.local(), unresolved_node, "apply")); |
| 1191 | 1209 |
| 1192 profile->Delete(); | 1210 profile->Delete(); |
| 1193 } | 1211 } |
| 1194 | 1212 |
| 1195 static const char* cpu_profiler_deep_stack_test_source = | 1213 static const char* cpu_profiler_deep_stack_test_source = |
| 1196 "function foo(n) {\n" | 1214 "function foo(n) {\n" |
| 1197 " if (n)\n" | 1215 " if (n)\n" |
| 1198 " foo(n - 1);\n" | 1216 " foo(n - 1);\n" |
| 1199 " else\n" | 1217 " else\n" |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1586 cpu_profiler->SetIdle(false); | 1604 cpu_profiler->SetIdle(false); |
| 1587 processor->AddCurrentStack(isolate, true); | 1605 processor->AddCurrentStack(isolate, true); |
| 1588 | 1606 |
| 1589 v8::CpuProfile* profile = cpu_profiler->StopProfiling(profile_name); | 1607 v8::CpuProfile* profile = cpu_profiler->StopProfiling(profile_name); |
| 1590 CHECK(profile); | 1608 CHECK(profile); |
| 1591 // Dump collected profile to have a better diagnostic in case of failure. | 1609 // Dump collected profile to have a better diagnostic in case of failure. |
| 1592 reinterpret_cast<i::CpuProfile*>(profile)->Print(); | 1610 reinterpret_cast<i::CpuProfile*>(profile)->Print(); |
| 1593 | 1611 |
| 1594 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); | 1612 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); |
| 1595 const v8::CpuProfileNode* program_node = | 1613 const v8::CpuProfileNode* program_node = |
| 1596 GetChild(env.local(), root, ProfileGenerator::kProgramEntryName); | 1614 GetChild(env.local(), root, CodeEntry::kProgramEntryName); |
| 1597 CHECK_EQ(0, program_node->GetChildrenCount()); | 1615 CHECK_EQ(0, program_node->GetChildrenCount()); |
| 1598 CHECK_GE(program_node->GetHitCount(), 2u); | 1616 CHECK_GE(program_node->GetHitCount(), 2u); |
| 1599 | 1617 |
| 1600 const v8::CpuProfileNode* idle_node = | 1618 const v8::CpuProfileNode* idle_node = |
| 1601 GetChild(env.local(), root, ProfileGenerator::kIdleEntryName); | 1619 GetChild(env.local(), root, CodeEntry::kIdleEntryName); |
| 1602 CHECK_EQ(0, idle_node->GetChildrenCount()); | 1620 CHECK_EQ(0, idle_node->GetChildrenCount()); |
| 1603 CHECK_GE(idle_node->GetHitCount(), 3u); | 1621 CHECK_GE(idle_node->GetHitCount(), 3u); |
| 1604 | 1622 |
| 1605 profile->Delete(); | 1623 profile->Delete(); |
| 1606 } | 1624 } |
| 1607 | 1625 |
| 1608 static void CheckFunctionDetails(v8::Isolate* isolate, | 1626 static void CheckFunctionDetails(v8::Isolate* isolate, |
| 1609 const v8::CpuProfileNode* node, | 1627 const v8::CpuProfileNode* node, |
| 1610 const char* name, const char* script_name, | 1628 const char* name, const char* script_name, |
| 1611 int script_id, int line, int column) { | 1629 int script_id, int line, int column) { |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2021 iprofile->Print(); | 2039 iprofile->Print(); |
| 2022 v8::CpuProfile* profile = reinterpret_cast<v8::CpuProfile*>(iprofile); | 2040 v8::CpuProfile* profile = reinterpret_cast<v8::CpuProfile*>(iprofile); |
| 2023 | 2041 |
| 2024 const char* branch[] = {"", "test"}; | 2042 const char* branch[] = {"", "test"}; |
| 2025 const ProfileNode* itest_node = | 2043 const ProfileNode* itest_node = |
| 2026 GetSimpleBranch(env, profile, branch, arraysize(branch)); | 2044 GetSimpleBranch(env, profile, branch, arraysize(branch)); |
| 2027 CHECK_EQ(0U, itest_node->deopt_infos().size()); | 2045 CHECK_EQ(0U, itest_node->deopt_infos().size()); |
| 2028 | 2046 |
| 2029 iprofiler->DeleteProfile(iprofile); | 2047 iprofiler->DeleteProfile(iprofile); |
| 2030 } | 2048 } |
| OLD | NEW |