[Webkit-unassigned] [Bug 192844] Update code style guidelines for using 'final' specifier for all classes which has no derived classes
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Dec 19 02:00:15 PST 2018
https://bugs.webkit.org/show_bug.cgi?id=192844
Yusuke Suzuki <yusukesuzuki at slowstart.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |yusukesuzuki at slowstart.org
--- Comment #1 from Yusuke Suzuki <yusukesuzuki at slowstart.org> ---
I would like to note the one interesting optimization done in JSC to encourage `final` use in WebKit.
If the class is annotated as "final", we can ensure that there are no derived class.
This information can be leveraged by type_traits' reflection mechanism (std::is_final) and it can optimize some code in JSC.
If we have `jsDynamicCast<T>`, and T is final class, the check should not traverse the type hierarchy at runtime. We just check the given JSObject's type is the T's classInfo, and if this check fails, we can say that the given JSObject is not a subclass of T.
So, if you put `final` to JS object classes, it can optimize type checks.
https://trac.webkit.org/changeset/229413/webkit
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20181219/1554af06/attachment.html>
More information about the webkit-unassigned
mailing list