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