Bug 203608 - codeBlock->expressionRangeForBytecodeIndex() returns wrong range for op_get_from_arguments
Summary: codeBlock->expressionRangeForBytecodeIndex() returns wrong range for op_get_f...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-30 07:05 PDT by Tuomas Karkkainen
Modified: 2019-10-30 11:40 PDT (History)
3 users (show)

See Also:


Attachments
repro case (61 bytes, application/x-javascript)
2019-10-30 07:05 PDT, Tuomas Karkkainen
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tuomas Karkkainen 2019-10-30 07:05:46 PDT
Created attachment 382305 [details]
repro case

for the JavaScript:

> function foo(a0) {
>   typeof a0;
>   arguments;
> }
> foo();
> foo();

the bytecode is:

> foo#ES8iwE:[0x10d9a0140->0x10d9c7b80, NoneFunctionCall, 19]: 8 instructions (0 16-bit instructions, 0 32-bit instructions, 1 instructions with metadata); 127 bytes (108 metadata bytes); 2 parameter(s); 10 callee register(s); 8 variable(s); scope at loc4
> [   0] enter
> [   1] get_scope          loc4
> [   3] mov                loc5, loc4
> [   6] check_traps
> [   7] create_direct_arguments loc6
> [   9] mov                loc7, loc6
> [  12] get_from_arguments loc8, loc6, 0
> [  17] ret                Undefined(const0)
> 
> Constants:
>    k0 = Undefined

output of codeBlock->unlinkedCodeBlock()->dumpExpressionRangeInfo() is:

> UnlinkedCodeBlock 0x10d998000 expressionRangeInfo[0] {
> }

for the get_from_arguments at #12, codeBlock->expressionRangeForBytecodeIndex returns a zero length string located at the second 'o' on the first line.


for the JavaScript:

> function foo(a0) {
>   a0;
>   arguments;
> }
> foo();
> foo();

the bytecode is identical, but output of codeBlock->unlinkedCodeBlock()->dumpExpressionRangeInfo() is:

> UnlinkedCodeBlock 0x111398000 expressionRangeInfo[1] {
>   [0] pc 12 @ line 1 col 4 : op_get_from_arguments
> }

and codeBlock->expressionRangeForBytecodeIndex() references 'a0' on the second line as expected