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 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); | 1162 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); |
1163 { | 1163 { |
1164 ScopedVector<v8::Handle<v8::String> > names(3); | 1164 ScopedVector<v8::Handle<v8::String> > names(3); |
1165 names[0] = v8::String::New(ProfileGenerator::kGarbageCollectorEntryName); | 1165 names[0] = v8::String::New(ProfileGenerator::kGarbageCollectorEntryName); |
1166 names[1] = v8::String::New(ProfileGenerator::kProgramEntryName); | 1166 names[1] = v8::String::New(ProfileGenerator::kProgramEntryName); |
1167 names[2] = v8::String::New("start"); | 1167 names[2] = v8::String::New("start"); |
1168 // Don't allow |test|, |bar| and |apply| nodes to be at the top level. | 1168 // Don't allow |test|, |bar| and |apply| nodes to be at the top level. |
1169 CheckChildrenNames(root, names); | 1169 CheckChildrenNames(root, names); |
1170 } | 1170 } |
1171 | 1171 |
1172 // In case of GC stress tests all samples may be in GC phase and there | |
1173 // won't be |start| node in the profile. | |
1174 bool is_gc_stress_testing = | |
1175 (i::FLAG_gc_interval != -1) || i::FLAG_stress_compaction; | |
1176 | |
1177 const v8::CpuProfileNode* startNode = FindChild(root, "start"); | 1172 const v8::CpuProfileNode* startNode = FindChild(root, "start"); |
1178 CHECK(is_gc_stress_testing || startNode); | |
1179 if (startNode) { | 1173 if (startNode) { |
1180 { | 1174 { |
1181 ScopedVector<v8::Handle<v8::String> > names(2); | 1175 ScopedVector<v8::Handle<v8::String> > names(2); |
1182 names[0] = v8::String::New("test"); | 1176 names[0] = v8::String::New("test"); |
1183 names[1] = v8::String::New(ProfileGenerator::kUnresolvedFunctionName); | 1177 names[1] = v8::String::New(ProfileGenerator::kUnresolvedFunctionName); |
1184 CheckChildrenNames(startNode, names); | 1178 CheckChildrenNames(startNode, names); |
1185 } | 1179 } |
1186 | 1180 |
1187 const v8::CpuProfileNode* testNode = FindChild(startNode, "test"); | 1181 const v8::CpuProfileNode* testNode = FindChild(startNode, "test"); |
1188 CHECK(is_gc_stress_testing || testNode); | |
1189 if (testNode) { | 1182 if (testNode) { |
1190 ScopedVector<v8::Handle<v8::String> > names(2); | 1183 ScopedVector<v8::Handle<v8::String> > names(2); |
1191 names[0] = v8::String::New("bar"); | 1184 names[0] = v8::String::New("bar"); |
1192 names[1] = v8::String::New("apply"); | 1185 names[1] = v8::String::New("apply"); |
1193 CheckChildrenNames(testNode, names); | 1186 CheckChildrenNames(testNode, names); |
1194 } | 1187 } |
1195 | 1188 |
1196 if (const v8::CpuProfileNode* unresolvedNode = | 1189 if (const v8::CpuProfileNode* unresolvedNode = |
1197 FindChild(startNode, ProfileGenerator::kUnresolvedFunctionName)) { | 1190 FindChild(startNode, ProfileGenerator::kUnresolvedFunctionName)) { |
1198 ScopedVector<v8::Handle<v8::String> > names(1); | 1191 ScopedVector<v8::Handle<v8::String> > names(1); |
1199 names[0] = v8::String::New("apply"); | 1192 names[0] = v8::String::New("apply"); |
1200 CheckChildrenNames(unresolvedNode, names); | 1193 CheckChildrenNames(unresolvedNode, names); |
1201 GetChild(unresolvedNode, "apply"); | 1194 GetChild(unresolvedNode, "apply"); |
1202 } | 1195 } |
1203 } | 1196 } |
1204 | 1197 |
1205 cpu_profiler->DeleteAllCpuProfiles(); | 1198 cpu_profiler->DeleteAllCpuProfiles(); |
1206 } | 1199 } |
OLD | NEW |