• Adam Klein's avatar
    [parser] Stop treating generators as "top level" for preparsing purposes · 0439100a
    Adam Klein authored
    Generators were previously treated as "top level" for preparsing purposes,
    since all their variables are context-allocated. But doing so isn't quite
    correct: the allocation of the "arguments" variable for a generator
    depends on whether it's referenced, and so an inner arrow function
    which references "arguments" won't properly trigger allocation of
    "arguments" since the reference will not be noticed in the preparser.
    
    The same problem exists for "this" since commit 68f0a47b;
    before that commit, all generators implicitly referenced their "this" argument
    as part of the desugaring. With that implicit reference gone, "this"
    falls into the same problem as arguments.
    
    This patch restricts the special "top level" treatment to modules,
    which have only a trivial "this" binding (it's always undefined), and no
    arguments binding. Moreover, all code inside modules is strict, meaning
    that unresolved references to "this" will also result in undefined.
    
    R=marja@chromium.org
    
    Bug: chromium:723132
    Change-Id: I814d145fb8f3f1a65abb48e4e35595428d063051
    Reviewed-on: https://chromium-review.googlesource.com/508055Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
    Commit-Queue: Adam Klein <adamk@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#45399}
    0439100a
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...