diff --git a/src/content/profile-data.js b/src/content/profile-data.js index f8035b94db..d075ced167 100644 --- a/src/content/profile-data.js +++ b/src/content/profile-data.js @@ -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]); }