-
-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(profiling): Parse Hermes Bytecode frames virtual address (#3342)
- Loading branch information
1 parent
21465bc
commit 5446992
Showing
5 changed files
with
107 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,62 @@ | ||
import { parseHermesStackFrameFunctionName } from '../../src/js/profiling/hermes'; | ||
import type { ParsedHermesStackFrame } from '../../src/js/profiling/hermes'; | ||
import { parseHermesJSStackFrame } from '../../src/js/profiling/hermes'; | ||
|
||
describe('hermes', () => { | ||
describe('parseHermesStackFrameName', () => { | ||
test('parses function name and file name', () => { | ||
expect(parseHermesStackFrameFunctionName('fooA(/absolute/path/main.jsbundle:1610:33)')).toEqual('fooA'); | ||
expect( | ||
parseHermesJSStackFrame({ | ||
name: 'fooA(/absolute/path/main.jsbundle:1610:33)', | ||
line: '1610', | ||
column: '33', | ||
category: 'JavaScript', | ||
}), | ||
).toEqual(<ParsedHermesStackFrame>{ | ||
function: 'fooA', | ||
file: 'app:///main.jsbundle', | ||
lineno: 1610, | ||
colno: 33, | ||
}); | ||
}); | ||
test('parse hermes root stack frame', () => { | ||
expect(parseHermesStackFrameFunctionName('[root]')).toEqual('[root]'); | ||
expect( | ||
parseHermesJSStackFrame({ | ||
name: '[root]', | ||
category: 'root', | ||
}), | ||
).toEqual( | ||
expect.objectContaining(<ParsedHermesStackFrame>{ | ||
function: '[root]', | ||
}), | ||
); | ||
}); | ||
test('parse only file name', () => { | ||
expect(parseHermesStackFrameFunctionName('(/absolute/path/jsbundle:1610:33)')).toEqual(''); | ||
expect( | ||
parseHermesJSStackFrame({ | ||
name: '(/absolute/path/main.jsbundle:1610:33)', | ||
line: '1610', | ||
column: '33', | ||
category: 'JavaScript', | ||
}), | ||
).toEqual(<ParsedHermesStackFrame>{ | ||
function: 'anonymous', | ||
file: 'app:///main.jsbundle', | ||
lineno: 1610, | ||
colno: 33, | ||
}); | ||
}); | ||
test('parse only function name', () => { | ||
expect(parseHermesStackFrameFunctionName('fooA')).toEqual('fooA'); | ||
expect( | ||
parseHermesJSStackFrame({ | ||
name: 'fooA', | ||
category: 'JavaScript', | ||
}), | ||
).toEqual( | ||
expect.objectContaining(<ParsedHermesStackFrame>{ | ||
function: 'fooA', | ||
file: 'app:///main.jsbundle', | ||
}), | ||
); | ||
}); | ||
}); | ||
}); |