• 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
..
OWNERS Loading commit data...
ast-expression-rewriter.cc Loading commit data...
ast-expression-rewriter.h Loading commit data...
ast-function-literal-id-reindexer.cc Loading commit data...
ast-function-literal-id-reindexer.h Loading commit data...
ast-numbering.cc Loading commit data...
ast-numbering.h Loading commit data...
ast-traversal-visitor.h Loading commit data...
ast-type-bounds.h Loading commit data...
ast-types.cc Loading commit data...
ast-types.h Loading commit data...
ast-value-factory.cc Loading commit data...
ast-value-factory.h Loading commit data...
ast.cc Loading commit data...
ast.h Loading commit data...
compile-time-value.cc Loading commit data...
compile-time-value.h Loading commit data...
context-slot-cache.cc Loading commit data...
context-slot-cache.h Loading commit data...
modules.cc Loading commit data...
modules.h Loading commit data...
prettyprinter.cc Loading commit data...
prettyprinter.h Loading commit data...
scopes.cc Loading commit data...
scopes.h Loading commit data...
variables.cc Loading commit data...
variables.h Loading commit data...