WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED CONFIGURATION CHANGED
203664
codeBlock->expressionRangeForBytecodeIndex() returns wrong range for op_rshift and op_lshift
https://bugs.webkit.org/show_bug.cgi?id=203664
Summary
codeBlock->expressionRangeForBytecodeIndex() returns wrong range for op_rshif...
Tuomas Karkkainen
Reported
2019-10-30 23:05:40 PDT
Created
attachment 382430
[details]
repro case for the JavaScript:
> function bar() {} > > function foo() { > let z = 0; > z >>= 0; > z <<= 0; > bar(); > for (let i=0; i<100; i++) {} > } > > foo();
the bytecode is:
> foo#DbrI6W:[0x1119a0140->0x1119c7c00, NoneFunctionCall, 64]: 19 instructions (0 16-bit instructions, 0 32-bit instructions, 5 instructions with metadata); 172 bytes (108 metadata bytes); 1 parameter(s); 14 callee register(s); 6 variable(s); scope at loc4 > [ 0] enter > [ 1] get_scope loc4 > [ 3] mov loc5, loc4 > [ 6] check_traps > [ 7] mov loc6, <JSValue()>(const0) > [ 10] mov loc6, Int32: 0(const1) > [ 13] rshift loc6, loc6, Int32: 0(const1) > [ 18] lshift loc6, loc6, Int32: 0(const1) > [ 23] resolve_scope loc8, loc4, 0, GlobalProperty, 0 > [ 30] get_from_scope loc7, loc8, 0, 2048<ThrowIfNotFound|GlobalProperty|NotInitialization>, 0, 0 > [ 38] call loc7, loc7, 1, 14 > [ 44] mov loc7, <JSValue()>(const0) > [ 47] mov loc7, Int32: 0(const1) > [ 50] jnless loc7, Int32: 100(const2), 12(->62) > [ 54] loop_hint > [ 55] check_traps > [ 56] inc loc7 > [ 58] jless loc7, Int32: 100(const2), -4(->54) > [ 62] ret Undefined(const3) > > Identifiers: > id0 = bar > > Constants: > k0 = <JSValue()> > k1 = Int32: 0: in source as integer > k2 = Int32: 100: in source as integer > k3 = Undefined
output of codeBlock->unlinkedCodeBlock()->dumpExpressionRangeInfo() is:
> UnlinkedCodeBlock 0x111998000 expressionRangeInfo[4] { > [0] pc 23 @ line 4 col 5 : op_resolve_scope > [1] pc 38 @ line 4 col 5 : op_call > [2] pc 50 @ line 5 col 16 : op_jnless > [3] pc 58 @ line 5 col 16 : op_jless > }
codeBlock->expressionRangeForBytecodeIndex() returns:
> #13 op_rshift divot: 76 startOffset: 3 endOffset: 0 source: 'bar' > #18 op_lshift divot: 76 startOffset: 3 endOffset: 0 source: 'bar'
afaik correct source should be:
> #13: "z >>= 0" > #18: "z <<= 0"
for the non-assignment op_lshift and op_rshift codeBlock->expressionRangeForBytecodeIndex() points to a zero length string at the beginning of the expression.
Attachments
repro case
(121 bytes, application/x-javascript)
2019-10-30 23:05 PDT
,
Tuomas Karkkainen
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Yusuke Suzuki
Comment 1
2023-07-28 23:16:58 PDT
These bytecodes no longer have ValueProfile.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug