OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 document.onload = (function(d3){ | 5 document.onload = (function(d3){ |
6 "use strict"; | 6 "use strict"; |
7 var jsonObj; | 7 var jsonObj; |
8 var sourceExpandClassList = document.getElementById(SOURCE_EXPAND_ID).classLis
t; | 8 var sourceExpandClassList = document.getElementById(SOURCE_EXPAND_ID).classLis
t; |
9 var sourceCollapseClassList = document.getElementById(SOURCE_COLLAPSE_ID).clas
sList; | 9 var sourceCollapseClassList = document.getElementById(SOURCE_COLLAPSE_ID).clas
sList; |
10 var sourceExpanded = sourceCollapseClassList.contains(COLLAPSE_PANE_BUTTON_VIS
IBLE); | 10 var sourceExpanded = sourceCollapseClassList.contains(COLLAPSE_PANE_BUTTON_VIS
IBLE); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // If the JSON isn't properly terminated, assume compiler crashed and | 163 // If the JSON isn't properly terminated, assume compiler crashed and |
164 // add best-guess empty termination | 164 // add best-guess empty termination |
165 if (txtRes[txtRes.length-2] == ',') { | 165 if (txtRes[txtRes.length-2] == ',') { |
166 txtRes += '{"name":"disassembly","type":"disassembly","data":""}]}'; | 166 txtRes += '{"name":"disassembly","type":"disassembly","data":""}]}'; |
167 } | 167 } |
168 try{ | 168 try{ |
169 jsonObj = JSON.parse(txtRes); | 169 jsonObj = JSON.parse(txtRes); |
170 | 170 |
171 hideCurrentPhase(); | 171 hideCurrentPhase(); |
172 | 172 |
| 173 selectionBroker.setNodePositionMap(jsonObj.nodePositions); |
| 174 |
173 sourceView.initializeCode(jsonObj.source, jsonObj.sourcePosition); | 175 sourceView.initializeCode(jsonObj.source, jsonObj.sourcePosition); |
174 disassemblyView.initializeCode(jsonObj.source, jsonObj.sourcePositio
n); | 176 disassemblyView.initializeCode(jsonObj.source); |
175 schedule.setNodePositionMap(jsonObj.nodePositions); | |
176 | 177 |
177 var selectMenu = document.getElementById('display-selector'); | 178 var selectMenu = document.getElementById('display-selector'); |
178 var disassemblyPhase = null; | 179 var disassemblyPhase = null; |
179 selectMenu.innerHTML = ''; | 180 selectMenu.innerHTML = ''; |
180 for (var i = 0; i < jsonObj.phases.length; ++i) { | 181 for (var i = 0; i < jsonObj.phases.length; ++i) { |
181 var optionElement = document.createElement("option"); | 182 var optionElement = document.createElement("option"); |
182 optionElement.text = jsonObj.phases[i].name; | 183 optionElement.text = jsonObj.phases[i].name; |
183 if (optionElement.text == 'disassembly') { | 184 if (optionElement.text == 'disassembly') { |
184 disassemblyPhase = jsonObj.phases[i]; | 185 disassemblyPhase = jsonObj.phases[i]; |
185 } else { | 186 } else { |
186 selectMenu.add(optionElement, null); | 187 selectMenu.add(optionElement, null); |
187 } | 188 } |
188 } | 189 } |
189 | 190 |
190 var eventMenu = document.getElementById('event-selector'); | 191 var eventMenu = document.getElementById('event-selector'); |
191 eventMenu.innerHTML = ''; | 192 eventMenu.innerHTML = ''; |
192 for (var event in jsonObj.eventCounts) { | 193 for (var event in jsonObj.eventCounts) { |
193 var optionElement = document.createElement("option"); | 194 var optionElement = document.createElement("option"); |
194 optionElement.text = event; | 195 optionElement.text = event; |
195 eventMenu.add(optionElement, null); | 196 eventMenu.add(optionElement, null); |
196 } | 197 } |
197 disassemblyView.initializePerfProfile(jsonObj.eventCounts); | 198 disassemblyView.initializePerfProfile(jsonObj.eventCounts); |
198 disassemblyView.setNodePositionMap(jsonObj.nodePositions); | |
199 disassemblyView.show(disassemblyPhase.data, null); | 199 disassemblyView.show(disassemblyPhase.data, null); |
200 | 200 |
201 var initialPhaseIndex = +window.sessionStorage.getItem("lastSelected
Phase"); | 201 var initialPhaseIndex = +window.sessionStorage.getItem("lastSelected
Phase"); |
202 if (!(initialPhaseIndex in jsonObj.phases)) { | 202 if (!(initialPhaseIndex in jsonObj.phases)) { |
203 initialPhaseIndex = 0; | 203 initialPhaseIndex = 0; |
204 } | 204 } |
205 | 205 |
206 // We wish to show the remembered phase {lastSelectedPhase}, but | 206 // We wish to show the remembered phase {lastSelectedPhase}, but |
207 // this will crash if the first view we switch to is a | 207 // this will crash if the first view we switch to is a |
208 // ScheduleView. So we first switch to the first phase, which | 208 // ScheduleView. So we first switch to the first phase, which |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 empty = new EmptyView(EMPTY_PANE_ID, selectionBroker); | 248 empty = new EmptyView(EMPTY_PANE_ID, selectionBroker); |
249 | 249 |
250 initializeHandlers(graph); | 250 initializeHandlers(graph); |
251 | 251 |
252 setSourceExpanded(getLastExpandedState("source", true)); | 252 setSourceExpanded(getLastExpandedState("source", true)); |
253 setDisassemblyExpanded(getLastExpandedState("disassembly", false)); | 253 setDisassemblyExpanded(getLastExpandedState("disassembly", false)); |
254 | 254 |
255 displayPhaseView(empty, null); | 255 displayPhaseView(empty, null); |
256 fitPanesToParents(); | 256 fitPanesToParents(); |
257 })(window.d3); | 257 })(window.d3); |
OLD | NEW |