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

Issue 7792100: Simplfy handling of exits from scoped blocks. (Closed)

Created:
9 years, 3 months ago by Steven
Modified:
9 years, 3 months ago
CC:
v8-dev
Visibility:
Public.

Description

Simplfy handling of exits from scoped blocks. BUG= TEST=mjsunit/harmony/block-leave.js Committed: http://code.google.com/p/v8/source/detail?r=9157

Patch Set 1 #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+249 lines, -14 lines) Patch
M src/full-codegen.h View 1 chunk +18 lines, -0 lines 4 comments Download
M src/full-codegen.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M src/parser.cc View 1 chunk +4 lines, -12 lines 2 comments Download
A test/mjsunit/harmony/block-leave.js View 1 chunk +225 lines, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Steven
PTAL.
9 years, 3 months ago (2011-09-02 15:07:21 UTC) #1
Kevin Millikin (Chromium)
LGTM, with a few comments below and a suggestion for a simple cleanup as a ...
9 years, 3 months ago (2011-09-02 15:17:43 UTC) #2
Steven
9 years, 3 months ago (2011-09-05 08:54:49 UTC) #3
http://codereview.chromium.org/7792100/diff/1/src/full-codegen.h
File src/full-codegen.h (right):

http://codereview.chromium.org/7792100/diff/1/src/full-codegen.h#newcode197
src/full-codegen.h:197: explicit NestedBlock(FullCodeGenerator* codegen, Block*
block)
On 2011/09/02 15:17:44, Kevin Millikin wrote:
> No need for explicit for two argument constructors.

Done.

http://codereview.chromium.org/7792100/diff/1/src/full-codegen.h#newcode209
src/full-codegen.h:209: Block* block_;
On 2011/09/02 15:17:44, Kevin Millikin wrote:
> This class doesn't need to store the block since the base class does.  You
> probably will just need a cast:
> 
> virtual NestedStatement* Exit(int* stack_depth, int* context_length) {
>   if (statement()->AsBlock()->block_scope() != NULL) ...

Done.

http://codereview.chromium.org/7792100/diff/1/src/parser.cc
File src/parser.cc (right):

http://codereview.chromium.org/7792100/diff/1/src/parser.cc#newcode1593
src/parser.cc:1593: exit->AddStatement(new(zone()) ExitContextStatement());
Will do it.
On 2011/09/02 15:17:44, Kevin Millikin wrote:
> Now we're no longer making essential use of ExitContextStatement (it's
> completely predictable where it will occur).
> 
> As a next change, can you get rid of it?  'With' already makes do without it
by
> compiling the code implicitly at the end of the body.  Catch and blocks with
> scopes could do the same.

Powered by Google App Engine
This is Rietveld 408576698