You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
https://bugs.webkit.org/show_bug.cgi?id=249765
rdar://103631099
Reviewed by Mark Lam.
In ARM64, we are leveraging LDR style address, which can take 32bit index in addressing and zero-extend / sign-extend that in load/store.
This is useful since WasmAddress' index is 32bit and we need to zero-extend it. However, we cannot use this addressing when there is an
offset since this addressing cannot encode offset. As a result, we are emitting Move32 and Add64 when there is an offset.
However, ARM64 can do even better for that case since ARM64 add / sub instructions also support LDR style extension.
This patch adds AddZeroExtend64 and AddSignExtend64. They take 32bit second operand and extend it before adding. This is particularly useful
when computing WasmAddress. We also leverage this in AirIRGenerator.
In the added testb3, the generated code is changed as follows.
Before:
O2: testWasmAddressWithOffset()...
Generated JIT code for Compilation:
Code at [0x115f74980, 0x115f749a0):
<0> 0x115f74980: pacibsp
<4> 0x115f74984: stp fp, lr, [sp, #-16]!
<8> 0x115f74988: mov fp, sp
<12> 0x115f7498c: ubfx x0, x0, #0, WebKit#32; emitSave
<16> 0x115f74990: add x0, x2, x0
<20> 0x115f74994: sturb w1, [x0, WebKit#1]
<24> 0x115f74998: ldp fp, lr, [sp], WebKit#16
<28> 0x115f7499c: retab
After:
O2: testWasmAddressWithOffset()...
Generated JIT code for Compilation:
Code at [0x121108980, 0x1211089a0):
<0> 0x121108980: pacibsp
<4> 0x121108984: stp fp, lr, [sp, #-16]!
<8> 0x121108988: mov fp, sp
<12> 0x12110898c: add x0, x2, w0, uxtw; emitSave
<16> 0x121108990: sturb w1, [x0, WebKit#1]
<20> 0x121108994: ldp fp, lr, [sp], WebKit#16
<24> 0x121108998: retab
* Source/JavaScriptCore/assembler/MacroAssemblerARM64.h:
(JSC::MacroAssemblerARM64::addZeroExtend64):
(JSC::MacroAssemblerARM64::addSignExtend64):
* Source/JavaScriptCore/b3/B3LowerToAir.cpp:
* Source/JavaScriptCore/b3/air/AirInstInlines.h:
(JSC::B3::Air::isAddZeroExtend64Valid):
(JSC::B3::Air::isAddSignExtend64Valid):
* Source/JavaScriptCore/b3/air/AirOpcode.opcodes:
Canonical link: https://commits.webkit.org/258259@main
0 commit comments