WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
245925
[JSC] Optimization for class static block
https://bugs.webkit.org/show_bug.cgi?id=245925
Summary
[JSC] Optimization for class static block
Yijia Huang
Reported
2022-10-01 00:42:45 PDT
There are two possible optimizations in current implementation. Given the JS program: ``` class C { static { } static { } } ``` The corresponding emitted bytecode for evaluating class field initializations and static blocks. ``` bb#1 Predecessors: [ ] [ 0] enter [ 1] get_scope dst:loc4 [ 3] mov dst:loc5, src:loc4 [ 6] check_traps [ 7] get_by_id dst:loc6, base:callee, property:0 [ 12] new_func_exp dst:loc7, scope:loc4, functionDecl:0 [ 16] put_by_id base:loc7, property:0, value:loc6, flags:Strict [ 22] mov dst:loc8, src:this [ 25] call dst:loc7, callee:loc7, argc:1, argv:14 [ 31] get_by_id dst:loc6, base:callee, property:0 [ 36] new_func_exp dst:loc7, scope:loc4, functionDecl:1 [ 40] put_by_id base:loc7, property:0, value:loc6, flags:Strict [ 46] mov dst:loc8, src:this [ 49] call dst:loc7, callee:loc7, argc:1, argv:14 [ 55] ret value:Undefined(const0) Successors: [ ] Identifiers: id0 = PrivateSymbol.homeObject Constants: k0 = Undefined ``` where `[ 7] get_by_id dst:loc6, base:callee, property:0` and `[ 31] get_by_id dst:loc6, base:callee, property:0` are redundant. And if the static block is empty, we should not emit the function call bytecode. Maybe we can do these optimizations in another path.
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2022-10-08 00:43:16 PDT
<
rdar://problem/100928750
>
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