RESOLVED FIXED 221121
Devirtualize some functions on InputType
https://bugs.webkit.org/show_bug.cgi?id=221121
Summary Devirtualize some functions on InputType
Simon Fraser (smfr)
Reported 2021-01-28 22:04:53 PST
Devirtualize some functions on InputType
Attachments
Patch (43.35 KB, patch)
2021-01-28 22:06 PST, Simon Fraser (smfr)
no flags
Patch (49.32 KB, patch)
2021-01-29 10:20 PST, Simon Fraser (smfr)
ysuzuki: review+
Patch (49.49 KB, patch)
2021-01-29 11:53 PST, Simon Fraser (smfr)
no flags
Simon Fraser (smfr)
Comment 1 2021-01-28 22:06:17 PST
Ryosuke Niwa
Comment 2 2021-01-28 22:18:12 PST
Can use bitfields & OptionSet??
Simon Fraser (smfr)
Comment 3 2021-01-28 23:11:44 PST
Do you want a bit per Type, and then masks for isTextType etc?
Yusuke Suzuki
Comment 4 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 %
Ryosuke Niwa
Comment 5 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.
Simon Fraser (smfr)
Comment 6 2021-01-29 10:20:52 PST
Yusuke Suzuki
Comment 7 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.
Simon Fraser (smfr)
Comment 8 2021-01-29 11:53:17 PST
EWS
Comment 9 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].
Radar WebKit Bug Importer
Comment 10 2021-01-29 19:11:13 PST
Note You need to log in before you can comment on or make changes to this bug.