Comment #17 on issue 3926 by [email protected]: Let/const in CaseBlock
https://code.google.com/p/v8/issues/detail?id=3926#c17

The following revision refers to this bug:
https://chromium.googlesource.com/v8/v8.git/+/d6fb6de7097da908fd0a66804027ea189b559c0f

commit d6fb6de7097da908fd0a66804027ea189b559c0f
Author: littledan <[email protected]>
Date: Fri Aug 28 18:49:48 2015

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

Review URL: https://codereview.chromium.org/1312613003

Cr-Commit-Position: refs/heads/master@{#30453}

[modify] http://crrev.com/d6fb6de7097da908fd0a66804027ea189b559c0f/src/full-codegen/arm/full-codegen-arm.cc [modify] http://crrev.com/d6fb6de7097da908fd0a66804027ea189b559c0f/src/full-codegen/arm64/full-codegen-arm64.cc [modify] http://crrev.com/d6fb6de7097da908fd0a66804027ea189b559c0f/src/full-codegen/full-codegen.cc [modify] http://crrev.com/d6fb6de7097da908fd0a66804027ea189b559c0f/src/full-codegen/full-codegen.h [modify] http://crrev.com/d6fb6de7097da908fd0a66804027ea189b559c0f/src/full-codegen/ia32/full-codegen-ia32.cc [modify] http://crrev.com/d6fb6de7097da908fd0a66804027ea189b559c0f/src/full-codegen/mips/full-codegen-mips.cc [modify] http://crrev.com/d6fb6de7097da908fd0a66804027ea189b559c0f/src/full-codegen/mips64/full-codegen-mips64.cc [modify] http://crrev.com/d6fb6de7097da908fd0a66804027ea189b559c0f/src/full-codegen/ppc/full-codegen-ppc.cc [modify] http://crrev.com/d6fb6de7097da908fd0a66804027ea189b559c0f/src/full-codegen/x64/full-codegen-x64.cc [modify] http://crrev.com/d6fb6de7097da908fd0a66804027ea189b559c0f/src/full-codegen/x87/full-codegen-x87.cc [modify] http://crrev.com/d6fb6de7097da908fd0a66804027ea189b559c0f/src/parser.cc [modify] http://crrev.com/d6fb6de7097da908fd0a66804027ea189b559c0f/src/scopes.cc [modify] http://crrev.com/d6fb6de7097da908fd0a66804027ea189b559c0f/src/scopes.h [add] http://crrev.com/d6fb6de7097da908fd0a66804027ea189b559c0f/test/mjsunit/regress/regress-3926.js


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to