• 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...
cctest Loading commit data...
common Loading commit data...
debugger Loading commit data...
fuzzer Loading commit data...
inspector 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...
mkgrokdump Loading commit data...
mozilla Loading commit data...
preparser Loading commit data...
promises-aplus Loading commit data...
test262 Loading commit data...
unittests Loading commit data...
wasm-spec-tests 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...
optimize_for_size.gyp Loading commit data...
optimize_for_size.isolate Loading commit data...
perf.gyp Loading commit data...
perf.isolate Loading commit data...