• Benedikt Meurer's avatar
    [turbofan] Introduce the notion of context-sensitivity for JS operators. · 51274d3c
    Benedikt Meurer authored
    This change adds predicates to check whether a given JavaScript operator
    needs the "current context" or if any surrounding context (including the
    "native context") does it. For example JSAdd doesn't ever need the
    current context, but actually only the native context. In the
    BytecodeGraphBuilder we use this predicate to check whether a given
    operator needs the current context, and if not, we just pass in the
    native context.
    
    Doing so we improve the performance on the benchmarks given in the
    tracking bug significantly, and go from something around
    
      arrayMap: 476 ms.
      arrayFilter: 312 ms.
      arrayEvery: 241 ms.
      arraySome: 152 ms.
    
    to
    
      arrayMap: 377 ms.
      arrayFilter: 296 ms.
      arrayEvery: 191 ms.
      arraySome: 91 ms.
    
    which is an up to 40% improvement. So for idiomatic modern JavaScript
    which uses higher order functions quite a lot, not just the builtins
    provided by the JSVM, this is going to improve peak performance
    noticably.
    
    This also makes it possible to completely eliminate all the allocations
    in the aliased sloppy arguments example
    
    ```js
    function foo(a) { return arguments.length; }
    ```
    
    concretely we don't allocate the function context anymore and we also
    don't allocate the arguments object anymore (the JSStackCheck was the
    reason why we did this in the past, because it was holding on to the
    current context, which also kept the allocation for the arguments
    alive).
    
    Bug: v8:6200, v8:8060
    Change-Id: I1db56d00d6b510ce6337608c0fff16af96e95eef
    Design-Document: bit.ly/v8-turbofan-context-sensitive-js-operators
    Reviewed-on: https://chromium-review.googlesource.com/c/1267176Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
    Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#56441}
    51274d3c
operator-properties.h 1.1 KB