Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 7a2375d28da42fb41b734a98cda029478f96b611
https://github.com/WebKit/WebKit/commit/7a2375d28da42fb41b734a98cda029478f96b611
Author: David Degazio <[email protected]>
Date: 2024-04-19 (Fri, 19 Apr 2024)
Changed paths:
M Source/JavaScriptCore/assembler/MacroAssembler.h
M Source/JavaScriptCore/assembler/MacroAssemblerRISCV64.h
M Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h
M Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h
M Source/JavaScriptCore/b3/B3Common.h
M Source/JavaScriptCore/b3/B3MemoryValue.cpp
M Source/JavaScriptCore/b3/B3ValueInlines.h
M Source/JavaScriptCore/b3/air/AirArg.h
M Source/JavaScriptCore/wasm/WasmBBQJIT.cpp
M Source/JavaScriptCore/wasm/WasmBBQJIT64.cpp
M Source/WTF/wtf/MathExtras.h
Log Message:
-----------
[WASM] Avoid extraneous move for simple integer arithmetic in BBQ
https://bugs.webkit.org/show_bug.cgi?id=272901
rdar://problem/126695575
Reviewed by Yusuke Suzuki.
Cleans up our code generation for integer add, subtract, bitwise ops,
and compare in the BBQ JIT. Specifically, we target the case where we
know we have one constant operand, and try and avoid a move.
- For i32.add, i32.and, i32.or, and i32.xor, we are currently doing totally
redundant work - three-operand nondestructive versions of all these opcodes
with an immediate are supported on all MacroAssembler targets, so we should
just use those.
- For i32.sub, we currently do a weird trick involving adding a negative.
The only real benefit of this is that for additions, we consider lowering as
a LEA instruction on x86 - in this patch, we add that to subtractions in the
MacroAssembler too.
- For 64-bit versions of these operations, most MacroAssembler targets do not
natively support 64-bit immediates. For those that do - ARM64 bitwise ops -
we carve out a special case. Otherwise, we now check if the immediate is
representable as a 32-bit immediate with no precision loss, and use the
32-bit
immediate form instead if so.
* Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h:
(JSC::MacroAssemblerX86Common::sub32):
* Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h:
(JSC::MacroAssemblerX86_64::sub64):
* Source/JavaScriptCore/b3/B3Common.h:
(JSC::B3::isIdentical): Deleted.
(JSC::B3::isRepresentableAsImpl): Deleted.
(JSC::B3::isRepresentableAs): Deleted.
* Source/JavaScriptCore/b3/B3MemoryValue.cpp:
(JSC::B3::MemoryValue::isLegalOffsetImpl const):
* Source/JavaScriptCore/b3/B3ValueInlines.h:
(JSC::B3::Value::isRepresentableAs const):
* Source/JavaScriptCore/b3/air/AirArg.h:
(JSC::B3::Air::Arg::isRepresentableAs const):
(JSC::B3::Air::Arg::isRepresentableAs):
(JSC::B3::Air::Arg::isValidImmForm):
(JSC::B3::Air::Arg::isValidBitImmForm):
(JSC::B3::Air::Arg::isValidBitImm64Form):
* Source/JavaScriptCore/wasm/WasmBBQJIT.cpp:
(JSC::Wasm::BBQJITImpl::BBQJIT::addI32Add):
(JSC::Wasm::BBQJITImpl::BBQJIT::addI32Sub):
(JSC::Wasm::BBQJITImpl::BBQJIT::addI32And):
(JSC::Wasm::BBQJITImpl::BBQJIT::addI32Xor):
(JSC::Wasm::BBQJITImpl::BBQJIT::addI32Or):
* Source/JavaScriptCore/wasm/WasmBBQJIT64.cpp:
(JSC::Wasm::BBQJITImpl::BBQJIT::addI64Add):
(JSC::Wasm::BBQJITImpl::BBQJIT::addI64Sub):
(JSC::Wasm::BBQJITImpl::BBQJIT::addI64And):
(JSC::Wasm::BBQJITImpl::BBQJIT::addI64Xor):
(JSC::Wasm::BBQJITImpl::BBQJIT::addI64Or):
(JSC::Wasm::BBQJITImpl::BBQJIT::emitCompareI64):
* Source/WTF/wtf/MathExtras.h:
(WTF::isIdentical):
(WTF::isRepresentableAsImpl):
(WTF::isRepresentableAs):
Canonical link: https://commits.webkit.org/277770@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes