• Clemens Hammacher's avatar
    [wasm] Fix detection of unreachable code · 912cd314
    Clemens Hammacher authored
    The current Control::unreachable flag served two things at the same
    time: It tracked whether the label of that block is reachable (anyone
    jumps / falls through to there), and it tracked whether that block was
    ended by an unconditional branch or something similar.
    
    It turns out that these two things cannot be tracked with a single
    boolean per control struct. This CL introduces a Merge::reached flag,
    which tracks whether a merge point was reached so far.
    Also, the boolean flag to track unreachability of instructions within a
    block is extended to track implicitly unreachable instructions.
    According to the spec, a new block inside of unreachable code must be
    validated as reachable code again, and also code after a block which
    never returns has to be validated. It's not needed to generate code for
    such instructions, however.
    This new state will be particularly needed for the baseline compiler.
    
    A follow-up CL will avoid calling interface methods for unreachable
    code.
    
    R=titzer@chromium.org
    
    Bug: v8:6600
    Change-Id: I54c97a19121eace65e25c448639330d06f61b1c8
    Reviewed-on: https://chromium-review.googlesource.com/715637
    Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
    Reviewed-by: 's avatarAndreas Rossberg <rossberg@chromium.org>
    Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#48509}
    912cd314
function-body-decoder-impl.h 79.1 KB