• Benedikt Meurer's avatar
    [turbofan] Introduce InstanceOfIC to collect rhs feedback. · bcee1406
    Benedikt Meurer authored
    This adds a new InstanceOfIC where the TestInstanceOf bytecode collects
    constant feedback about the right-hand side of instanceof operators,
    including both JSFunction and JSBoundFunction instances. TurboFan then
    uses the feedback to optimize instanceof in places where the right-hand
    side is not a known constant (known to TurboFan).
    
    This addresses the odd performance cliff that we see with instanceof in
    functions with multiple closures. It was discovered as one of the main
    bottlenecks on the uglify-es test in the web-tooling-benchmark. The
    uglify-es test (run in separation) is ~18% faster with this change.
    
    On the micro-benchmark in the tracking bug we go from
    
      instanceofSingleClosure_Const: 69 ms.
      instanceofSingleClosure_Class: 246 ms.
      instanceofMultiClosure: 246 ms.
      instanceofParameter: 246 ms.
    
    to
    
      instanceofSingleClosure_Const: 70 ms.
      instanceofSingleClosure_Class: 75 ms.
      instanceofMultiClosure: 76 ms.
      instanceofParameter: 73 ms.
    
    boosting performance by roughly 3.6x and thus effectively removing the
    performance cliff around instanceof.
    
    Bug: v8:6936, v8:6971
    Change-Id: Ib88dbb9eaef9cafa4a0e260fbbde73427a54046e
    Reviewed-on: https://chromium-review.googlesource.com/730686
    Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
    Reviewed-by: 's avatarMichael Stanton <mvstanton@chromium.org>
    Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
    Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
    Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#48820}
    bcee1406
js-type-hint-lowering.cc 16.1 KB