Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: tools/turbolizer/graph-view.js

Issue 2226293002: [turbolizer] Visualize also the dead nodes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@t-p2
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/cctest/compiler/test-osr.cc ('k') | tools/turbolizer/index.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 class GraphView extends View { 7 class GraphView extends View {
8 constructor (d3, id, nodes, edges, broker) { 8 constructor (d3, id, nodes, edges, broker) {
9 super(id, broker); 9 super(id, broker);
10 var graph = this; 10 var graph = this;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 return {x: d.x, y: d.y}; 118 return {x: d.x, y: d.y};
119 }) 119 })
120 .on("drag", function(args){ 120 .on("drag", function(args){
121 graph.state.justDragged = true; 121 graph.state.justDragged = true;
122 graph.dragmove.call(graph, args); 122 graph.dragmove.call(graph, args);
123 }) 123 })
124 124
125 d3.select("#upload").on("click", partial(this.uploadAction, graph)); 125 d3.select("#upload").on("click", partial(this.uploadAction, graph));
126 d3.select("#layout").on("click", partial(this.layoutAction, graph)); 126 d3.select("#layout").on("click", partial(this.layoutAction, graph));
127 d3.select("#show-all").on("click", partial(this.showAllAction, graph)); 127 d3.select("#show-all").on("click", partial(this.showAllAction, graph));
128 d3.select("#hide-dead").on("click", partial(this.hideDeadAction, graph));
128 d3.select("#hide-unselected").on("click", partial(this.hideUnselectedAction, graph)); 129 d3.select("#hide-unselected").on("click", partial(this.hideUnselectedAction, graph));
129 d3.select("#hide-selected").on("click", partial(this.hideSelectedAction, gra ph)); 130 d3.select("#hide-selected").on("click", partial(this.hideSelectedAction, gra ph));
130 d3.select("#zoom-selection").on("click", partial(this.zoomSelectionAction, g raph)); 131 d3.select("#zoom-selection").on("click", partial(this.zoomSelectionAction, g raph));
131 d3.select("#toggle-types").on("click", partial(this.toggleTypesAction, graph )); 132 d3.select("#toggle-types").on("click", partial(this.toggleTypesAction, graph ));
132 d3.select("#search-input").on("keydown", partial(this.searchInputAction, gra ph)); 133 d3.select("#search-input").on("keydown", partial(this.searchInputAction, gra ph));
133 134
134 // listen for key events 135 // listen for key events
135 d3.select(window).on("keydown", function(e){ 136 d3.select(window).on("keydown", function(e){
136 graph.svgKeyDown.call(graph); 137 graph.svgKeyDown.call(graph);
137 }) 138 })
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 graph.viewWholeGraph(); 457 graph.viewWholeGraph();
457 } 458 }
458 459
459 showAllAction(graph) { 460 showAllAction(graph) {
460 graph.nodes.filter(function(n) { n.visible = true; }) 461 graph.nodes.filter(function(n) { n.visible = true; })
461 graph.edges.filter(function(e) { e.visible = true; }) 462 graph.edges.filter(function(e) { e.visible = true; })
462 graph.updateGraphVisibility(); 463 graph.updateGraphVisibility();
463 graph.viewWholeGraph(); 464 graph.viewWholeGraph();
464 } 465 }
465 466
467 hideDeadAction(graph) {
468 graph.nodes.filter(function(n) { if (!n.live) n.visible = false; })
469 graph.updateGraphVisibility();
470 }
471
466 hideUnselectedAction(graph) { 472 hideUnselectedAction(graph) {
467 var unselected = graph.visibleNodes.filter(function(n) { 473 var unselected = graph.visibleNodes.filter(function(n) {
468 return !this.classList.contains("selected"); 474 return !this.classList.contains("selected");
469 }); 475 });
470 unselected.each(function(n) { 476 unselected.each(function(n) {
471 n.visible = false; 477 n.visible = false;
472 }); 478 });
473 graph.updateGraphVisibility(); 479 graph.updateGraphVisibility();
474 } 480 }
475 481
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 graph.visibleNodes.attr("transform", function(n){ 724 graph.visibleNodes.attr("transform", function(n){
719 return "translate(" + n.x + "," + n.y + ")"; 725 return "translate(" + n.x + "," + n.y + ")";
720 }).select('rect'). 726 }).select('rect').
721 attr(HEIGHT, function(d) { return graph.getNodeHeight(); }); 727 attr(HEIGHT, function(d) { return graph.getNodeHeight(); });
722 728
723 // add new nodes 729 // add new nodes
724 var newGs = graph.visibleNodes.enter() 730 var newGs = graph.visibleNodes.enter()
725 .append("g"); 731 .append("g");
726 732
727 newGs.classed("control", function(n) { return n.isControl(); }) 733 newGs.classed("control", function(n) { return n.isControl(); })
734 .classed("live", function(n) { return n.isLive(); })
735 .classed("dead", function(n) { return !n.isLive(); })
728 .classed("javascript", function(n) { return n.isJavaScript(); }) 736 .classed("javascript", function(n) { return n.isJavaScript(); })
729 .classed("input", function(n) { return n.isInput(); }) 737 .classed("input", function(n) { return n.isInput(); })
730 .classed("simplified", function(n) { return n.isSimplified(); }) 738 .classed("simplified", function(n) { return n.isSimplified(); })
731 .classed("machine", function(n) { return n.isMachine(); }) 739 .classed("machine", function(n) { return n.isMachine(); })
732 .attr("transform", function(d){ return "translate(" + d.x + "," + d.y + ") ";}) 740 .attr("transform", function(d){ return "translate(" + d.x + "," + d.y + ") ";})
733 .on("mousedown", function(d){ 741 .on("mousedown", function(d){
734 graph.nodeMouseDown.call(graph, d3.select(this), d); 742 graph.nodeMouseDown.call(graph, d3.select(this), d);
735 }) 743 })
736 .on("mouseup", function(d){ 744 .on("mouseup", function(d){
737 graph.nodeMouseUp.call(graph, d3.select(this), d); 745 graph.nodeMouseUp.call(graph, d3.select(this), d);
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 } 1010 }
1003 1011
1004 viewWholeGraph() { 1012 viewWholeGraph() {
1005 var graph = this; 1013 var graph = this;
1006 var minScale = graph.minScale(); 1014 var minScale = graph.minScale();
1007 var translation = [0, 0]; 1015 var translation = [0, 0];
1008 translation = graph.getVisibleTranslation(translation, minScale); 1016 translation = graph.getVisibleTranslation(translation, minScale);
1009 graph.translateClipped(translation, minScale); 1017 graph.translateClipped(translation, minScale);
1010 } 1018 }
1011 } 1019 }
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-osr.cc ('k') | tools/turbolizer/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698