• jarin's avatar
    [turbofan] Bidirectional representation inference. · f0e41175
    jarin authored
    This changes representation inference to be bidirectional:
    1. truncations are propagated from uses to definitions.
    2. output types are propagated from definitions to uses.
    (and nodes are revisited until fixpoint.)
    
    At the moment, (2) is used only superficially; the idea here is to
    use the output type propagation to propagate types from type feedback.
    
    For the output types to be usable, we need to keep track of the type
    of the JavaScript value rather than the truncated value. Otherwise,
    representation inference could not rely on the ranges indicated
    by the values.
    
    For example, for "var b = (a|0) + (a|0); return (b/16) >>> 0",
    the type of b cannot be int32; otherwise the division "b/16"
    would believe that it is fine to do an integer division on
    the truncated value, which would give a wrong result for
    2^31 <= a < 2^32.
    
    The change makes representation inference a bit more expensive
    (the phase is about 20% slower), but since this is only small part
    of the overall compiler time, the overall effect is negligible.
    If the running time becomes a problem, we could optimize this by
    remembering when the nodes are stable (ie., no further changes to
    type/truncations) and/or explicit subscriptions for changes.
    
    BUG=v8:4583
    R=bmeurer@chromium.org
    LOG=N
    
    Review URL: https://codereview.chromium.org/1490763003
    
    Cr-Commit-Position: refs/heads/master@{#33112}
    f0e41175
Name
Last commit
Last update
benchmarks Loading commit data...
build Loading commit data...
docs 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/binutils Loading commit data...
tools Loading commit data...
.clang-format Loading commit data...
.gitignore Loading commit data...
.ycm_extra_conf.py Loading commit data...
AUTHORS Loading commit data...
BUILD.gn Loading commit data...
ChangeLog Loading commit data...
DEPS Loading commit data...
LICENSE 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...
Makefile.nacl 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...