OLD | NEW |
1 <html> | 1 <html> |
2 <!-- | 2 <!-- |
3 Copyright 2016 the V8 project authors. All rights reserved. Use of this source | 3 Copyright 2016 the V8 project authors. All rights reserved. Use of this source |
4 code is governed by a BSD-style license that can be found in the LICENSE file. | 4 code is governed by a BSD-style license that can be found in the LICENSE file. |
5 --> | 5 --> |
6 | 6 |
7 <head> | 7 <head> |
8 <style> | 8 <style> |
9 .entry-details {} | 9 .entry-details {} |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 constructor(id, line) { | 44 constructor(id, line) { |
45 this.id = id; | 45 this.id = id; |
46 this.line = line; | 46 this.line = line; |
47 var parts = line.split(" "); | 47 var parts = line.split(" "); |
48 if (parts.length < 6) return | 48 if (parts.length < 6) return |
49 this.isValid = false; | 49 this.isValid = false; |
50 if (parts[0][0] !== "[") return; | 50 if (parts[0][0] !== "[") return; |
51 if (parts[1] === "patching") return; | 51 if (parts[1] === "patching") return; |
52 this.type = parts[0].substr(1); | 52 this.type = parts[0].substr(1); |
53 this.category = "Other"; | 53 this.category = "Other"; |
| 54 this.map = undefined; |
54 if (this.type.indexOf("Store") !== -1) { | 55 if (this.type.indexOf("Store") !== -1) { |
55 this.category = "Store"; | 56 this.category = "Store"; |
56 } else if (this.type.indexOf("Load") !== -1) { | 57 } else if (this.type.indexOf("Load") !== -1) { |
57 this.category = "Load"; | 58 this.category = "Load"; |
58 } | 59 } |
59 if (this.type.length == 0) return; | 60 if (this.type.length == 0) return; |
60 if (this.type.indexOf('BinaryOpIC(') === 0) { | 61 if (this.type.indexOf('BinaryOpIC(') === 0) { |
61 this.type = "BinaryOpIC"; | 62 this.type = "BinaryOpIC"; |
62 var split = parts[0].split('('); | 63 var split = parts[0].split('('); |
63 this.state = "(" + split[1] + " => " + parts[2]; | 64 this.state = "(" + split[1] + " => " + parts[2]; |
64 var offset = this.parsePositionAndFile(parts, 6); | 65 var offset = this.parsePositionAndFile(parts, 6); |
65 if (offset == -1) return | 66 if (offset == -1) return |
66 if (this.file === undefined) return | 67 if (this.file === undefined) return |
67 this.file = this.file.slice(0, -1); | 68 this.file = this.file.slice(0, -1); |
68 } else { | 69 } else { |
69 var offset = this.parsePositionAndFile(parts, 2); | 70 var offset = this.parsePositionAndFile(parts, 2); |
70 if (offset == -1) return | 71 if (offset == -1) return |
71 this.state = parts[++offset]; | 72 this.state = parts[++offset]; |
| 73 this.map = parts[offset + 1]; |
| 74 if (this.map.startsWith("map=")) { |
| 75 this.map = this.map.substring(4); |
| 76 offset++; |
| 77 } else { |
| 78 this.map = undefined; |
| 79 } |
72 if (this.type !== "CompareIC") { | 80 if (this.type !== "CompareIC") { |
73 // if there is no address we have a smi key | 81 // if there is no address we have a smi key |
74 var address = parts[++offset]; | 82 var address = parts[++offset]; |
75 if (address !== undefined && address.indexOf("0x") === 0) { | 83 if (address !== undefined && address.indexOf("0x") === 0) { |
76 this.key = parts.slice(++offset).join(" "); | 84 this.key = parts.slice(++offset).join(" "); |
77 } else { | 85 } else { |
78 this.key = address; | 86 this.key = address; |
79 } | 87 } |
80 } | 88 } |
81 } | 89 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 var end = this.result.length; | 136 var end = this.result.length; |
129 var current = 0; | 137 var current = 0; |
130 var next = 0; | 138 var next = 0; |
131 var line; | 139 var line; |
132 var i = 0; | 140 var i = 0; |
133 var entry; | 141 var entry; |
134 while (current < end) { | 142 while (current < end) { |
135 next = this.result.indexOf("\n", current); | 143 next = this.result.indexOf("\n", current); |
136 if (next === -1) break; | 144 if (next === -1) break; |
137 i++; | 145 i++; |
138 | |
139 line = this.result.substring(current, next); | 146 line = this.result.substring(current, next); |
140 current = next + 1; | 147 current = next + 1; |
141 entry = new Entry(i, line); | 148 entry = new Entry(i, line); |
142 if (entry.isValid) entries.push(entry); | 149 if (entry.isValid) entries.push(entry); |
143 } | 150 } |
144 | 151 |
145 document.getElementById("count").innerHTML = i; | 152 document.getElementById("count").innerHTML = i; |
146 updateTable(); | 153 updateTable(); |
147 } | 154 } |
148 reader.readAsText(file); | 155 reader.readAsText(file); |
149 initGroupKeySelect(); | 156 initGroupKeySelect(); |
150 } | 157 } |
151 | 158 |
152 | 159 |
153 | 160 |
154 var properties = ['type', 'category', 'file', 'filePosition', 'state', | 161 var properties = ['type', 'category', 'file', 'filePosition', 'state', |
155 'key', 'isNative' | 162 'key', 'isNative', 'map' |
156 ] | 163 ] |
157 | 164 |
158 class Group { | 165 class Group { |
159 constructor(property, key, entry) { | 166 constructor(property, key, entry) { |
160 this.property = property; | 167 this.property = property; |
161 this.key = key; | 168 this.key = key; |
162 this.count = 1; | 169 this.count = 1; |
163 this.entries = [entry]; | 170 this.entries = [entry]; |
164 this.percentage = undefined; | 171 this.percentage = undefined; |
165 this.groups = undefined; | 172 this.groups = undefined; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 result.push(group); | 209 result.push(group); |
203 } | 210 } |
204 result.sort((a, b) => { | 211 result.sort((a, b) => { |
205 return b.count - a.count | 212 return b.count - a.count |
206 }); | 213 }); |
207 return result; | 214 return result; |
208 } | 215 } |
209 | 216 |
210 | 217 |
211 | 218 |
| 219 function escapeHtml(unsafe) { |
| 220 return unsafe.toString() |
| 221 .replace(/&/g, "&") |
| 222 .replace(/</g, "<") |
| 223 .replace(/>/g, ">") |
| 224 .replace(/"/g, """) |
| 225 .replace(/'/g, "'"); |
| 226 } |
212 | 227 |
213 function updateTable() { | 228 function updateTable() { |
214 var select = document.getElementById("group-key"); | 229 var select = document.getElementById("group-key"); |
215 var key = select.options[select.selectedIndex].text; | 230 var key = select.options[select.selectedIndex].text; |
216 console.log(key); | 231 console.log(key); |
217 var tableBody = document.getElementById("table-body"); | 232 var tableBody = document.getElementById("table-body"); |
218 removeAllChildren(tableBody); | 233 removeAllChildren(tableBody); |
219 var groups = groupBy(entries, key, true); | 234 var groups = groupBy(entries, key, true); |
220 display(groups, tableBody); | 235 display(groups, tableBody); |
221 } | 236 } |
(...skipping 19 matching lines...) Expand all Loading... |
241 return td | 256 return td |
242 } | 257 } |
243 var max = Math.min(1000, entries.length) | 258 var max = Math.min(1000, entries.length) |
244 for (var i = 0; i < max; i++) { | 259 for (var i = 0; i < max; i++) { |
245 var entry = entries[i]; | 260 var entry = entries[i]; |
246 var tr = document.createElement("tr"); | 261 var tr = document.createElement("tr"); |
247 tr.entry = entry; | 262 tr.entry = entry; |
248 td(tr, '<span onclick="toggleDetails(this)">details</a>', 'details'); | 263 td(tr, '<span onclick="toggleDetails(this)">details</a>', 'details'); |
249 td(tr, entry.percentage + "%", 'percentage'); | 264 td(tr, entry.percentage + "%", 'percentage'); |
250 td(tr, entry.count, 'count'); | 265 td(tr, entry.count, 'count'); |
251 td(tr, entry.key, 'key'); | 266 td(tr, escapeHtml(entry.key), 'key'); |
252 fragment.appendChild(tr); | 267 fragment.appendChild(tr); |
253 } | 268 } |
254 var omitted = entries.length - max; | 269 var omitted = entries.length - max; |
255 if (omitted > 0) { | 270 if (omitted > 0) { |
256 var tr = document.createElement("tr"); | 271 var tr = document.createElement("tr"); |
257 var td = td(tr, 'Omitted ' + omitted + " entries."); | 272 var td = td(tr, 'Omitted ' + omitted + " entries."); |
258 td.colSpan = 4; | 273 td.colSpan = 4; |
259 fragment.appendChild(tr); | 274 fragment.appendChild(tr); |
260 } | 275 } |
261 parent.appendChild(fragment); | 276 parent.appendChild(fragment); |
(...skipping 13 matching lines...) Expand all Loading... |
275 tr.appendChild(td); | 290 tr.appendChild(td); |
276 // Append the new TR after previousSibling. | 291 // Append the new TR after previousSibling. |
277 previousSibling.parentNode.insertBefore(tr, previousSibling.nextSibling) | 292 previousSibling.parentNode.insertBefore(tr, previousSibling.nextSibling) |
278 } | 293 } |
279 | 294 |
280 function displayDrilldownGroup(entry, key) { | 295 function displayDrilldownGroup(entry, key) { |
281 var max = 20; | 296 var max = 20; |
282 var group = entry.groups[key]; | 297 var group = entry.groups[key]; |
283 var div = document.createElement("div") | 298 var div = document.createElement("div") |
284 div.className = 'drilldown-group-title' | 299 div.className = 'drilldown-group-title' |
285 div.innerHTML = key + ' [top ' + max + ']'; | 300 div.innerHTML = key + ' [top ' + max + ' out of ' + group.length + ']'; |
286 var table = document.createElement("table"); | 301 var table = document.createElement("table"); |
287 display(group.slice(0, max), table, false) | 302 display(group.slice(0, max), table, false) |
288 div.appendChild(table); | 303 div.appendChild(table); |
289 return div; | 304 return div; |
290 } | 305 } |
291 | 306 |
292 function toggleDetails(node) { | 307 function toggleDetails(node) { |
293 var tr = node.parentNode.parentNode; | 308 var tr = node.parentNode.parentNode; |
294 var entry = tr.entry; | 309 var entry = tr.entry; |
295 | 310 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 </p> | 356 </p> |
342 <p> | 357 <p> |
343 <table id="table" width="100%"> | 358 <table id="table" width="100%"> |
344 <tbody id="table-body"> | 359 <tbody id="table-body"> |
345 </tbody> | 360 </tbody> |
346 </table> | 361 </table> |
347 </p> | 362 </p> |
348 </body> | 363 </body> |
349 | 364 |
350 </html> | 365 </html> |
OLD | NEW |