• Daniel Ehrenberg's avatar
    [scopes] Fix sloppy-mode block-scoped function hoisting edge case · d54ffadf
    Daniel Ehrenberg authored
    In edge cases such as the following, sloppy-mode block-scoped function
    hoisting is expected to occur:
    
      eval(`
        with({a: 1}) {
          function a() {}
        }
      `)
    
    In this case, there should be the equivalent of a var declaration
    outside of the eval, which gets set to the value of the local function
    a when the body of the with is executed.
    
    Previously, the way that var declarations are hoisted out of eval
    meant that the assignment to that var was an ordinary DYNAMIC_GLOBAL
    assignment. However, such a lookup mode meant that the object in the
    with scope received the assignment!
    
    This patch fixes that error by marking the assignments produced by
    the sloppy mode block scoped function hoisting desugaring so as to
    generate a different runtime call which skips with scopes.
    
    Bug: chromium:720247, v8:5135
    Change-Id: Ie36322ddc9ca848bf680163e8c016f50d4597748
    Reviewed-on: https://chromium-review.googlesource.com/529230
    Commit-Queue: Daniel Ehrenberg <littledan@chromium.org>
    Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
    Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
    Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#46116}
    d54ffadf
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...
.gitignore Loading commit data...
.gn 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...