[webkit-changes] [WebKit/WebKit] 6006aa: Generated IPC decoders check the decode success twice
Kimmo Kinnunen
noreply at github.com
Mon Jul 3 06:35:11 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 6006aa6aa0f6985b11051239c449ec95571ddecd
https://github.com/WebKit/WebKit/commit/6006aa6aa0f6985b11051239c449ec95571ddecd
Author: Kimmo Kinnunen <kkinnunen at apple.com>
Date: 2023-07-03 (Mon, 03 Jul 2023)
Changed paths:
M Source/WebKit/Scripts/generate-serializers.py
M Source/WebKit/Scripts/webkit/tests/GeneratedSerializers.cpp
Log Message:
-----------
Generated IPC decoders check the decode success twice
https://bugs.webkit.org/show_bug.cgi?id=258604
rdar://problem/111434133
Reviewed by Alex Christensen.
The check would be like:
decode property
check success
decode property
check success
On first decode error, the subsequent decodes will fail as per design.
Thus we can omit the redundant caller checks and check only once after
series of decodes, before using the decoded properties.
Instead of checking each decode operation result, check as follows:
decode properties
if (!decoder.isValid())
return std::nullopt;
use properties
decode more properties
if (!decoder.isValid())
return std::nullopt;
use properties
This should, very slightly, optimize for the standard case of all
decodes succeeding.
* Source/WebKit/Scripts/generate-serializers.py:
(decode_type):
(generate_impl):
* Source/WebKit/Scripts/webkit/tests/GeneratedSerializers.cpp:
(IPC::ArgumentCoder<Namespace::Subnamespace::StructName>::decode):
(IPC::ArgumentCoder<Namespace::OtherClass>::decode):
(IPC::ArgumentCoder<Namespace::ReturnRefClass>::decode):
(IPC::ArgumentCoder<Namespace::EmptyConstructorStruct>::decode):
(IPC::ArgumentCoder<Namespace::EmptyConstructorNullable>::decode):
(IPC::ArgumentCoder<WithoutNamespace>::decode):
(IPC::ArgumentCoder<WithoutNamespaceWithAttributes>::decode):
(IPC::ArgumentCoder<WebCore::InheritsFrom>::decode):
(IPC::ArgumentCoder<WebCore::InheritanceGrandchild>::decode):
(IPC::ArgumentCoder<WTF::Seconds>::decode):
(IPC::ArgumentCoder<WTF::CreateUsingClass>::decode):
(IPC::ArgumentCoder<WebCore::FloatBoxExtent>::decode):
(IPC::ArgumentCoder<NullableSoftLinkedMember>::decode):
(IPC::ArgumentCoder<WebCore::TimingFunction>::decode):
(IPC::ArgumentCoder<Namespace::ConditionalCommonClass>::decode):
(IPC::ArgumentCoder<Namespace::CommonClass>::decode):
(IPC::ArgumentCoder<Namespace::AnotherCommonClass>::decode):
(IPC::ArgumentCoder<WebCore::MoveOnlyBaseClass>::decode):
(IPC::ArgumentCoder<WebCore::MoveOnlyDerivedClass>::decode):
Canonical link: https://commits.webkit.org/265717@main
More information about the webkit-changes
mailing list