• Benedikt Meurer's avatar
    [turbofan] Introduce a CallFunctionTemplate builtin. · a2d9924c
    Benedikt Meurer authored
    When calling into API callbacks from TurboFan optimized, we can
    currently only take a fast-path when TurboFan is able to find some
    information about the receiver in the graph, or when the API callback
    specifies that it neither requires an access check (aka "accepts any
    receiver") nor an interface check (aka "compatible receiver check").
    
    This change introduces a new CallFunctionTemplate builtin that sits
    in front of the CallApiCallback builtin and does both the access as well
    as the interface check as necessary (and raises appropriate exceptions).
    This way TurboFan can still call into the API callback via the fast-path
    even without ahead knowledge about the receiver, which is significantly
    faster than the generic call machinery for API callbacks.
    
    On the test case from the Angular team[1], the interesting metrics
    improve from
    
      DOM_mono: 0.273 ms
      DOM_mega: 0.571 ms
      DOM_call: 0.649 ms
    
    to
    
      DOM_mono: 0.264 ms
      DOM_mega: 0.572 ms
      DOM_call: 0.368 ms
    
    so the DOM_call is only about **1.4 times slower** than the DOM_mono and
    about **1.5 times faster** than the DOM_mega case (compared to **2.4
    times slower**). Execution time in the DOM_call was reduced by around
    **~45%**.
    
    Currently this new code path is limited to TurboFan optimized code, but
    the idea is to eventually migrate the API calls from baseline to also
    use the new CSA functionality, but there are lot's of subleties to take
    into account, so starting with small changes to get coverage for the
    basic building blocks.
    
    [1]: https://mhevery.github.io/perf-tests/DOM-megamorphic.html
    
    Bug: v8:8820
    Change-Id: Ie1029cf182ce05a6e519fd9a9d4fa825db8adb4c
    Cq-Include-Trybots: luci.chromium.try:linux-blink-rel
    Reviewed-on: https://chromium-review.googlesource.com/c/1470129
    Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
    Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#59598}
    a2d9924c
runtime.h 32.4 KB