OLD | NEW |
1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 "use strict" | 5 "use strict" |
6 | 6 |
7 let codeKinds = [ | 7 let codeKinds = [ |
8 "UNKNOWN", | 8 "UNKNOWN", |
9 "CPPCOMP", | 9 "CPPCOMP", |
10 "CPPGC", | 10 "CPPGC", |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 paths.push(pathIndex, depth, 1); | 123 paths.push(pathIndex, depth, 1); |
124 } | 124 } |
125 } | 125 } |
126 | 126 |
127 function findNextFrame(file, stack, stackPos, step, filter) { | 127 function findNextFrame(file, stack, stackPos, step, filter) { |
128 let codeId = -1; | 128 let codeId = -1; |
129 let code = null; | 129 let code = null; |
130 while (stackPos >= 0 && stackPos < stack.length) { | 130 while (stackPos >= 0 && stackPos < stack.length) { |
131 codeId = stack[stackPos]; | 131 codeId = stack[stackPos]; |
132 code = codeId >= 0 ? file.code[codeId] : undefined; | 132 code = codeId >= 0 ? file.code[codeId] : undefined; |
| 133 |
133 if (filter) { | 134 if (filter) { |
134 let type = code ? code.type : undefined; | 135 let type = code ? code.type : undefined; |
135 let kind = code ? code.kind : undefined; | 136 let kind = code ? code.kind : undefined; |
136 if (filter(type, kind)) return stackPos; | 137 if (filter(type, kind)) return stackPos; |
137 } | 138 } |
138 stackPos += step; | 139 stackPos += step; |
139 } | 140 } |
140 return -1; | 141 return -1; |
141 } | 142 } |
142 | 143 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 return { | 192 return { |
192 name : name, | 193 name : name, |
193 codeId: -1, | 194 codeId: -1, |
194 type : "CAT", | 195 type : "CAT", |
195 children : [], | 196 children : [], |
196 ownTicks : 0, | 197 ownTicks : 0, |
197 ticks : 0 | 198 ticks : 0 |
198 }; | 199 }; |
199 } | 200 } |
200 | 201 |
| 202 class RuntimeCallTreeProcessor { |
| 203 constructor() { |
| 204 this.tree = createEmptyNode("root"); |
| 205 this.tree.delayedExpansion = { frameList : [], ascending : false }; |
| 206 } |
| 207 |
| 208 addStack(file, tickIndex) { |
| 209 this.tree.ticks++; |
| 210 |
| 211 let stack = file.ticks[tickIndex].s; |
| 212 let i; |
| 213 for (i = 0; i < stack.length; i += 2) { |
| 214 let codeId = stack[i]; |
| 215 if (codeId < 0) return; |
| 216 let code = file.code[codeId]; |
| 217 if (code.type !== "CPP" && code.type !== "SHARED_LIB") { |
| 218 i -= 2; |
| 219 break; |
| 220 } |
| 221 } |
| 222 if (i < 0 || i >= stack.length) return; |
| 223 addOrUpdateChildNode(this.tree, file, tickIndex, i, false); |
| 224 } |
| 225 } |
| 226 |
201 class PlainCallTreeProcessor { | 227 class PlainCallTreeProcessor { |
202 constructor(filter, isBottomUp) { | 228 constructor(filter, isBottomUp) { |
203 this.filter = filter; | 229 this.filter = filter; |
204 this.tree = createEmptyNode("root"); | 230 this.tree = createEmptyNode("root"); |
205 this.tree.delayedExpansion = { frameList : [], ascending : isBottomUp }; | 231 this.tree.delayedExpansion = { frameList : [], ascending : isBottomUp }; |
206 this.isBottomUp = isBottomUp; | 232 this.isBottomUp = isBottomUp; |
207 } | 233 } |
208 | 234 |
209 addStack(file, tickIndex) { | 235 addStack(file, tickIndex) { |
210 let stack = file.ticks[tickIndex].s; | 236 let stack = file.ticks[tickIndex].s; |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 return { | 585 return { |
560 functionCount, | 586 functionCount, |
561 optimizedFunctionCount, | 587 optimizedFunctionCount, |
562 deoptimizedFunctionCount, | 588 deoptimizedFunctionCount, |
563 optimizations, | 589 optimizations, |
564 eagerDeoptimizations, | 590 eagerDeoptimizations, |
565 lazyDeoptimizations, | 591 lazyDeoptimizations, |
566 softDeoptimizations, | 592 softDeoptimizations, |
567 }; | 593 }; |
568 } | 594 } |
OLD | NEW |