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 16 matching lines...) Expand all Loading... |
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/base/smart-pointers.h" | 34 #include "src/base/smart-pointers.h" |
35 #include "src/deoptimizer.h" | 35 #include "src/deoptimizer.h" |
36 #include "src/profiler/cpu-profiler-inl.h" | 36 #include "src/profiler/cpu-profiler-inl.h" |
| 37 #include "src/profiler/profiler-listener.h" |
37 #include "src/utils.h" | 38 #include "src/utils.h" |
38 #include "test/cctest/cctest.h" | 39 #include "test/cctest/cctest.h" |
39 #include "test/cctest/profiler-extension.h" | 40 #include "test/cctest/profiler-extension.h" |
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 using v8::base::SmartPointer; | 52 using v8::base::SmartPointer; |
51 | 53 |
52 | 54 |
53 // Helper methods | 55 // Helper methods |
54 static v8::Local<v8::Function> GetFunction(v8::Local<v8::Context> env, | 56 static v8::Local<v8::Function> GetFunction(v8::Local<v8::Context> env, |
55 const char* name) { | 57 const char* name) { |
56 return v8::Local<v8::Function>::Cast( | 58 return v8::Local<v8::Function>::Cast( |
57 env->Global()->Get(env, v8_str(name)).ToLocalChecked()); | 59 env->Global()->Get(env, v8_str(name)).ToLocalChecked()); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 i::AbstractCode* args3_code = CreateCode(&env); | 159 i::AbstractCode* args3_code = CreateCode(&env); |
158 i::AbstractCode* args4_code = CreateCode(&env); | 160 i::AbstractCode* args4_code = CreateCode(&env); |
159 | 161 |
160 CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate->heap()); | 162 CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate->heap()); |
161 profiles->StartProfiling("", false); | 163 profiles->StartProfiling("", false); |
162 ProfileGenerator generator(profiles); | 164 ProfileGenerator generator(profiles); |
163 SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor( | 165 SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor( |
164 &generator, NULL, v8::base::TimeDelta::FromMicroseconds(100))); | 166 &generator, NULL, v8::base::TimeDelta::FromMicroseconds(100))); |
165 processor->Start(); | 167 processor->Start(); |
166 CpuProfiler profiler(isolate, profiles, &generator, processor.get()); | 168 CpuProfiler profiler(isolate, profiles, &generator, processor.get()); |
| 169 ProfilerListener* profiler_listener = |
| 170 profiler.isolate()->logger()->profiler_listener(); |
| 171 profiler_listener->RegisterObserver(&profiler); |
| 172 profiler_listener->ResolveCodeEvent(); |
167 | 173 |
168 // Enqueue code creation events. | 174 // Enqueue code creation events. |
169 const char* aaa_str = "aaa"; | 175 const char* aaa_str = "aaa"; |
170 i::Handle<i::String> aaa_name = factory->NewStringFromAsciiChecked(aaa_str); | 176 i::Handle<i::String> aaa_name = factory->NewStringFromAsciiChecked(aaa_str); |
171 profiler.CodeCreateEvent(i::Logger::FUNCTION_TAG, aaa_code, *aaa_name); | 177 profiler_listener->CodeCreateEvent(i::Logger::FUNCTION_TAG, aaa_code, |
172 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, comment_code, "comment"); | 178 *aaa_name); |
173 profiler.CodeCreateEvent(i::Logger::STUB_TAG, args5_code, 5); | 179 profiler_listener->CodeCreateEvent(i::Logger::BUILTIN_TAG, comment_code, |
174 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, comment2_code, "comment2"); | 180 "comment"); |
175 profiler.CodeMoveEvent(comment2_code, moved_code->address()); | 181 profiler_listener->CodeCreateEvent(i::Logger::STUB_TAG, args5_code, 5); |
176 profiler.CodeCreateEvent(i::Logger::STUB_TAG, args3_code, 3); | 182 profiler_listener->CodeCreateEvent(i::Logger::BUILTIN_TAG, comment2_code, |
177 profiler.CodeCreateEvent(i::Logger::STUB_TAG, args4_code, 4); | 183 "comment2"); |
| 184 profiler_listener->CodeMoveEvent(comment2_code, moved_code->address()); |
| 185 profiler_listener->CodeCreateEvent(i::Logger::STUB_TAG, args3_code, 3); |
| 186 profiler_listener->CodeCreateEvent(i::Logger::STUB_TAG, args4_code, 4); |
178 | 187 |
179 // Enqueue a tick event to enable code events processing. | 188 // Enqueue a tick event to enable code events processing. |
180 EnqueueTickSampleEvent(processor.get(), aaa_code->address()); | 189 EnqueueTickSampleEvent(processor.get(), aaa_code->address()); |
181 | 190 |
| 191 profiler_listener->RemoveObserver(&profiler); |
182 processor->StopSynchronously(); | 192 processor->StopSynchronously(); |
183 | 193 |
184 // Check the state of profile generator. | 194 // Check the state of profile generator. |
185 CodeEntry* aaa = generator.code_map()->FindEntry(aaa_code->address()); | 195 CodeEntry* aaa = generator.code_map()->FindEntry(aaa_code->address()); |
186 CHECK(aaa); | 196 CHECK(aaa); |
187 CHECK_EQ(0, strcmp(aaa_str, aaa->name())); | 197 CHECK_EQ(0, strcmp(aaa_str, aaa->name())); |
188 | 198 |
189 CodeEntry* comment = generator.code_map()->FindEntry(comment_code->address()); | 199 CodeEntry* comment = generator.code_map()->FindEntry(comment_code->address()); |
190 CHECK(comment); | 200 CHECK(comment); |
191 CHECK_EQ(0, strcmp("comment", comment->name())); | 201 CHECK_EQ(0, strcmp("comment", comment->name())); |
(...skipping 24 matching lines...) Expand all Loading... |
216 i::AbstractCode* frame2_code = CreateCode(&env); | 226 i::AbstractCode* frame2_code = CreateCode(&env); |
217 i::AbstractCode* frame3_code = CreateCode(&env); | 227 i::AbstractCode* frame3_code = CreateCode(&env); |
218 | 228 |
219 CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate->heap()); | 229 CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate->heap()); |
220 profiles->StartProfiling("", false); | 230 profiles->StartProfiling("", false); |
221 ProfileGenerator generator(profiles); | 231 ProfileGenerator generator(profiles); |
222 SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor( | 232 SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor( |
223 &generator, NULL, v8::base::TimeDelta::FromMicroseconds(100))); | 233 &generator, NULL, v8::base::TimeDelta::FromMicroseconds(100))); |
224 processor->Start(); | 234 processor->Start(); |
225 CpuProfiler profiler(isolate, profiles, &generator, processor.get()); | 235 CpuProfiler profiler(isolate, profiles, &generator, processor.get()); |
| 236 ProfilerListener* profiler_listener = |
| 237 profiler.isolate()->logger()->profiler_listener(); |
| 238 profiler_listener->RegisterObserver(&profiler); |
226 | 239 |
227 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame1_code, "bbb"); | 240 profiler_listener->ResolveCodeEvent(); |
228 profiler.CodeCreateEvent(i::Logger::STUB_TAG, frame2_code, 5); | 241 profiler_listener->CodeCreateEvent(i::Logger::BUILTIN_TAG, frame1_code, |
229 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame3_code, "ddd"); | 242 "bbb"); |
| 243 profiler_listener->CodeCreateEvent(i::Logger::STUB_TAG, frame2_code, 5); |
| 244 profiler_listener->CodeCreateEvent(i::Logger::BUILTIN_TAG, frame3_code, |
| 245 "ddd"); |
230 | 246 |
231 EnqueueTickSampleEvent(processor.get(), frame1_code->instruction_start()); | 247 EnqueueTickSampleEvent(processor.get(), frame1_code->instruction_start()); |
232 EnqueueTickSampleEvent( | 248 EnqueueTickSampleEvent( |
233 processor.get(), | 249 processor.get(), |
234 frame2_code->instruction_start() + frame2_code->ExecutableSize() / 2, | 250 frame2_code->instruction_start() + frame2_code->ExecutableSize() / 2, |
235 frame1_code->instruction_start() + frame2_code->ExecutableSize() / 2); | 251 frame1_code->instruction_start() + frame2_code->ExecutableSize() / 2); |
236 EnqueueTickSampleEvent( | 252 EnqueueTickSampleEvent( |
237 processor.get(), | 253 processor.get(), |
238 frame3_code->instruction_end() - 1, | 254 frame3_code->instruction_end() - 1, |
239 frame2_code->instruction_end() - 1, | 255 frame2_code->instruction_end() - 1, |
240 frame1_code->instruction_end() - 1); | 256 frame1_code->instruction_end() - 1); |
241 | 257 |
| 258 profiler_listener->RemoveObserver(&profiler); |
242 processor->StopSynchronously(); | 259 processor->StopSynchronously(); |
243 CpuProfile* profile = profiles->StopProfiling(""); | 260 CpuProfile* profile = profiles->StopProfiling(""); |
244 CHECK(profile); | 261 CHECK(profile); |
245 | 262 |
246 // Check call trees. | 263 // Check call trees. |
247 const i::List<ProfileNode*>* top_down_root_children = | 264 const i::List<ProfileNode*>* top_down_root_children = |
248 profile->top_down()->root()->children(); | 265 profile->top_down()->root()->children(); |
249 CHECK_EQ(1, top_down_root_children->length()); | 266 CHECK_EQ(1, top_down_root_children->length()); |
250 CHECK_EQ(0, strcmp("bbb", top_down_root_children->last()->entry()->name())); | 267 CHECK_EQ(0, strcmp("bbb", top_down_root_children->last()->entry()->name())); |
251 const i::List<ProfileNode*>* top_down_bbb_children = | 268 const i::List<ProfileNode*>* top_down_bbb_children = |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 | 300 |
284 i::AbstractCode* code = CreateCode(&env); | 301 i::AbstractCode* code = CreateCode(&env); |
285 | 302 |
286 CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate->heap()); | 303 CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate->heap()); |
287 profiles->StartProfiling("", false); | 304 profiles->StartProfiling("", false); |
288 ProfileGenerator generator(profiles); | 305 ProfileGenerator generator(profiles); |
289 SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor( | 306 SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor( |
290 &generator, NULL, v8::base::TimeDelta::FromMicroseconds(100))); | 307 &generator, NULL, v8::base::TimeDelta::FromMicroseconds(100))); |
291 processor->Start(); | 308 processor->Start(); |
292 CpuProfiler profiler(isolate, profiles, &generator, processor.get()); | 309 CpuProfiler profiler(isolate, profiles, &generator, processor.get()); |
| 310 ProfilerListener* profiler_listener = |
| 311 profiler.isolate()->logger()->profiler_listener(); |
| 312 profiler_listener->RegisterObserver(&profiler); |
293 | 313 |
294 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, code, "bbb"); | 314 profiler_listener->ResolveCodeEvent(); |
| 315 profiler_listener->CodeCreateEvent(i::Logger::BUILTIN_TAG, code, "bbb"); |
295 | 316 |
296 i::TickSample* sample = processor->StartTickSample(); | 317 i::TickSample* sample = processor->StartTickSample(); |
297 sample->pc = code->address(); | 318 sample->pc = code->address(); |
298 sample->tos = 0; | 319 sample->tos = 0; |
299 sample->frames_count = i::TickSample::kMaxFramesCount; | 320 sample->frames_count = i::TickSample::kMaxFramesCount; |
300 for (unsigned i = 0; i < sample->frames_count; ++i) { | 321 for (unsigned i = 0; i < sample->frames_count; ++i) { |
301 sample->stack[i] = code->address(); | 322 sample->stack[i] = code->address(); |
302 } | 323 } |
303 processor->FinishTickSample(); | 324 processor->FinishTickSample(); |
304 | 325 |
| 326 profiler_listener->RemoveObserver(&profiler); |
305 processor->StopSynchronously(); | 327 processor->StopSynchronously(); |
306 CpuProfile* profile = profiles->StopProfiling(""); | 328 CpuProfile* profile = profiles->StopProfiling(""); |
307 CHECK(profile); | 329 CHECK(profile); |
308 | 330 |
309 unsigned actual_depth = 0; | 331 unsigned actual_depth = 0; |
310 const ProfileNode* node = profile->top_down()->root(); | 332 const ProfileNode* node = profile->top_down()->root(); |
311 while (node->children()->length() > 0) { | 333 while (node->children()->length() > 0) { |
312 node = node->children()->last(); | 334 node = node->children()->last(); |
313 ++actual_depth; | 335 ++actual_depth; |
314 } | 336 } |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 i::Address code_address = code->instruction_start(); | 1043 i::Address code_address = code->instruction_start(); |
1022 CHECK(code_address); | 1044 CHECK(code_address); |
1023 | 1045 |
1024 CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate->heap()); | 1046 CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate->heap()); |
1025 profiles->StartProfiling("", false); | 1047 profiles->StartProfiling("", false); |
1026 ProfileGenerator generator(profiles); | 1048 ProfileGenerator generator(profiles); |
1027 SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor( | 1049 SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor( |
1028 &generator, NULL, v8::base::TimeDelta::FromMicroseconds(100))); | 1050 &generator, NULL, v8::base::TimeDelta::FromMicroseconds(100))); |
1029 processor->Start(); | 1051 processor->Start(); |
1030 CpuProfiler profiler(isolate, profiles, &generator, processor.get()); | 1052 CpuProfiler profiler(isolate, profiles, &generator, processor.get()); |
| 1053 ProfilerListener* profiler_listener = |
| 1054 profiler.isolate()->logger()->profiler_listener(); |
| 1055 profiler_listener->RegisterObserver(&profiler); |
1031 | 1056 |
1032 // Enqueue code creation events. | 1057 // Enqueue code creation events. |
1033 i::Handle<i::String> str = factory->NewStringFromAsciiChecked(func_name); | 1058 i::Handle<i::String> str = factory->NewStringFromAsciiChecked(func_name); |
1034 int line = 1; | 1059 int line = 1; |
1035 int column = 1; | 1060 int column = 1; |
1036 profiler.CodeCreateEvent(i::Logger::FUNCTION_TAG, code, func->shared(), *str, | 1061 profiler_listener->ResolveCodeEvent(); |
1037 line, column); | 1062 profiler_listener->CodeCreateEvent(i::Logger::FUNCTION_TAG, code, |
| 1063 func->shared(), *str, line, column); |
1038 | 1064 |
1039 // Enqueue a tick event to enable code events processing. | 1065 // Enqueue a tick event to enable code events processing. |
1040 EnqueueTickSampleEvent(processor.get(), code_address); | 1066 EnqueueTickSampleEvent(processor.get(), code_address); |
1041 | 1067 |
| 1068 profiler_listener->RemoveObserver(&profiler); |
1042 processor->StopSynchronously(); | 1069 processor->StopSynchronously(); |
1043 | 1070 |
1044 CpuProfile* profile = profiles->StopProfiling(""); | 1071 CpuProfile* profile = profiles->StopProfiling(""); |
1045 CHECK(profile); | 1072 CHECK(profile); |
1046 | 1073 |
1047 // Check the state of profile generator. | 1074 // Check the state of profile generator. |
1048 CodeEntry* func_entry = generator.code_map()->FindEntry(code_address); | 1075 CodeEntry* func_entry = generator.code_map()->FindEntry(code_address); |
1049 CHECK(func_entry); | 1076 CHECK(func_entry); |
1050 CHECK_EQ(0, strcmp(func_name, func_entry->name())); | 1077 CHECK_EQ(0, strcmp(func_name, func_entry->name())); |
1051 const i::JITLineInfoTable* line_info = func_entry->line_info(); | 1078 const i::JITLineInfoTable* line_info = func_entry->line_info(); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 int32_t duration_ms = 100; | 1151 int32_t duration_ms = 100; |
1125 v8::Local<v8::Value> args[] = { | 1152 v8::Local<v8::Value> args[] = { |
1126 v8::Integer::New(env->GetIsolate(), duration_ms)}; | 1153 v8::Integer::New(env->GetIsolate(), duration_ms)}; |
1127 v8::CpuProfile* profile = | 1154 v8::CpuProfile* profile = |
1128 RunProfiler(env.local(), function, args, arraysize(args), 1000); | 1155 RunProfiler(env.local(), function, args, arraysize(args), 1000); |
1129 | 1156 |
1130 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); | 1157 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); |
1131 const v8::CpuProfileNode* start_node = GetChild(env.local(), root, "start"); | 1158 const v8::CpuProfileNode* start_node = GetChild(env.local(), root, "start"); |
1132 GetChild(env.local(), start_node, "bar"); | 1159 GetChild(env.local(), start_node, "bar"); |
1133 | 1160 |
1134 const v8::CpuProfileNode* unresolved_node = FindChild( | 1161 const v8::CpuProfileNode* unresolved_node = |
1135 env.local(), root, i::ProfileGenerator::kUnresolvedFunctionName); | 1162 FindChild(env.local(), root, i::CodeEntry::kUnresolvedFunctionName); |
1136 CHECK(!unresolved_node || GetChild(env.local(), unresolved_node, "call")); | 1163 CHECK(!unresolved_node || GetChild(env.local(), unresolved_node, "call")); |
1137 | 1164 |
1138 profile->Delete(); | 1165 profile->Delete(); |
1139 } | 1166 } |
1140 | 1167 |
1141 static const char* function_apply_test_source = | 1168 static const char* function_apply_test_source = |
1142 "%NeverOptimizeFunction(bar);\n" | 1169 "%NeverOptimizeFunction(bar);\n" |
1143 "%NeverOptimizeFunction(test);\n" | 1170 "%NeverOptimizeFunction(test);\n" |
1144 "%NeverOptimizeFunction(start);\n" | 1171 "%NeverOptimizeFunction(start);\n" |
1145 "function bar(n) {\n" | 1172 "function bar(n) {\n" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 | 1207 |
1181 v8::CpuProfile* profile = | 1208 v8::CpuProfile* profile = |
1182 RunProfiler(env.local(), function, args, arraysize(args), 1000); | 1209 RunProfiler(env.local(), function, args, arraysize(args), 1000); |
1183 | 1210 |
1184 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); | 1211 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); |
1185 const v8::CpuProfileNode* start_node = GetChild(env.local(), root, "start"); | 1212 const v8::CpuProfileNode* start_node = GetChild(env.local(), root, "start"); |
1186 const v8::CpuProfileNode* test_node = | 1213 const v8::CpuProfileNode* test_node = |
1187 GetChild(env.local(), start_node, "test"); | 1214 GetChild(env.local(), start_node, "test"); |
1188 GetChild(env.local(), test_node, "bar"); | 1215 GetChild(env.local(), test_node, "bar"); |
1189 | 1216 |
1190 const v8::CpuProfileNode* unresolved_node = FindChild( | 1217 const v8::CpuProfileNode* unresolved_node = |
1191 env.local(), start_node, ProfileGenerator::kUnresolvedFunctionName); | 1218 FindChild(env.local(), start_node, CodeEntry::kUnresolvedFunctionName); |
1192 CHECK(!unresolved_node || GetChild(env.local(), unresolved_node, "apply")); | 1219 CHECK(!unresolved_node || GetChild(env.local(), unresolved_node, "apply")); |
1193 | 1220 |
1194 profile->Delete(); | 1221 profile->Delete(); |
1195 } | 1222 } |
1196 | 1223 |
1197 static const char* cpu_profiler_deep_stack_test_source = | 1224 static const char* cpu_profiler_deep_stack_test_source = |
1198 "function foo(n) {\n" | 1225 "function foo(n) {\n" |
1199 " if (n)\n" | 1226 " if (n)\n" |
1200 " foo(n - 1);\n" | 1227 " foo(n - 1);\n" |
1201 " else\n" | 1228 " else\n" |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 cpu_profiler->SetIdle(false); | 1615 cpu_profiler->SetIdle(false); |
1589 processor->AddCurrentStack(isolate, true); | 1616 processor->AddCurrentStack(isolate, true); |
1590 | 1617 |
1591 v8::CpuProfile* profile = cpu_profiler->StopProfiling(profile_name); | 1618 v8::CpuProfile* profile = cpu_profiler->StopProfiling(profile_name); |
1592 CHECK(profile); | 1619 CHECK(profile); |
1593 // Dump collected profile to have a better diagnostic in case of failure. | 1620 // Dump collected profile to have a better diagnostic in case of failure. |
1594 reinterpret_cast<i::CpuProfile*>(profile)->Print(); | 1621 reinterpret_cast<i::CpuProfile*>(profile)->Print(); |
1595 | 1622 |
1596 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); | 1623 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); |
1597 const v8::CpuProfileNode* program_node = | 1624 const v8::CpuProfileNode* program_node = |
1598 GetChild(env.local(), root, ProfileGenerator::kProgramEntryName); | 1625 GetChild(env.local(), root, CodeEntry::kProgramEntryName); |
1599 CHECK_EQ(0, program_node->GetChildrenCount()); | 1626 CHECK_EQ(0, program_node->GetChildrenCount()); |
1600 CHECK_GE(program_node->GetHitCount(), 2u); | 1627 CHECK_GE(program_node->GetHitCount(), 2u); |
1601 | 1628 |
1602 const v8::CpuProfileNode* idle_node = | 1629 const v8::CpuProfileNode* idle_node = |
1603 GetChild(env.local(), root, ProfileGenerator::kIdleEntryName); | 1630 GetChild(env.local(), root, CodeEntry::kIdleEntryName); |
1604 CHECK_EQ(0, idle_node->GetChildrenCount()); | 1631 CHECK_EQ(0, idle_node->GetChildrenCount()); |
1605 CHECK_GE(idle_node->GetHitCount(), 3u); | 1632 CHECK_GE(idle_node->GetHitCount(), 3u); |
1606 | 1633 |
1607 profile->Delete(); | 1634 profile->Delete(); |
1608 } | 1635 } |
1609 | 1636 |
1610 static void CheckFunctionDetails(v8::Isolate* isolate, | 1637 static void CheckFunctionDetails(v8::Isolate* isolate, |
1611 const v8::CpuProfileNode* node, | 1638 const v8::CpuProfileNode* node, |
1612 const char* name, const char* script_name, | 1639 const char* name, const char* script_name, |
1613 int script_id, int line, int column) { | 1640 int script_id, int line, int column) { |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2023 iprofile->Print(); | 2050 iprofile->Print(); |
2024 v8::CpuProfile* profile = reinterpret_cast<v8::CpuProfile*>(iprofile); | 2051 v8::CpuProfile* profile = reinterpret_cast<v8::CpuProfile*>(iprofile); |
2025 | 2052 |
2026 const char* branch[] = {"", "test"}; | 2053 const char* branch[] = {"", "test"}; |
2027 const ProfileNode* itest_node = | 2054 const ProfileNode* itest_node = |
2028 GetSimpleBranch(env, profile, branch, arraysize(branch)); | 2055 GetSimpleBranch(env, profile, branch, arraysize(branch)); |
2029 CHECK_EQ(0U, itest_node->deopt_infos().size()); | 2056 CHECK_EQ(0U, itest_node->deopt_infos().size()); |
2030 | 2057 |
2031 iprofiler->DeleteProfile(iprofile); | 2058 iprofiler->DeleteProfile(iprofile); |
2032 } | 2059 } |
OLD | NEW |