• littledan's avatar
    Ensure hole checks take place in switch statement scopes · d6fb6de7
    littledan authored
    Switch statements introduce their own scope for cases, but this scope
    is not necessarily executed in order, as the following function shows:
    
      switch (x) {
        case 1:
          let y = 1;
        case 2:
          y = 2;
        case 3:
          print(y);
      }
    
    If x = 2 or x = 3, the code should throw a ReferenceError. However,
    FullCodeGen's hole check elimination used the simple algorithm of
    assuming that if the initializer was in the same scope, then it was
    reached before the use, and therefore the hole check could be
    eliminated.
    
    This patch adds an extra bit to scopes, to track if they may
    nonlinearly. The parser marks the scope that switch introduces as
    nonlinear. FullCodeGen does not eliminate the hole check from
    a scope which is nonlinear. This patch refactors FullCodeGen to
    put the hole check elimination in one place, rather than in each
    backend.
    
    BUG=v8:3926
    LOG=Y
    R=adamk
    
    Review URL: https://codereview.chromium.org/1312613003
    
    Cr-Commit-Position: refs/heads/master@{#30453}
    d6fb6de7
Name
Last commit
Last update
benchmarks Loading commit data...
build 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...