Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: fc66e95983f642254604aae6b143f715e3b1e0a4
      
https://github.com/WebKit/WebKit/commit/fc66e95983f642254604aae6b143f715e3b1e0a4
  Author: Chris Dumez <[email protected]>
  Date:   2026-03-29 (Sun, 29 Mar 2026)

  Changed paths:
    M Source/WTF/wtf/FixedVector.h
    M Tools/TestWebKitAPI/Tests/WTF/FixedVector.cpp

  Log Message:
  -----------
  Remove redundant moves and dead code in FixedVector
https://bugs.webkit.org/show_bug.cgi?id=310966

Reviewed by Geoffrey Garen.

Two minor cleanups to FixedVector:

The move-from-Vector constructor and assignment operator moved the
source Vector into a local variable, only for createFromVector to
move it again into its own local. Remove the unnecessary intermediate.

The operator== had isEmpty() fallback branches for the case where
m_storage is non-null but empty. This is unreachable since every
constructor guards storage creation with a non-empty check. Replace
the dead branches with ASSERTs that document this invariant.

Also add test coverage for empty-Vector construction/assignment and
for comparing vectors of different sizes and empty vs non-empty.

Test: Tools/TestWebKitAPI/Tests/WTF/FixedVector.cpp

* Source/WTF/wtf/FixedVector.h:
(WTF::FixedVector::FixedVector):
(WTF::FixedVector::operator=):
(WTF::FixedVector::operator== const):
* Tools/TestWebKitAPI/Tests/WTF/FixedVector.cpp:
(TestWebKitAPI::TEST(WTF_FixedVector, MoveVectorEmpty)):
(TestWebKitAPI::TEST(WTF_FixedVector, MoveAssignVectorEmpty)):
(TestWebKitAPI::TEST(WTF_FixedVector, MoveAssignVectorOverNonEmpty)):
(TestWebKitAPI::TEST(WTF_FixedVector, EqualDifferentSizes)):
(TestWebKitAPI::TEST(WTF_FixedVector, EqualEmptyAndNonEmpty)):

Canonical link: https://commits.webkit.org/310181@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to