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

Issue 7280012: Introduce scopes to keep track of catch blocks at compile time. (Closed)

Created:
9 years, 5 months ago by Kevin Millikin (Chromium)
Modified:
9 years, 5 months ago
CC:
v8-dev
Visibility:
Public.

Description

Introduce scopes to keep track of catch blocks at compile time. The catch variable is bound in the catch scope. For simplicity in this initial implementation, it is always allocated even if unused and always allocated to a catch context even if it doesn't escape. The presence of catch is no longer treated as a with. In this change, care must be taken to distinguish between the scope where a var declaration is hoisted to and the scope where the initialization occurs. R=ager@chromium.org BUG= TEST= Committed: http://code.google.com/p/v8/source/detail?r=8496

Patch Set 1 #

Patch Set 2 : Update to HEAD. #

Total comments: 15
Unified diffs Side-by-side diffs Delta from patch set Stats (+246 lines, -177 lines) Patch
M src/arm/full-codegen-arm.cc View 1 10 chunks +14 lines, -11 lines 2 comments Download
M src/ast.h View 1 chunk +10 lines, -4 lines 0 comments Download
M src/full-codegen.h View 1 3 chunks +3 lines, -1 line 0 comments Download
M src/full-codegen.cc View 3 chunks +6 lines, -2 lines 6 comments Download
M src/ia32/full-codegen-ia32.cc View 1 13 chunks +19 lines, -20 lines 0 comments Download
M src/parser.h View 3 chunks +6 lines, -2 lines 0 comments Download
M src/parser.cc View 23 chunks +83 lines, -50 lines 5 comments Download
M src/prettyprinter.cc View 3 chunks +5 lines, -4 lines 0 comments Download
M src/rewriter.cc View 1 chunk +1 line, -1 line 0 comments Download
M src/runtime.cc View 1 3 chunks +42 lines, -37 lines 1 comment Download
M src/scopes.h View 3 chunks +7 lines, -10 lines 0 comments Download
M src/scopes.cc View 4 chunks +28 lines, -16 lines 0 comments Download
M src/x64/full-codegen-x64.cc View 1 13 chunks +17 lines, -18 lines 0 comments Download
M test/mjsunit/mjsunit.status View 2 chunks +5 lines, -1 line 1 comment Download

Messages

Total messages: 4 (0 generated)
Kevin Millikin (Chromium)
http://codereview.chromium.org/7280012/diff/1001/src/parser.cc File src/parser.cc (right): http://codereview.chromium.org/7280012/diff/1001/src/parser.cc#newcode415 src/parser.cc:415: Scope* Parser::DeclarationScope() { As an alternative, we could keep ...
9 years, 5 months ago (2011-06-30 09:28:45 UTC) #1
Mads Ager (chromium)
LGTM http://codereview.chromium.org/7280012/diff/1001/src/arm/full-codegen-arm.cc File src/arm/full-codegen-arm.cc (right): http://codereview.chromium.org/7280012/diff/1001/src/arm/full-codegen-arm.cc#newcode153 src/arm/full-codegen-arm.cc:153: int receiver_offset = info->scope()->num_parameters() * kPointerSize; I'm getting ...
9 years, 5 months ago (2011-06-30 12:08:32 UTC) #2
Kevin Millikin (Chromium)
http://codereview.chromium.org/7280012/diff/1001/src/arm/full-codegen-arm.cc File src/arm/full-codegen-arm.cc (right): http://codereview.chromium.org/7280012/diff/1001/src/arm/full-codegen-arm.cc#newcode153 src/arm/full-codegen-arm.cc:153: int receiver_offset = info->scope()->num_parameters() * kPointerSize; I'm being overly ...
9 years, 5 months ago (2011-06-30 12:30:06 UTC) #3
Mads Ager (chromium)
9 years, 5 months ago (2011-06-30 12:47:44 UTC) #4
http://codereview.chromium.org/7280012/diff/1001/src/full-codegen.cc
File src/full-codegen.cc (right):

http://codereview.chromium.org/7280012/diff/1001/src/full-codegen.cc#newcode404
src/full-codegen.cc:404: offset += (info_->scope()->num_parameters() + 1) *
kPointerSize;
On 2011/06/30 12:30:06, Kevin Millikin wrote:
> This definitely needs to be the function's scope (info_->scope()), not the
> current scope which might be a catch scope, where num_parameters() == 0.

Should we create an accessor for that then: function_scope and scope?

http://codereview.chromium.org/7280012/diff/1001/src/full-codegen.cc#newcode1117
src/full-codegen.cc:1117: Scope* saved_scope = scope();
On 2011/06/30 12:30:06, Kevin Millikin wrote:
> It's only used here and I couldn't think of a comment that was more obvious
than
> the code itself.  Suggestions?

Not sure anything is really needed. You are right that the code is pretty self
explanatory. I was thinking something like:

"Use the scope extended with the catch variable for compiling the catch block."

to match the "Extend" comment above which is nice, but doesn't say anything more
than the code either.

Powered by Google App Engine
This is Rietveld 408576698