Bug 179765 - Provide a runtime option for disabling the optimization of recursive tail calls
Summary: Provide a runtime option for disabling the optimization of recursive tail calls
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Robin Morisset
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-11-16 06:58 PST by Robin Morisset
Modified: 2017-11-16 09:16 PST (History)
7 users (show)

See Also:


Attachments
Patch (4.87 KB, patch)
2017-11-16 06:59 PST, Robin Morisset
no flags Details | Formatted Diff | Diff
Patch for landing (4.88 KB, patch)
2017-11-16 07:17 PST, Robin Morisset
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Morisset 2017-11-16 06:58:15 PST
This should make benchmarking and debugging this optimization a bit less painful.
Name of the option: optimizeRecursiveTailCalls
Comment 1 Robin Morisset 2017-11-16 06:59:36 PST
Created attachment 327060 [details]
Patch
Comment 2 Mark Lam 2017-11-16 07:04:07 PST
Comment on attachment 327060 [details]
Patch

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

r=me

> Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:1318
> +    if (Options::optimizeRecursiveTailCalls()) {

I suggest making this:
    if (LIKELY(Options::optimizeRecursiveTailCalls())) {

> Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:1425
> +    if (!Options::optimizeRecursiveTailCalls())

I suggest making this:
    if (UNLIKELY(!Options::optimizeRecursiveTailCalls()))
Comment 3 Robin Morisset 2017-11-16 07:17:10 PST
Created attachment 327062 [details]
Patch for landing
Comment 4 WebKit Commit Bot 2017-11-16 07:48:15 PST
Comment on attachment 327062 [details]
Patch for landing

Clearing flags on attachment: 327062

Committed r224918: <https://trac.webkit.org/changeset/224918>
Comment 5 WebKit Commit Bot 2017-11-16 07:48:16 PST
All reviewed patches have been landed.  Closing bug.
Comment 6 Radar WebKit Bug Importer 2017-11-16 07:49:27 PST
<rdar://problem/35588622>
Comment 7 Saam Barati 2017-11-16 08:18:41 PST
Comment on attachment 327062 [details]
Patch for landing

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

> Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:1425
> +    if (UNLIKELY(!Options::optimizeRecursiveTailCalls()))

Why reference this option anywhere else? Isn’t it only  here that we care?
Comment 8 Robin Morisset 2017-11-16 08:42:39 PST
(In reply to Saam Barati from comment #7)
> Comment on attachment 327062 [details]
> Patch for landing
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=327062&action=review
> 
> > Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:1425
> > +    if (UNLIKELY(!Options::optimizeRecursiveTailCalls()))
> 
> Why reference this option anywhere else? Isn’t it only  here that we care?

The other two places where we reference this option take care of splitting the entry block for functions that have at least one tail call, so the optimisation has somewhere to jump to.
I decided to also make them conditional on the option, to make it easier to benchmark cleanly the cost incurred by this.
Comment 9 Saam Barati 2017-11-16 09:16:49 PST
(In reply to Robin Morisset from comment #8)
> (In reply to Saam Barati from comment #7)
> > Comment on attachment 327062 [details]
> > Patch for landing
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=327062&action=review
> > 
> > > Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:1425
> > > +    if (UNLIKELY(!Options::optimizeRecursiveTailCalls()))
> > 
> > Why reference this option anywhere else? Isn’t it only  here that we care?
> 
> The other two places where we reference this option take care of splitting
> the entry block for functions that have at least one tail call, so the
> optimisation has somewhere to jump to.
> I decided to also make them conditional on the option, to make it easier to
> benchmark cleanly the cost incurred by this.

👍🏼