Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: f3b792ece3b92bd77169413bc240b83ac32bde5a
https://github.com/WebKit/WebKit/commit/f3b792ece3b92bd77169413bc240b83ac32bde5a
Author: Yusuke Suzuki <[email protected]>
Date: 2026-03-06 (Fri, 06 Mar 2026)
Changed paths:
M Source/WTF/wtf/Deque.h
M Tools/TestWebKitAPI/Tests/WTF/Deque.cpp
Log Message:
-----------
[WTF] Make Deque branchless
https://bugs.webkit.org/show_bug.cgi?id=309385
rdar://171932808
Reviewed by Dan Hecht.
Let's use the similar techniques used in HashMap.
By extending the storage x2, we can use bit-mask to round the cursor in
the Deque, which allows branchless operations in the many hot code in
Deque. Memory benchmark is neutral.
Test: Tools/TestWebKitAPI/Tests/WTF/Deque.cpp
* Source/WTF/wtf/Deque.h:
(WTF::inlineCapacity>::checkValidity const):
(WTF::inlineCapacity>::Deque):
(WTF::inlineCapacity>::swap):
(WTF::inlineCapacity>::clear):
(WTF::inlineCapacity>::expandCapacityIfNeeded):
(WTF::inlineCapacity>::expandCapacity):
(WTF::inlineCapacity>::append):
(WTF::inlineCapacity>::prepend):
(WTF::inlineCapacity>::removeFirst):
(WTF::inlineCapacity>::removeLast):
(WTF::inlineCapacity>::remove):
(WTF::inlineCapacity>::increment):
(WTF::inlineCapacity>::decrement):
(WTF::inlineCapacity>::before const):
* Tools/TestWebKitAPI/Tests/WTF/Deque.cpp:
(TestWebKitAPI::TEST(WTF_Deque, WrapAroundAppendRemove)):
(TestWebKitAPI::TEST(WTF_Deque, WrapAroundExpansion)):
(TestWebKitAPI::TEST(WTF_Deque, InlineCapacityNonPowerOfTwo)):
(TestWebKitAPI::TEST(WTF_Deque, StressAppendPrepend)):
Canonical link: https://commits.webkit.org/308841@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications