MCPcopy Index your code
hub / github.com/nodejs/node / initNodes

Method initNodes

deps/v8/tools/turbolizer/src/graph-layout.ts:64–96  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

62 }
63
64 private initNodes(): [Array<GraphNode>, Array<GraphNode>] {
65 // First determine the set of nodes that have no outputs. Those are the
66 // basis for bottom-up DFS to determine rank and node placement.
67 const endNodesHasNoOutputs = new Array<boolean>();
68 const startNodesHasNoInputs = new Array<boolean>();
69 for (const node of this.graph.nodes()) {
70 endNodesHasNoOutputs[node.id] = true;
71 startNodesHasNoInputs[node.id] = true;
72 }
73 this.graph.forEachEdge((edge: GraphEdge) => {
74 endNodesHasNoOutputs[edge.source.id] = false;
75 startNodesHasNoInputs[edge.target.id] = false;
76 });
77
78 // Finialize the list of start and end nodes.
79 const endNodes = new Array<GraphNode>();
80 const startNodes = new Array<GraphNode>();
81 const visited = new Array<boolean>();
82 for (const node of this.graph.nodes()) {
83 if (endNodesHasNoOutputs[node.id]) {
84 endNodes.push(node);
85 }
86 if (startNodesHasNoInputs[node.id]) {
87 startNodes.push(node);
88 }
89 visited[node.id] = false;
90 node.rank = 0;
91 node.visitOrderWithinRank = 0;
92 node.outputApproach = C.MINIMUM_NODE_OUTPUT_APPROACH;
93 }
94 this.trace("layoutGraph init");
95 return [startNodes, endNodes];
96 }
97
98 private initWorkList(startNodes: Array<GraphNode>): void {
99 const workList = startNodes.slice();

Callers 1

fullRebuildMethod · 0.95

Calls 4

traceMethod · 0.95
forEachEdgeMethod · 0.80
nodesMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected