Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Issue 1312613003: Ensure hole checks take place in switch statement scopes (Closed)

Created:
5 years, 4 months ago by Dan Ehrenberg
Modified:
5 years, 3 months ago
CC:
v8-dev
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

Ensure hole checks take place in switch statement scopes Switch statements introduce their own scope for cases, but this scope is not necessarily executed in order, as the following function shows: switch (x) { case 1: let y = 1; case 2: y = 2; case 3: print(y); } If x = 2 or x = 3, the code should throw a ReferenceError. However, FullCodeGen's hole check elimination used the simple algorithm of assuming that if the initializer was in the same scope, then it was reached before the use, and therefore the hole check could be eliminated. This patch adds an extra bit to scopes, to track if they may nonlinearly. The parser marks the scope that switch introduces as nonlinear. FullCodeGen does not eliminate the hole check from a scope which is nonlinear. This patch refactors FullCodeGen to put the hole check elimination in one place, rather than in each backend. BUG=v8:3926 LOG=Y R=adamk Committed: https://crrev.com/d6fb6de7097da908fd0a66804027ea189b559c0f Cr-Commit-Position: refs/heads/master@{#30453}

Patch Set 1 #

Patch Set 2 : skip on TF; roll back arrows #

Total comments: 16

Patch Set 3 : Changes based on review #

Total comments: 8

Patch Set 4 : style fixes #

Total comments: 9

Patch Set 5 : Reorder methods #

Patch Set 6 : comment and tests #

Patch Set 7 : Rename function and add sloppy mode tests #

Unified diffs Side-by-side diffs Delta from patch set Stats (+311 lines, -473 lines) Patch
M src/full-codegen/arm/full-codegen-arm.cc View 1 2 3 4 5 6 1 chunk +18 lines, -59 lines 0 comments Download
M src/full-codegen/arm64/full-codegen-arm64.cc View 1 2 3 4 5 6 1 chunk +18 lines, -59 lines 0 comments Download
M src/full-codegen/full-codegen.h View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
M src/full-codegen/full-codegen.cc View 1 2 3 4 5 6 1 chunk +59 lines, -0 lines 0 comments Download
M src/full-codegen/ia32/full-codegen-ia32.cc View 1 2 3 4 5 6 1 chunk +18 lines, -58 lines 0 comments Download
M src/full-codegen/mips/full-codegen-mips.cc View 1 2 3 4 5 6 1 chunk +20 lines, -61 lines 0 comments Download
M src/full-codegen/mips64/full-codegen-mips64.cc View 1 2 3 4 5 6 1 chunk +20 lines, -61 lines 0 comments Download
M src/full-codegen/ppc/full-codegen-ppc.cc View 1 2 3 4 5 6 1 chunk +18 lines, -59 lines 0 comments Download
M src/full-codegen/x64/full-codegen-x64.cc View 1 2 3 4 5 6 1 chunk +17 lines, -58 lines 0 comments Download
M src/full-codegen/x87/full-codegen-x87.cc View 1 2 3 4 5 6 1 chunk +17 lines, -58 lines 0 comments Download
M src/parser.cc View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M src/scopes.h View 1 2 3 4 5 3 chunks +15 lines, -0 lines 0 comments Download
M src/scopes.cc View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
A test/mjsunit/regress/regress-3926.js View 1 2 3 4 5 6 1 chunk +87 lines, -0 lines 0 comments Download

Messages

