Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/profile-logic/transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,9 @@ export function dropFunction(
const { stackTable, frameTable } = thread;

// Go through each stack, and label it as containing the function or not.
const stackContainsFunc: Array<void | true> = [];
// stackContainsFunc is a stackIndex => bool map, implemented as a U8 typed
// array for better performance. 0 means false, 1 means true.
const stackContainsFunc = new Uint8Array(stackTable.length);
for (let stackIndex = 0; stackIndex < stackTable.length; stackIndex++) {
const prefix = stackTable.prefix[stackIndex];
const frameIndex = stackTable.frame[stackIndex];
Expand All @@ -915,15 +917,15 @@ export function dropFunction(
// This is the function we want to remove.
funcIndex === funcIndexToDrop ||
// The parent of this stack contained the function.
(prefix !== null && stackContainsFunc[prefix])
(prefix !== null && stackContainsFunc[prefix] === 1)
) {
stackContainsFunc[stackIndex] = true;
stackContainsFunc[stackIndex] = 1;
}
}

return updateThreadStacks(thread, stackTable, (stack) =>
// Drop the stacks that contain that function.
stack !== null && stackContainsFunc[stack] ? null : stack
stack !== null && stackContainsFunc[stack] === 1 ? null : stack
);
}

Expand Down