|
|
DescriptionReland - Allow lexically declared "arguments" in function scope in sloppy mode.
Lexically declared "arguments" in sloppy mode will throw redeclaration error
currently, this patch fixes it by delaying the declaration of arguments until we
fully parse parameter list and function body.
BUG=v8:4577
LOG=N
Committed: https://crrev.com/70a613dd0a5f5d205b46559b55702764464851fa
Committed: https://crrev.com/7a38b927c89f54d27ee0ce5c297f06b9b655373b
Cr-Original-Commit-Position: refs/heads/master@{#39109}
Cr-Commit-Position: refs/heads/master@{#39230}
Patch Set 1 #
Total comments: 8
Patch Set 2 : update #
Total comments: 10
Patch Set 3 : Update #
Total comments: 1
Patch Set 4 : update #
Total comments: 3
Patch Set 5 : clang format #Messages
Total messages: 61 (38 generated)
The CQ bit was checked by lpy@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
lpy@chromium.org changed reviewers: + adamk@chromium.org
PTAL.
Do you understand why the bytecode golden files changed so much? Is it just because of the different declaration order? https://codereview.chromium.org/2290753003/diff/1/src/ast/scopes.cc File src/ast/scopes.cc (right): https://codereview.chromium.org/2290753003/diff/1/src/ast/scopes.cc#newcode444 src/ast/scopes.cc:444: if (arg_variable != NULL && IsLexicalVariableMode(arg_variable->mode())) { Please add a comment here explaining what you're doing. You could refer to the spec, since the spec in https://tc39.github.io/ecma262/#sec-functiondeclarationinstantiation does this exact check. Also style nit: please use nullptr instead of NULL in new code. https://codereview.chromium.org/2290753003/diff/1/src/ast/scopes.cc#newcode451 src/ast/scopes.cc:451: arguments_ = Declare(zone(), this, ast_value_factory->arguments_string(), VAR, I think you only need to do this if arg_variable == nullptr (otherwise arg_variable is the same Variable* that Declare will return). https://codereview.chromium.org/2290753003/diff/1/src/parsing/parser.cc File src/parsing/parser.cc (right): https://codereview.chromium.org/2290753003/diff/1/src/parsing/parser.cc#newco... src/parsing/parser.cc:4024: main_scope->DeclareArguments(ast_value_factory()); What happens if you leave this out? I'm a bit surprised it's necessary. https://codereview.chromium.org/2290753003/diff/1/test/mjsunit/regress/regres... File test/mjsunit/regress/regress-4577.js (right): https://codereview.chromium.org/2290753003/diff/1/test/mjsunit/regress/regres... test/mjsunit/regress/regress-4577.js:19: assertTrue(foo() === 2); assertEquals(2, foo());
The CQ bit was checked by lpy@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
PTAL. https://codereview.chromium.org/2290753003/diff/1/src/ast/scopes.cc File src/ast/scopes.cc (right): https://codereview.chromium.org/2290753003/diff/1/src/ast/scopes.cc#newcode444 src/ast/scopes.cc:444: if (arg_variable != NULL && IsLexicalVariableMode(arg_variable->mode())) { On 2016/08/30 20:45:56, adamk wrote: > Please add a comment here explaining what you're doing. You could refer to the > spec, since the spec in > https://tc39.github.io/ecma262/#sec-functiondeclarationinstantiation does this > exact check. > > Also style nit: please use nullptr instead of NULL in new code. Done. https://codereview.chromium.org/2290753003/diff/1/src/ast/scopes.cc#newcode451 src/ast/scopes.cc:451: arguments_ = Declare(zone(), this, ast_value_factory->arguments_string(), VAR, On 2016/08/30 20:45:56, adamk wrote: > I think you only need to do this if arg_variable == nullptr (otherwise > arg_variable is the same Variable* that Declare will return). Done. https://codereview.chromium.org/2290753003/diff/1/src/parsing/parser.cc File src/parsing/parser.cc (right): https://codereview.chromium.org/2290753003/diff/1/src/parsing/parser.cc#newco... src/parsing/parser.cc:4024: main_scope->DeclareArguments(ast_value_factory()); On 2016/08/30 20:45:56, adamk wrote: > What happens if you leave this out? I'm a bit surprised it's necessary. There's a DCHECK here: https://cs.chromium.org/chromium/src/v8/src/ast/scopes.cc?l=1027 https://codereview.chromium.org/2290753003/diff/1/test/mjsunit/regress/regres... File test/mjsunit/regress/regress-4577.js (right): https://codereview.chromium.org/2290753003/diff/1/test/mjsunit/regress/regres... test/mjsunit/regress/regress-4577.js:19: assertTrue(foo() === 2); On 2016/08/30 20:45:57, adamk wrote: > assertEquals(2, foo()); Done.
Description was changed from ========== Allow lexically declared "arguments" in function scope in sloppy mode. Lexically declared "arguments" in sloppy mode will throw redeclaration error currently, this patch fixes it by delaying the declaration of arguments until we fully parse parameter list and function body. BUG=v8:4577 LOG=N ========== to ========== Allow lexically declared "arguments" in function scope in sloppy mode. Lexically declared "arguments" in sloppy mode will throw redeclaration error currently, this patch fixes it by delaying the declaration of arguments until we fully parse parameter list and function body. BUG=v8:4577 LOG=N ==========
lpy@chromium.org changed reviewers: + mythria@chromium.org
Also + mythria@, could you please take a look at bytecode_expectations/?
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_presubmit on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_presubmit/builds/22986)
Most changes in bytecode expectations are because of the change in feedback slots. I think Arguments are processed in a different order, so the feedback slot gets assigned in a different order. lgtm on bytecode expectations with a minor comment. https://codereview.chromium.org/2290753003/diff/20001/test/cctest/interpreter... File test/cctest/interpreter/bytecode_expectations/ContextVariables.golden (right): https://codereview.chromium.org/2290753003/diff/20001/test/cctest/interpreter... test/cctest/interpreter/bytecode_expectations/ContextVariables.golden:386: var a248 = 0; I think this is testing if we generate wide bytecode for LdaContextSlot. So we can add another variable declaration to actually test this case. So, just add "var a249 = 0;" here. We also need to update test/cctest/interpreter/test-bytecode-generator.cc in function ContextVariables change REPEAT_249_UNIQUE_VARS() to REPEAT_250_UNIQUE_VARS() and update the definition at the top of file by adding one more UNIQUE_VAR. i.e. change it to: #define REPEAT_250_UNIQUE_VARS() \ REPEAT_128_UNIQUE_VARS() \ REPEAT_64_UNIQUE_VARS() \ REPEAT_32_UNIQUE_VARS() \ REPEAT_16_UNIQUE_VARS() \ REPEAT_8_UNIQUE_VARS() \ UNIQUE_VAR() \ UNIQUE_VAR() We need to rebaseline after doing this change. Thanks a lot for doing this.
Just a few more bits. https://codereview.chromium.org/2290753003/diff/20001/src/ast/scopes.cc File src/ast/scopes.cc (right): https://codereview.chromium.org/2290753003/diff/20001/src/ast/scopes.cc#newco... src/ast/scopes.cc:445: // See https://tc39.github.io/ecma262/#sec-functiondeclarationinstantiation, The style we've mostly been going for here has been to reduce the entire part of the URL before the "#" to "ES", e.g., "See ES#some-section-anchor, step 20" https://codereview.chromium.org/2290753003/diff/20001/src/ast/scopes.cc#newco... src/ast/scopes.cc:1501: // Functions have 'arguments' declared implicitly in all non arrow functions. This comment is now wrong, I think it should just be removed. https://codereview.chromium.org/2290753003/diff/20001/src/ast/scopes.cc#newco... src/ast/scopes.cc:1503: // 'arguments' is used. Unless there is also a parameter called Can you add a DCHECK(!is_arrow_scope()) right above this line? https://codereview.chromium.org/2290753003/diff/20001/test/cctest/test-parsin... File test/cctest/test-parsing.cc (right): https://codereview.chromium.org/2290753003/diff/20001/test/cctest/test-parsin... test/cctest/test-parsing.cc:8200: "const arguments", This one needs an initializer, as the test failure demonstrates.
The CQ bit was checked by lpy@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_presubmit on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_presubmit/builds/23114)
Thanks for the feedback, I updated the CL. https://codereview.chromium.org/2290753003/diff/20001/src/ast/scopes.cc File src/ast/scopes.cc (right): https://codereview.chromium.org/2290753003/diff/20001/src/ast/scopes.cc#newco... src/ast/scopes.cc:445: // See https://tc39.github.io/ecma262/#sec-functiondeclarationinstantiation, On 2016/09/01 17:36:26, adamk wrote: > The style we've mostly been going for here has been to reduce the entire part of > the URL before the "#" to "ES", e.g., > > "See ES#some-section-anchor, step 20" Done. https://codereview.chromium.org/2290753003/diff/20001/src/ast/scopes.cc#newco... src/ast/scopes.cc:1501: // Functions have 'arguments' declared implicitly in all non arrow functions. On 2016/09/01 17:36:26, adamk wrote: > This comment is now wrong, I think it should just be removed. Done. https://codereview.chromium.org/2290753003/diff/20001/src/ast/scopes.cc#newco... src/ast/scopes.cc:1503: // 'arguments' is used. Unless there is also a parameter called On 2016/09/01 17:36:26, adamk wrote: > Can you add a DCHECK(!is_arrow_scope()) right above this line? Done. https://codereview.chromium.org/2290753003/diff/20001/test/cctest/interpreter... File test/cctest/interpreter/bytecode_expectations/ContextVariables.golden (right): https://codereview.chromium.org/2290753003/diff/20001/test/cctest/interpreter... test/cctest/interpreter/bytecode_expectations/ContextVariables.golden:386: var a248 = 0; On 2016/09/01 09:44:28, mythria wrote: > I think this is testing if we generate wide bytecode for LdaContextSlot. So we > can add another variable declaration to actually test this case. So, just add > "var a249 = 0;" here. > > We also need to update test/cctest/interpreter/test-bytecode-generator.cc in > function ContextVariables change REPEAT_249_UNIQUE_VARS() to > REPEAT_250_UNIQUE_VARS() and update the definition at the top of file by adding > one more UNIQUE_VAR. i.e. change it to: > > #define REPEAT_250_UNIQUE_VARS() \ > REPEAT_128_UNIQUE_VARS() \ > REPEAT_64_UNIQUE_VARS() \ > REPEAT_32_UNIQUE_VARS() \ > REPEAT_16_UNIQUE_VARS() \ > REPEAT_8_UNIQUE_VARS() \ > UNIQUE_VAR() \ > UNIQUE_VAR() > > We need to rebaseline after doing this change. Thanks a lot for doing this. Done. https://codereview.chromium.org/2290753003/diff/20001/test/cctest/test-parsin... File test/cctest/test-parsing.cc (right): https://codereview.chromium.org/2290753003/diff/20001/test/cctest/test-parsin... test/cctest/test-parsing.cc:8200: "const arguments", On 2016/09/01 17:36:26, adamk wrote: > This one needs an initializer, as the test failure demonstrates. Done.
lgtm once unused macro is removed https://codereview.chromium.org/2290753003/diff/40001/test/cctest/interpreter... File test/cctest/interpreter/test-bytecode-generator.cc (right): https://codereview.chromium.org/2290753003/diff/40001/test/cctest/interpreter... test/cctest/interpreter/test-bytecode-generator.cc:59: #define REPEAT_249_UNIQUE_VARS() \ Doesn't look like this is used anymore.
The CQ bit was checked by lpy@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_presubmit on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_presubmit/builds/23121)
The CQ bit was checked by lpy@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from mythria@chromium.org, adamk@chromium.org Link to the patchset: https://codereview.chromium.org/2290753003/#ps60001 (title: "update")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: v8_presubmit on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_presubmit/builds/23122)
https://codereview.chromium.org/2290753003/diff/60001/test/cctest/test-parsin... File test/cctest/test-parsing.cc (right): https://codereview.chromium.org/2290753003/diff/60001/test/cctest/test-parsin... test/cctest/test-parsing.cc:8324: const char* context_data[][2] = { To make clang-format happy you'll want to wrap these blocks with "// clang-format off" and "// clang-format on" (we really want these to be one-item-per-line.
yeah, I updated a new one for it, thanks.
The CQ bit was checked by lpy@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from adamk@chromium.org, mythria@chromium.org Link to the patchset: https://codereview.chromium.org/2290753003/#ps80001 (title: "clang format")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
lgtm with one more clang-format nit https://codereview.chromium.org/2290753003/diff/60001/test/cctest/test-parsin... File test/cctest/test-parsing.cc (right): https://codereview.chromium.org/2290753003/diff/60001/test/cctest/test-parsin... test/cctest/test-parsing.cc:8324: const char* context_data[][2] = { On 2016/09/01 21:21:30, adamk wrote: > To make clang-format happy you'll want to wrap these blocks with "// > clang-format off" and "// clang-format on" (we really want these to be > one-item-per-line. Sorry to send this back one more time, but generally we wrap only the blocks of data with the clang-format tags, not the entire TEST case (this lets clang-format do, e.g., line-wrapping where appropriate).
The CQ bit was unchecked by lpy@chromium.org
Patchset #5 (id:80001) has been deleted
The CQ bit was checked by lpy@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from adamk@chromium.org, mythria@chromium.org Link to the patchset: https://codereview.chromium.org/2290753003/#ps100001 (title: "clang format")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
https://codereview.chromium.org/2290753003/diff/60001/test/cctest/test-parsin... File test/cctest/test-parsing.cc (right): https://codereview.chromium.org/2290753003/diff/60001/test/cctest/test-parsin... test/cctest/test-parsing.cc:8324: const char* context_data[][2] = { On 2016/09/01 21:37:59, adamk wrote: > On 2016/09/01 21:21:30, adamk wrote: > > To make clang-format happy you'll want to wrap these blocks with "// > > clang-format off" and "// clang-format on" (we really want these to be > > one-item-per-line. > > Sorry to send this back one more time, but generally we wrap only the blocks of > data with the clang-format tags, not the entire TEST case (this lets > clang-format do, e.g., line-wrapping where appropriate). Done.
Message was sent while issue was closed.
Description was changed from ========== Allow lexically declared "arguments" in function scope in sloppy mode. Lexically declared "arguments" in sloppy mode will throw redeclaration error currently, this patch fixes it by delaying the declaration of arguments until we fully parse parameter list and function body. BUG=v8:4577 LOG=N ========== to ========== Allow lexically declared "arguments" in function scope in sloppy mode. Lexically declared "arguments" in sloppy mode will throw redeclaration error currently, this patch fixes it by delaying the declaration of arguments until we fully parse parameter list and function body. BUG=v8:4577 LOG=N ==========
Message was sent while issue was closed.
Committed patchset #5 (id:100001)
Message was sent while issue was closed.
Description was changed from ========== Allow lexically declared "arguments" in function scope in sloppy mode. Lexically declared "arguments" in sloppy mode will throw redeclaration error currently, this patch fixes it by delaying the declaration of arguments until we fully parse parameter list and function body. BUG=v8:4577 LOG=N ========== to ========== Allow lexically declared "arguments" in function scope in sloppy mode. Lexically declared "arguments" in sloppy mode will throw redeclaration error currently, this patch fixes it by delaying the declaration of arguments until we fully parse parameter list and function body. BUG=v8:4577 LOG=N Committed: https://crrev.com/70a613dd0a5f5d205b46559b55702764464851fa Cr-Commit-Position: refs/heads/master@{#39109} ==========
Message was sent while issue was closed.
Patchset 5 (id:??) landed as https://crrev.com/70a613dd0a5f5d205b46559b55702764464851fa Cr-Commit-Position: refs/heads/master@{#39109}
Message was sent while issue was closed.
A revert of this CL (patchset #5 id:100001) has been created in https://codereview.chromium.org/2304853002/ by machenbach@chromium.org. The reason for reverting is: Breaks layout tests: https://build.chromium.org/p/client.v8.fyi/builders/V8-Blink%20Linux%2064/bui....
Message was sent while issue was closed.
Description was changed from ========== Allow lexically declared "arguments" in function scope in sloppy mode. Lexically declared "arguments" in sloppy mode will throw redeclaration error currently, this patch fixes it by delaying the declaration of arguments until we fully parse parameter list and function body. BUG=v8:4577 LOG=N Committed: https://crrev.com/70a613dd0a5f5d205b46559b55702764464851fa Cr-Commit-Position: refs/heads/master@{#39109} ========== to ========== Allow lexically declared "arguments" in function scope in sloppy mode. Lexically declared "arguments" in sloppy mode will throw redeclaration error currently, this patch fixes it by delaying the declaration of arguments until we fully parse parameter list and function body. BUG=v8:4577 LOG=N Committed: https://crrev.com/70a613dd0a5f5d205b46559b55702764464851fa Cr-Commit-Position: refs/heads/master@{#39109} ==========
The CQ bit was checked by lpy@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by lpy@chromium.org
The CQ bit was unchecked by lpy@chromium.org
Description was changed from ========== Allow lexically declared "arguments" in function scope in sloppy mode. Lexically declared "arguments" in sloppy mode will throw redeclaration error currently, this patch fixes it by delaying the declaration of arguments until we fully parse parameter list and function body. BUG=v8:4577 LOG=N Committed: https://crrev.com/70a613dd0a5f5d205b46559b55702764464851fa Cr-Commit-Position: refs/heads/master@{#39109} ========== to ========== Reland - Allow lexically declared "arguments" in function scope in sloppy mode. Lexically declared "arguments" in sloppy mode will throw redeclaration error currently, this patch fixes it by delaying the declaration of arguments until we fully parse parameter list and function body. BUG=v8:4577 LOG=N Committed: https://crrev.com/70a613dd0a5f5d205b46559b55702764464851fa Cr-Commit-Position: refs/heads/master@{#39109} ==========
The CQ bit was checked by lpy@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Description was changed from ========== Reland - Allow lexically declared "arguments" in function scope in sloppy mode. Lexically declared "arguments" in sloppy mode will throw redeclaration error currently, this patch fixes it by delaying the declaration of arguments until we fully parse parameter list and function body. BUG=v8:4577 LOG=N Committed: https://crrev.com/70a613dd0a5f5d205b46559b55702764464851fa Cr-Commit-Position: refs/heads/master@{#39109} ========== to ========== Reland - Allow lexically declared "arguments" in function scope in sloppy mode. Lexically declared "arguments" in sloppy mode will throw redeclaration error currently, this patch fixes it by delaying the declaration of arguments until we fully parse parameter list and function body. BUG=v8:4577 LOG=N Committed: https://crrev.com/70a613dd0a5f5d205b46559b55702764464851fa Cr-Commit-Position: refs/heads/master@{#39109} ==========
Message was sent while issue was closed.
Committed patchset #5 (id:100001)
Message was sent while issue was closed.
Description was changed from ========== Reland - Allow lexically declared "arguments" in function scope in sloppy mode. Lexically declared "arguments" in sloppy mode will throw redeclaration error currently, this patch fixes it by delaying the declaration of arguments until we fully parse parameter list and function body. BUG=v8:4577 LOG=N Committed: https://crrev.com/70a613dd0a5f5d205b46559b55702764464851fa Cr-Commit-Position: refs/heads/master@{#39109} ========== to ========== Reland - Allow lexically declared "arguments" in function scope in sloppy mode. Lexically declared "arguments" in sloppy mode will throw redeclaration error currently, this patch fixes it by delaying the declaration of arguments until we fully parse parameter list and function body. BUG=v8:4577 LOG=N Committed: https://crrev.com/70a613dd0a5f5d205b46559b55702764464851fa Committed: https://crrev.com/7a38b927c89f54d27ee0ce5c297f06b9b655373b Cr-Original-Commit-Position: refs/heads/master@{#39109} Cr-Commit-Position: refs/heads/master@{#39230} ==========
Message was sent while issue was closed.
Patchset 5 (id:??) landed as https://crrev.com/7a38b927c89f54d27ee0ce5c297f06b9b655373b Cr-Commit-Position: refs/heads/master@{#39230} |