Bug 183435 - [JSC] Optimize inherits<T> if T is final type
Summary: [JSC] Optimize inherits<T> if T is final type
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords: InRadar
Depends on: 183429
Blocks:
  Show dependency treegraph
 
Reported: 2018-03-08 01:32 PST by Yusuke Suzuki
Modified: 2018-03-08 10:25 PST (History)
7 users (show)

See Also:


Attachments
Patch (131.62 KB, patch)
2018-03-08 08:19 PST, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (130.93 KB, patch)
2018-03-08 09:22 PST, Yusuke Suzuki
mark.lam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 2018-03-08 01:32:56 PST
If T is a final type, we do not need to traverse hierarchy.

Consider a final type T,

jsDynamicCast<T*>(vm, cell);

in this case,

if (cell->classInfo(vm) == T::info())
    return static_cast<T*>(cell);
return nullptr;

is enough. We can this optimization in JSCast.h with std::is_final<T>.
Comment 1 Yusuke Suzuki 2018-03-08 08:19:34 PST
Created attachment 335299 [details]
Patch
Comment 2 Yusuke Suzuki 2018-03-08 09:22:47 PST
Created attachment 335304 [details]
Patch
Comment 3 Mark Lam 2018-03-08 10:04:56 PST
Comment on attachment 335304 [details]
Patch

r=me
Comment 4 Yusuke Suzuki 2018-03-08 10:22:48 PST
Thanks!
Comment 5 Yusuke Suzuki 2018-03-08 10:24:14 PST
Committed r229413: <https://trac.webkit.org/changeset/229413>
Comment 6 Radar WebKit Bug Importer 2018-03-08 10:25:26 PST
<rdar://problem/38267844>