Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 0c51f43daa3b812261b117b60bdfeeeb8aee1b7d
https://github.com/WebKit/WebKit/commit/0c51f43daa3b812261b117b60bdfeeeb8aee1b7d
Author: Yusuke Suzuki <[email protected]>
Date: 2026-08-12 (Wed, 12 Aug 2026)
Changed paths:
A JSTests/wasm/stress/byte-loop-idiom-loop-osr.js
A JSTests/wasm/stress/byte-loop-idiom-recognition.js
M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
M Source/JavaScriptCore/runtime/OptionsList.h
A Source/JavaScriptCore/wasm/WasmByteLoopIdiom.h
M Source/JavaScriptCore/wasm/WasmOMGIRGenerator.cpp
Log Message:
-----------
[JSC] Quick pattern matching for byte-copy loop in OMG
https://bugs.webkit.org/show_bug.cgi?id=321468
rdar://184557364
Reviewed by Keith Miller.
Depending on toolchain, options etc., very naive byte-copy loop is
generated instead of wasm bulk-memory operations like memory.copy /
memory.fill. This patch does quick pattern matching, detecting it and
spreading MemoryCopy / MemoryFill operation with guards before the
actual naive loop. We just prepend the fast path with MemoryCopy
and MemoryFill since we do not know whether src and destination are
overlapping or not at runtime easily. So we need to check them, and we
need to fall back to the normal loop when it is overlapping badly.
The replacement can be turned off with the useWasmByteLoopReplacement
option.
Tests: JSTests/wasm/stress/byte-loop-idiom-recognition.js
JSTests/wasm/stress/byte-loop-idiom-loop-osr.js
* JSTests/wasm/stress/byte-loop-idiom-loop-osr.js: Added.
(async test.seed):
(async test.assertMemoryMatches):
(async test.copyMemmoveLike):
(async test.copyReplicating):
(async test.copyDownwards):
(async test.fillRegion):
(async test):
* JSTests/wasm/stress/byte-loop-idiom-recognition.js: Added.
(access):
(modelCopyForward):
(modelCopyBackward):
(modelFill):
(async test.seedWindow):
(async test.seedEverything):
(async test.assertMemoryMatches):
(async test.checkEveryCase):
(async test.assertTraps):
(async test):
* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
* Source/JavaScriptCore/runtime/OptionsList.h:
* Source/JavaScriptCore/wasm/WasmByteLoopIdiom.h: Added.
(JSC::Wasm::ByteLoopIdiom::isFill const):
(JSC::Wasm::ByteLoopIdiom::isBackward const):
(JSC::Wasm::ByteLoopIdiom::match):
(JSC::Wasm::ByteLoopIdiom::localsAreDistinct const):
(JSC::Wasm::ByteLoopIdiom::matchCopyForward):
(JSC::Wasm::ByteLoopIdiom::matchCopyBackward):
(JSC::Wasm::ByteLoopIdiom::matchFill):
* Source/JavaScriptCore/wasm/WasmOMGIRGenerator.cpp:
(JSC::Wasm::OMGIRGenerator::addMemoryFill):
(JSC::Wasm::OMGIRGenerator::emitMemoryFill):
(JSC::Wasm::OMGIRGenerator::addMemoryCopy):
(JSC::Wasm::OMGIRGenerator::emitMemoryCopy):
(JSC::Wasm::OMGIRGenerator::matchByteLoopIdiom):
(JSC::Wasm::OMGIRGenerator::emitByteLoopIdiom):
(JSC::Wasm::OMGIRGenerator::addLoop):
Canonical link: https://commits.webkit.org/319065@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications