• Benedikt Meurer's avatar
    [es2015] Optimize Reflect.has builtin. · 4213af64
    Benedikt Meurer authored
    Port the baseline version of Reflect.has to the CodeStubAssembler and
    reuse the existing logic for HasProperty (i.e. the HasProperty builtin).
    Also inline the Reflect.has builtin into TurboFan, by adding a check
    on the target in front of a use of the JSHasProperty operator.
    Technically this additional check is not necessary, because the
    JSHasProperty operator already throws if the target is not a JSReceiver,
    but the exception message is confusing then.
    
    This improves the performance of the micro-benchmark from
    
      reflectHasPresent: 337 ms.
      reflectHasAbsent: 472 ms.
    
    to
    
      reflectHasPresent: 121 ms.
      reflectHasAbsent: 216 ms.
    
    which is a nice 2.8x improvement in the best case. It also improves the
    chai test on the web-tooling-benchmark by around 1-2%, which is roughly
    the expected win (since Reflect.has overall accounts for around 3-4%).
    
    Bug: v8:5996, v8:6936, v8:6937
    Change-Id: I856183229677a71c19936f06f2a4fc7a794a9a4a
    Reviewed-on: https://chromium-review.googlesource.com/720959
    Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
    Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#48608}
    4213af64
builtins-reflect.cc 9.01 KB