• Pierre Langlois's avatar
    [turbofan] Lower NumberConstant nodes to IntPtrConstant. · 7ac10da7
    Pierre Langlois authored
    If a NumberConstant can be represented as a Smi, then lower it to a
    IntPtrConstant node during simplified lowering. Thanks to this, all backends can
    match Smi values that can also be encoded as immediates in the instruction
    selector. Additionally, we can apply the same lowering to the CodeAssembler for
    the snapshot.
    
    As a result, we can remove `mov` instructions generated because Int32Matcher and
    Int64Matcher didn't not recognize Smis:
    
    For 32-bit target, it's common for Smis also be immediates: "if (a < 100) {}"
    ~~~
    mov r1, #200 -> cmp r0, #200
    cmp r0, r1   -> blt <>
    blt <>       ->
    ~~~
    
    On Arm64 particularly, we lose opportunites to use `cbz`: "if (a == 0) {}"
    ~~~
    movz x0, #0x0 -> cbz x1 <>
    cmp x1, x0    ->
    b.eq <>       ->
    ~~~
    
    Overall, we do not see an impact on benchmarks such as webtooling. However, we
    do see noteworthy code size reduction, from 0.5% to 1.5%.
    
    Bug: 
    Change-Id: I7fbb718ad51b9036c3514fa31c1326bdd6f2b0e6
    Reviewed-on: https://chromium-review.googlesource.com/848814Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
    Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
    Commit-Queue: Pierre Langlois <pierre.langlois@arm.com>
    Cr-Commit-Position: refs/heads/master@{#50569}
    7ac10da7
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...
.git-blame-ignore-revs Loading commit data...
.gitignore Loading commit data...
.gn Loading commit data...
.vpython 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...