Commit d0a638b1 authored by Jaroslav Sevcik's avatar Jaroslav Sevcik Committed by Commit Bot

[profview] Fix the source indexing with ids.

This addresses bunch of problems introduced by the attempt to
remove indexing by function names
https://chromium-review.googlesource.com/c/1267496.

Now I tested with the right version of the file :-)

Change-Id: Idfc8a17a0890d0453d14b949388c34c36a0b64f5
Reviewed-on: https://chromium-review.googlesource.com/c/1270575Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Jaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56463}
parent 1dbcc78e
......@@ -496,7 +496,9 @@ class CallTreeView {
nameCell.appendChild(createTypeNode(node.type));
nameCell.appendChild(createFunctionNode(node.name, node.codeId));
if (main.currentState.sourceData &&
main.currentState.sourceData.hasSource(node.name)) {
node.codeId >= 0 &&
main.currentState.sourceData.hasSource(
this.currentState.file.code[node.codeId].func)) {
nameCell.appendChild(createViewSourceNode(node.codeId));
}
......@@ -1369,7 +1371,7 @@ class SourceData {
this.functions = new Map();
for (let codeId = 0; codeId < file.code.length; ++codeId) {
let codeBlock = file.code[codeId];
if (codeBlock.source) {
if (codeBlock.source && codeBlock.func !== undefined) {
let data = this.functions.get(codeBlock.func);
if (!data) {
data = new FunctionSourceData(codeBlock.source.script,
......@@ -1386,7 +1388,7 @@ class SourceData {
for (let i = 0; i < stack.length; i += 2) {
let codeId = stack[i];
if (codeId < 0) continue;
let functionid = file.code[codeId].func;
let functionId = file.code[codeId].func;
if (this.functions.has(functionId)) {
let codeOffset = stack[i + 1];
this.functions.get(functionId).addOffsetSample(codeId, codeOffset);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment