Skip to content

Commit

Permalink
Filter out jitcode from C++ only call tree; Resolves firefox-devtools…
Browse files Browse the repository at this point in the history
…#285 (firefox-devtools#292)

* Filter out jitcode from C++ only call tree

* Address review comments
  • Loading branch information
gregtatum authored May 3, 2017
1 parent 0371175 commit e3369ae
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/content/profile-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,24 @@ export function defaultThreadOrder(threads: Thread[]) {
}

export function filterThreadByImplementation(thread: Thread, implementation: string): Thread {
const { funcTable } = thread;
const { funcTable, stringTable } = thread;

switch (implementation) {
case 'cpp':
return _filterThreadByFunc(thread, funcIndex => !funcTable.isJS[funcIndex]);
return _filterThreadByFunc(thread, funcIndex => {
// Return quickly if this is a JS frame.
if (funcTable.isJS[funcIndex]) {
return false;
}
// Regular C++ functions are associated with a resource that describes the
// shared library that these C++ functions were loaded from. Jitcode is not
// loaded from shared libraries but instead generated at runtime, so Jitcode
// frames are not associated with a shared library and thus have no resource
const locationString = stringTable.getString(funcTable.name[funcIndex]);
const isProbablyJitCode =
funcTable.resource[funcIndex] === -1 && locationString.startsWith('0x');
return !isProbablyJitCode;
});
case 'js':
return _filterThreadByFunc(thread, funcIndex => funcTable.isJS[funcIndex]);
}
Expand Down

0 comments on commit e3369ae

Please sign in to comment.