Total messages: 51 (19 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1312613003/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1312613003/1
5 years, 4 months ago (2015-08-22 00:41:32 UTC) #3
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: v8_mac_rel on tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_mac_rel/builds/8954)
5 years, 4 months ago (2015-08-22 00:51:54 UTC) #5
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1312613003/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1312613003/20001
5 years, 4 months ago (2015-08-24 21:26:21 UTC) #7
Dan Ehrenberg
The test still fails on TurboFan; I'm investigating.
5 years, 4 months ago (2015-08-24 21:44:43 UTC) #8
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 4 months ago (2015-08-24 21:51:46 UTC) #10
adamk
https://codereview.chromium.org/1312613003/diff/20001/src/full-codegen/arm/full-codegen-arm.cc File src/full-codegen/arm/full-codegen-arm.cc (right): https://codereview.chromium.org/1312613003/diff/20001/src/full-codegen/arm/full-codegen-arm.cc#newcode1471 src/full-codegen/arm/full-codegen-arm.cc:1471: // Uninitalized const bindings outside of harmony mode are ...
5 years, 4 months ago (2015-08-24 22:15:01 UTC) #11
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1312613003/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1312613003/40001
5 years, 4 months ago (2015-08-25 01:23:27 UTC) #13
Dan Ehrenberg
https://codereview.chromium.org/1312613003/diff/20001/src/full-codegen/arm/full-codegen-arm.cc File src/full-codegen/arm/full-codegen-arm.cc (right): https://codereview.chromium.org/1312613003/diff/20001/src/full-codegen/arm/full-codegen-arm.cc#newcode1471 src/full-codegen/arm/full-codegen-arm.cc:1471: // Uninitalized const bindings outside of harmony mode are ...
5 years, 4 months ago (2015-08-25 01:48:14 UTC) #14
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: v8_win_rel on tryserver.v8 (JOB_TIMED_OUT, http://build.chromium.org/p/tryserver.v8/builders/v8_win_rel/builds/8979)
5 years, 4 months ago (2015-08-25 07:23:40 UTC) #16
adamk
lgtm % nits https://codereview.chromium.org/1312613003/diff/40001/src/full-codegen/full-codegen.cc File src/full-codegen/full-codegen.cc (right): https://codereview.chromium.org/1312613003/diff/40001/src/full-codegen/full-codegen.cc#newcode1601 src/full-codegen/full-codegen.cc:1601: DCHECK(var->location() == VariableLocation::PARAMETER || Can you ...
5 years, 4 months ago (2015-08-25 19:13:33 UTC) #17
Dan Ehrenberg
5 years, 4 months ago (2015-08-25 20:47:36 UTC) #19
Dan Ehrenberg
https://codereview.chromium.org/1312613003/diff/40001/src/full-codegen/full-codegen.cc File src/full-codegen/full-codegen.cc (right): https://codereview.chromium.org/1312613003/diff/40001/src/full-codegen/full-codegen.cc#newcode1601 src/full-codegen/full-codegen.cc:1601: DCHECK(var->location() == VariableLocation::PARAMETER || On 2015/08/25 at 19:13:33, adamk ...
5 years, 4 months ago (2015-08-25 20:54:45 UTC) #20
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1312613003/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1312613003/60001
5 years, 4 months ago (2015-08-25 20:55:06 UTC) #22
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 4 months ago (2015-08-25 21:21:10 UTC) #24
Michael Starzinger
LGTM on full codegen, just nits. But one concern about scope serialization, adding Andreas for ...
5 years, 3 months ago (2015-08-26 11:30:30 UTC) #27
Michael Starzinger
https://codereview.chromium.org/1312613003/diff/60001/src/full-codegen/full-codegen.h File src/full-codegen/full-codegen.h (right): https://codereview.chromium.org/1312613003/diff/60001/src/full-codegen/full-codegen.h#newcode704 src/full-codegen/full-codegen.h:704: bool NeedsHoleCheck(VariableProxy* proxy); nit: Please move the declaration away ...
5 years, 3 months ago (2015-08-26 11:36:58 UTC) #28
rossberg
https://codereview.chromium.org/1312613003/diff/60001/src/scopes.h File src/scopes.h (right): https://codereview.chromium.org/1312613003/diff/60001/src/scopes.h#newcode232 src/scopes.h:232: void SetNonlinear() { scope_nonlinear_ = true; } On 2015/08/26 ...
5 years, 3 months ago (2015-08-26 12:07:58 UTC) #29
rossberg
On 2015/08/26 12:07:58, rossberg wrote: > https://codereview.chromium.org/1312613003/diff/60001/src/scopes.h > File src/scopes.h (right): > > https://codereview.chromium.org/1312613003/diff/60001/src/scopes.h#newcode232 > ...
5 years, 3 months ago (2015-08-26 12:09:25 UTC) #30
Dan Ehrenberg
Could we leave tracking nonlinear scopes in ScopeInfo for a future patch? This one brings ...
5 years, 3 months ago (2015-08-27 01:40:49 UTC) #31
Dan Ehrenberg
On 2015/08/27 at 01:40:49, Dan Ehrenberg wrote: > Could we leave tracking nonlinear scopes in ...
5 years, 3 months ago (2015-08-27 01:56:23 UTC) #32
adamk
Your reasoning re: ScopeInfo sounds right to me. Can you add a note to scopes.h ...
5 years, 3 months ago (2015-08-27 16:21:04 UTC) #33
Dan Ehrenberg
On 2015/08/27 at 16:21:04, adamk wrote: > Your reasoning re: ScopeInfo sounds right to me. ...
5 years, 3 months ago (2015-08-27 18:33:22 UTC) #34
adamk
lgtm once you've added sloppy eval tests
5 years, 3 months ago (2015-08-27 18:42:07 UTC) #35
Michael Starzinger
Just pinging on one of my comments so that it doesn't drown in the noise. ...
5 years, 3 months ago (2015-08-27 19:10:09 UTC) #36
adamk
Final list of things that need to be fixed before landing: - Renaming of NeedsHoleCheck ...
5 years, 3 months ago (2015-08-27 19:12:49 UTC) #37
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1312613003/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1312613003/120001
5 years, 3 months ago (2015-08-27 20:50:47 UTC) #39
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1312613003/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1312613003/120001
5 years, 3 months ago (2015-08-27 20:59:57 UTC) #43
commit-bot: I haz the power
All required reviewers (with asterisk prefixes) have not yet approved this CL. No L-G-T-M from ...
5 years, 3 months ago (2015-08-27 21:00:02 UTC) #45
adamk
lgtm, I think you've satisfied rossberg's requirements with the added tests and comment in scopes.h
5 years, 3 months ago (2015-08-28 00:15:50 UTC) #47
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1312613003/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1312613003/120001
5 years, 3 months ago (2015-08-28 17:18:38 UTC) #49
commit-bot: I haz the power
Committed patchset #7 (id:120001)
5 years, 3 months ago (2015-08-28 18:49:52 UTC) #50
commit-bot: I haz the power
5 years, 3 months ago (2015-08-28 18:50:15 UTC) #51
Message was sent while issue was closed.
Patchset 7 (id:??) landed as
https://crrev.com/d6fb6de7097da908fd0a66804027ea189b559c0f
Cr-Commit-Position: refs/heads/master@{#30453}

Powered by Google App Engine
This is Rietveld 408576698