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

Issue 340005: In the toplevel compiler, shift the responsibility of assigning a... (Closed)

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

Description

In the toplevel compiler, shift the responsibility of assigning a location to an Expression AST node from the node's parent to the node itself. This allows an inherited code generation context from a parent node to be passed arbitrarily far down the tree (eg, the subexpression of a unary not is in the same context as the unary expression itself, the then and else subexpressions of the ternary operator are in the same context as the whole expression, and so forth). We do not yet take advantage of this in the backend (eg, the right subexpression of short-circuited OR is still compiled by using the parent's destination location, rather than the subexpression's itself). Committed: http://code.google.com/p/v8/source/detail?r=3163

Patch Set 1 #

Total comments: 7
Unified diffs Side-by-side diffs Delta from patch set Stats (+125 lines, -42 lines) Patch
M src/arm/fast-codegen-arm.cc View 1 chunk +2 lines, -5 lines 0 comments Download
M src/ast.h View 1 chunk +2 lines, -0 lines 0 comments Download
M src/ast.cc View 2 chunks +8 lines, -0 lines 0 comments Download
M src/compiler.cc View 14 chunks +109 lines, -27 lines 7 comments Download
M src/ia32/fast-codegen-ia32.cc View 1 chunk +2 lines, -5 lines 0 comments Download
M src/x64/fast-codegen-x64.cc View 1 chunk +2 lines, -5 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
Kevin Millikin (Chromium)
11 years, 1 month ago (2009-10-27 16:55:18 UTC) #1
fschneider
LGTM. Few small comments. http://codereview.chromium.org/340005/diff/1/4 File src/compiler.cc (right): http://codereview.chromium.org/340005/diff/1/4#newcode51 Line 51: location_(Location::Nowhere()) { I'm not ...
11 years, 1 month ago (2009-10-28 10:06:01 UTC) #2
William Hesse
LGTM. http://codereview.chromium.org/340005/diff/1/4 File src/compiler.cc (right): http://codereview.chromium.org/340005/diff/1/4#newcode666 Line 666: } Control flow is tricky here. Reversing ...
11 years, 1 month ago (2009-10-28 10:28:54 UTC) #3
Kevin Millikin (Chromium)
11 years, 1 month ago (2009-10-28 11:39:38 UTC) #4
http://codereview.chromium.org/340005/diff/1/4
File src/compiler.cc (right):

http://codereview.chromium.org/340005/diff/1/4#newcode51
Line 51: location_(Location::Nowhere()) {
On 2009/10/28 10:06:01, fschneider wrote:
> I'm not sure: Should this match the default location for ast nodes(TEMP)?

Possibly.  I wanted it to be nowhere when not inside an expression (visiting a
statement or declaration).  Now that every AST node gets a location explicitly
assigned, it might make sense to introduce an INVALID or UNITIALIZED one as
expression default to catch failure to assign.

I would do that as a separate change.

http://codereview.chromium.org/340005/diff/1/4#newcode666
Line 666: }
On 2009/10/28 10:28:54, William Hesse wrote:
> Control flow is tricky here.  Reversing sense of slot != NULL makes this an
if,
> else if that is easier to read.

I see what you mean.  I've changed it.

http://codereview.chromium.org/340005/diff/1/4#newcode778
Line 778: Visit(expr->key());
On 2009/10/28 10:06:01, fschneider wrote:
> Also set location here:
> 
> expr->set_location(location_);

You're right.  Svn update can't rewrite these :)

Powered by Google App Engine
This is Rietveld 408576698