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

Method addStack

deps/v8/tools/profview/profile-utils.js:340–395  ·  view source on GitHub ↗
(file, tickIndex)

Source from the content-addressed store, hash-verified

338 }
339
340 addStack(file, tickIndex) {
341 let stack = file.ticks[tickIndex].s;
342 let vmState = file.ticks[tickIndex].vm;
343
344 this.tree.ticks++;
345 let child = null;
346 let tree = null;
347 for (let i = stack.length - 2; i >= 0; i -= 2) {
348 let codeId = stack[i];
349 if (codeId < 0 || this.codeVisited[codeId]) continue;
350
351 let code = file.code[codeId];
352 if (this.filter) {
353 let type = code ? code.type : undefined;
354 let kind = code ? code.kind : undefined;
355 if (!this.filter(type, kind)) continue;
356 }
357 let childId = childIdFromCode(codeId, code);
358 if (this.categories) {
359 let kind = resolveCodeKindAndVmState(code, vmState);
360 tree = this.categories[kind];
361 } else {
362 tree = this.tree;
363 }
364 child = tree.children[childId];
365 if (!child) {
366 child = createNodeFromStackEntry(code, codeId, vmState);
367 child.children[0] = createEmptyNode("Top-down tree");
368 child.children[0].delayedExpansion =
369 { frameList : [], ascending : false };
370 child.children[1] = createEmptyNode("Bottom-up tree");
371 child.children[1].delayedExpansion =
372 { frameList : [], ascending : true };
373 tree.children[childId] = child;
374 }
375 child.ticks++;
376 child.children[0].ticks++;
377 addFrameToFrameList(
378 child.children[0].delayedExpansion.frameList, tickIndex, i);
379 child.children[1].ticks++;
380 addFrameToFrameList(
381 child.children[1].delayedExpansion.frameList, tickIndex, i);
382 this.codeVisited[codeId] = true;
383 }
384 if (child) {
385 child.ownTicks++;
386 console.assert(tree !== null);
387 tree.ticks++;
388 console.assert(tree.type === "CAT");
389 }
390
391 for (let i = 0; i < stack.length; i += 2) {
392 let codeId = stack[i];
393 if (codeId >= 0) this.codeVisited[codeId] = false;
394 }
395 }
396}
397

Callers

nothing calls this directly

Calls 7

childIdFromCodeFunction · 0.85
createNodeFromStackEntryFunction · 0.85
createEmptyNodeFunction · 0.85
addFrameToFrameListFunction · 0.85
assertMethod · 0.80
filterMethod · 0.65

Tested by

no test coverage detected