Bug 221121 - Devirtualize some functions on InputType
Summary: Devirtualize some functions on InputType
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Simon Fraser (smfr)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-01-28 22:04 PST by Simon Fraser (smfr)
Modified: 2021-01-29 19:11 PST (History)
13 users (show)

See Also:


Attachments
Patch (43.35 KB, patch)
2021-01-28 22:06 PST, Simon Fraser (smfr)
no flags Details | Formatted Diff | Diff
Patch (49.32 KB, patch)
2021-01-29 10:20 PST, Simon Fraser (smfr)
ysuzuki: review+
Details | Formatted Diff | Diff
Patch (49.49 KB, patch)
2021-01-29 11:53 PST, Simon Fraser (smfr)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2021-01-28 22:04:53 PST
Devirtualize some functions on InputType
Comment 1 Simon Fraser (smfr) 2021-01-28 22:06:17 PST
Created attachment 418705 [details]
Patch
Comment 2 Ryosuke Niwa 2021-01-28 22:18:12 PST
Can use bitfields & OptionSet??
Comment 3 Simon Fraser (smfr) 2021-01-28 23:11:44 PST
Do you want a bit per Type, and then masks for isTextType etc?
Comment 4 Yusuke Suzuki 2021-01-29 02:05:35 PST
Possibly, using uint32_t width for InputType::Type and using OptionSet to filter out several types (e.g. isTextType(), isSteppable() etc.) would be OK because of the current InputType layout.

  +0 < 24> WebCore::InputType
  +0 <  8>    __vtbl_ptr_type * _vptr
  +8 <  4>     WTF::RefCounted<WebCore::InputType, std::__1::default_delete<WebCore::InputType> > WTF::RefCounted<WebCore::InputType, std::__1::default_delete<WebCore::InputType> >
  +8 <  4>         WTF::RefCountedBase WTF::RefCountedBase
  +8 <  4>           unsigned int m_refCount
 +12 <  1>   const WebCore::InputType::Type m_type
 +13 <  3>   <PADDING: 3 bytes>
 +16 <  8>     WTF::WeakPtr<WebCore::HTMLInputElement, WTF::EmptyCounter> m_element
 +16 <  8>         WTF::RefPtr<WTF::WeakPtrImpl<WTF::EmptyCounter>, WTF::RawPtrTraits<WTF::WeakPtrImpl<WTF::EmptyCounter> >, WTF::DefaultRefDerefTraits<WTF::WeakPtrImpl<WTF::EmptyCounter> > > m_impl
 +16 <  8>           WTF::RawPtrTraits<WTF::WeakPtrImpl<WTF::EmptyCounter> >::StorageType m_ptr
Total byte size: 24
Total pad bytes: 3
Padding percentage: 12.50 %
Comment 5 Ryosuke Niwa 2021-01-29 02:07:13 PST
(In reply to Simon Fraser (smfr) from comment #3)
> Do you want a bit per Type, and then masks for isTextType etc?

Yeah, that would work. Alternatively, we can just define an enum value for each type, and then things like Type::Text can just be its (own bit flag) | Type::IsTextType and so forth.
Comment 6 Simon Fraser (smfr) 2021-01-29 10:20:52 PST
Created attachment 418747 [details]
Patch
Comment 7 Yusuke Suzuki 2021-01-29 11:21:26 PST
Comment on attachment 418747 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=418747&action=review

r=me

> Source/WebCore/html/InputType.h:162
> +    bool isDateTimeField() const { return false; }

Let's remove this `isDateTimeField` since "input datetime" is not supported in WebKit, and possibly never supported since it is deprecated.

> Source/WebCore/html/InputType.h:322
>      virtual bool isEnumeratable();

Let's make isEnumeratable non-virtual since it is no longer using virtual overrides.
Comment 8 Simon Fraser (smfr) 2021-01-29 11:53:17 PST
Created attachment 418752 [details]
Patch
Comment 9 EWS 2021-01-29 19:10:08 PST
Committed r272097: <https://trac.webkit.org/changeset/272097>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 418752 [details].
Comment 10 Radar WebKit Bug Importer 2021-01-29 19:11:13 PST
<rdar://problem/73781798>