• Benedikt Meurer's avatar
    [csa] Extend TryToName to also implicitly convert Oddball keys. · 426ae426
    Benedikt Meurer authored
    Previously TryToName bailed out for Oddball keys (i.e. when passing true
    or false as the key), which meant that for example the generic
    KeyedLoadIC would always bail out to the %KeyedGetProperty runtime
    function. But handling Oddball keys is fairly easy, since every oddball
    value carries it's unique string representation. Adding just this case
    to the CodeStubAssembler::TryToName method boosts this simple
    micro-benchmark by a factor of 4x:
    
      const n = 1e7;
      const obj = {};
      const key = true;
    
      console.time('foo');
      for (let i = 0; i < n; ++i) {
        if (obj[key] === undefined) {
          obj[key] = key;
        }
      }
      console.timeEnd('foo');
    
    It also shows on the ARES-6 ML benchmark and on several Speedometer
    tests, where objects are being used as dictionaries and the developers
    rely on the implicit ToString conversions on the property accesses.
    In the ARES-6 ML benchmark, the number of calls to %KeyedGetProperty
    is reduced by 137,758.
    
    Bug: v8:6278, v8:6344, v8:6670
    Change-Id: Iaa965e30be4c247682a67ec09543655df9b761d2
    Reviewed-on: https://chromium-review.googlesource.com/599527Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
    Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#47105}
    426ae426
Name
Last commit
Last update
benchmarks Loading commit data...
build_overrides Loading commit data...
docs Loading commit data...
gni Loading commit data...
gypfiles Loading commit data...
include Loading commit data...
infra Loading commit data...
samples Loading commit data...
src Loading commit data...
test Loading commit data...
testing Loading commit data...
third_party Loading commit data...
tools Loading commit data...
.clang-format Loading commit data...
.editorconfig Loading commit data...
.gitignore Loading commit data...
.gn Loading commit data...
.ycm_extra_conf.py Loading commit data...
AUTHORS Loading commit data...
BUILD.gn Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
ChangeLog Loading commit data...
DEPS Loading commit data...
LICENSE Loading commit data...
LICENSE.fdlibm Loading commit data...
LICENSE.strongtalk Loading commit data...
LICENSE.v8 Loading commit data...
LICENSE.valgrind Loading commit data...
Makefile Loading commit data...
Makefile.android Loading commit data...
OWNERS Loading commit data...
PRESUBMIT.py Loading commit data...
README.md Loading commit data...
WATCHLISTS Loading commit data...
codereview.settings Loading commit data...
snapshot_toolchain.gni Loading commit data...