[Webkit-unassigned] [Bug 200875] New: [JSC] Ensure x?.y ?? z is fast

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Aug 18 20:57:29 PDT 2019


https://bugs.webkit.org/show_bug.cgi?id=200875

            Bug ID: 200875
           Summary: [JSC] Ensure x?.y ?? z is fast
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: ross.kirsling at sony.com

It is anticipated that `x?.y ?? z` will quickly become a common idiom in JS (as it is in C#, Swift, etc.).

Indeed, such an example is given as motivation for the proposal:
(https://github.com/tc39/proposal-optional-chaining/#overview-and-motivation)
> const animationDuration = response.settings?.animationDuration ?? 300;

As such, it seems unfortunate that we currently generate the following: 

        (get x)
  ----- jundefined_or_null
  |     (get y)
  | --- jmp
  > |   (load undefined)
    > - jnundefined_or_null
      | (get z)
      > end

When it clearly could be reduced to:

        (get x)
    --- jundefined_or_null
    |   (get y)
    | - jnundefined_or_null
    > | (get z)
      > end

What I'm not sure about:
 - Is this appropriate to handle at initial bytecode generation? (If so, we could do so with a combined chain-and-coalesce node.)
 - Is this the sort of thing we expect to leave for DFG or FTL to handle? (Looking at the dumped graph, this does not seem to come for free.)

-- 
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/20190819/f464e37f/attachment-0001.html>


More information about the webkit-unassigned mailing list