• bmeurer's avatar
    [turbofan] Fix overly aggressive dead code elimination. · 32346aae
    bmeurer authored
    When we eliminate nodes during truncation analysis that have no value
    uses, we must make sure that we do not eliminate speculative number
    operations that would have side effects depending on the inputs, i.e.
    for example a SpeculativeNumberMultiply(x,y) does ToNumber(x) and
    ToNumber(y) first, so if either x or y could throw an exception during
    ToNumber conversion, we must not eliminate the multiplication, even if
    it has no value uses (some later pass may kill the actual machine
    multiplication, but the checks on the inputs have to remain still).
    So we check whether both x and y are PlainPrimitive, i.e. neither
    Receiver nor Symbol, which could raise exceptions for ToNumber, and
    only in that case we propagate the "unusedness" of the node to its
    inputs.
    
    This also uncovered a bug with the type of Dead, which must be None,
    as this represents an impossible value, so we had to fix that too.
    
    Also the dead code removal will not work correctly for constants (i.e.
    pure nodes with no value inputs), as those might be cached and hence
    we might resurrect them for an unrelated node lowering during
    SimplifiedLowering and only later kill the actual node (replacing its
    uses with Dead), which would then also replace the new use with Dead.
    So that was fixed as well. This shouldn't change anything for the
    result, as unused constants automagically disappear from the graph later
    on anyways.
    
    R=yangguo@chromium.org
    BUG=chromium:631318
    
    Review-Url: https://codereview.chromium.org/2182003002
    Cr-Commit-Position: refs/heads/master@{#38038}
    32346aae
Name
Last commit
Last update
..
benchmarks Loading commit data...
cctest Loading commit data...
fuzzer Loading commit data...
intl Loading commit data...
js-perf-test Loading commit data...
memory Loading commit data...
message Loading commit data...
mjsunit Loading commit data...
mozilla Loading commit data...
preparser Loading commit data...
promises-aplus Loading commit data...
simdjs Loading commit data...
test262 Loading commit data...
unittests Loading commit data...
webkit Loading commit data...
BUILD.gn Loading commit data...
bot_default.gyp Loading commit data...
bot_default.isolate Loading commit data...
default.gyp Loading commit data...
default.isolate Loading commit data...
ignition.gyp Loading commit data...
ignition.isolate Loading commit data...
optimize_for_size.gyp Loading commit data...
optimize_for_size.isolate Loading commit data...
perf.gyp Loading commit data...
perf.isolate Loading commit data...