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

Side by Side Diff: tools/turbolizer/node.js

Issue 2230313002: [turbolizer] Enlarge node labels and bubbles. Fix dead node display on old JSON. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@t-p2-base
Patch Set: Fix arrowheads. Fix dead nodes on old JSONs. 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 | « tools/turbolizer/graph-view.js ('k') | tools/turbolizer/turbo-visualizer.css » ('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 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 var DEFAULT_NODE_WIDTH = 240;
6 var DEFAULT_NODE_HEIGHT = 40;
7 var TYPE_HEIGHT = 25; 5 var TYPE_HEIGHT = 25;
8 var DEFAULT_NODE_BUBBLE_RADIUS = 4; 6 var DEFAULT_NODE_BUBBLE_RADIUS = 12;
9 var NODE_INPUT_WIDTH = 20; 7 var NODE_INPUT_WIDTH = 50;
10 var MINIMUM_NODE_INPUT_APPROACH = 20; 8 var MINIMUM_NODE_INPUT_APPROACH = 15 + 2 * DEFAULT_NODE_BUBBLE_RADIUS;
11 var MINIMUM_NODE_OUTPUT_APPROACH = 15; 9 var MINIMUM_NODE_OUTPUT_APPROACH = 15;
12 10
13 function isNodeInitiallyVisible(node) { 11 function isNodeInitiallyVisible(node) {
14 return node.cfg; 12 return node.cfg;
15 } 13 }
16 14
17 var Node = { 15 var Node = {
18 isControl: function() { 16 isControl: function() {
19 return this.control; 17 return this.control;
20 }, 18 },
21 isInput: function() { 19 isInput: function() {
22 return this.opcode == 'Parameter' || this.opcode.endsWith('Constant'); 20 return this.opcode == 'Parameter' || this.opcode.endsWith('Constant');
23 }, 21 },
24 isLive: function() { 22 isLive: function() {
25 return this.live; 23 return this.live !== false;
26 }, 24 },
27 isJavaScript: function() { 25 isJavaScript: function() {
28 return this.opcode.startsWith('JS'); 26 return this.opcode.startsWith('JS');
29 }, 27 },
30 isSimplified: function() { 28 isSimplified: function() {
31 if (this.isJavaScript) return false; 29 if (this.isJavaScript) return false;
32 return this.opcode.endsWith('Phi') || 30 return this.opcode.endsWith('Phi') ||
33 this.opcode.startsWith('Boolean') || 31 this.opcode.startsWith('Boolean') ||
34 this.opcode.startsWith('Number') || 32 this.opcode.startsWith('Number') ||
35 this.opcode.startsWith('String') || 33 this.opcode.startsWith('String') ||
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 return true; 118 return true;
121 } 119 }
122 } 120 }
123 return false; 121 return false;
124 }, 122 },
125 getInputApproach: function(index) { 123 getInputApproach: function(index) {
126 return this.y - MINIMUM_NODE_INPUT_APPROACH - 124 return this.y - MINIMUM_NODE_INPUT_APPROACH -
127 (index % 4) * MINIMUM_EDGE_SEPARATION - DEFAULT_NODE_BUBBLE_RADIUS 125 (index % 4) * MINIMUM_EDGE_SEPARATION - DEFAULT_NODE_BUBBLE_RADIUS
128 }, 126 },
129 getOutputApproach: function(graph, index) { 127 getOutputApproach: function(graph, index) {
130 return this.y + this.outputApproach + graph.getNodeHeight() + 128 return this.y + this.outputApproach + graph.getNodeHeight(this) +
131 + DEFAULT_NODE_BUBBLE_RADIUS; 129 + DEFAULT_NODE_BUBBLE_RADIUS;
132 }, 130 },
133 getInputX: function(index) { 131 getInputX: function(index) {
134 var result = this.getTotalNodeWidth() - (NODE_INPUT_WIDTH / 2) + 132 var result = this.getTotalNodeWidth() - (NODE_INPUT_WIDTH / 2) +
135 (index - this.inputs.length + 1) * NODE_INPUT_WIDTH; 133 (index - this.inputs.length + 1) * NODE_INPUT_WIDTH;
136 return result; 134 return result;
137 }, 135 },
138 getOutputX: function() { 136 getOutputX: function() {
139 return this.getTotalNodeWidth() - (NODE_INPUT_WIDTH / 2); 137 return this.getTotalNodeWidth() - (NODE_INPUT_WIDTH / 2);
140 }, 138 },
141 getFunctionRelativeSourcePosition: function(graph) { 139 getFunctionRelativeSourcePosition: function(graph) {
142 return this.pos - graph.sourcePosition; 140 return this.pos - graph.sourcePosition;
143 }, 141 },
144 hasBackEdges: function() { 142 hasBackEdges: function() {
145 return (this.opcode == "Loop") || 143 return (this.opcode == "Loop") ||
146 ((this.opcode == "Phi" || this.opcode == "EffectPhi") && 144 ((this.opcode == "Phi" || this.opcode == "EffectPhi") &&
147 this.inputs[this.inputs.length - 1].source.opcode == "Loop"); 145 this.inputs[this.inputs.length - 1].source.opcode == "Loop");
148 } 146 }
149 }; 147 };
OLDNEW
« no previous file with comments | « tools/turbolizer/graph-view.js ('k') | tools/turbolizer/turbo-visualizer.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698