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

Issue 6976028: Reduced the code ping-pong between the full code generator and contexts a bit. (Closed)

Created:
9 years, 7 months ago by Sven Panne
Modified:
9 years, 6 months ago
CC:
v8-dev
Visibility:
Public.

Description

Reduced the code ping-pong between the full code generator and contexts a bit. * Centralized AND/OR handling, keeping related code together. * Removed HandleExpression/HandleInNonTestContext and introduced VisitInSameContext instead, making it more obvious what's actually going on. * Consistently use a new context when visiting the left sub-expression of an AND/OR. Note that the context stacks in the full code generator and crankshaft are still a bit out of sync for the right sub-expression.

Patch Set 1 #

Patch Set 2 : '' #

Total comments: 16
Unified diffs Side-by-side diffs Delta from patch set Stats (+121 lines, -198 lines) Patch
M src/arm/full-codegen-arm.cc View 1 chunk +1 line, -1 line 0 comments Download
M src/full-codegen.h View 9 chunks +14 lines, -35 lines 6 comments Download
M src/full-codegen.cc View 1 4 chunks +103 lines, -159 lines 10 comments Download
M src/ia32/full-codegen-ia32.cc View 1 chunk +1 line, -1 line 0 comments Download
M src/mips/full-codegen-mips.cc View 1 chunk +1 line, -1 line 0 comments Download
M src/x64/full-codegen-x64.cc View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 4 (0 generated)
Sven Panne
9 years, 7 months ago (2011-05-26 14:27:52 UTC) #1
fschneider
I'm not sure about the direction of this change. First, I'd really would like to ...
9 years, 6 months ago (2011-05-31 10:57:12 UTC) #2
Kevin Millikin (Chromium)
I have some naming suggestions. Otherwise, LGTM. http://codereview.chromium.org/6976028/diff/1007/src/full-codegen.cc File src/full-codegen.cc (right): http://codereview.chromium.org/6976028/diff/1007/src/full-codegen.cc#newcode704 src/full-codegen.cc:704: Comment cmnt(masm_, ...
9 years, 6 months ago (2011-05-31 11:46:27 UTC) #3
Sven Panne
9 years, 6 months ago (2011-05-31 14:30:33 UTC) #4
http://codereview.chromium.org/6976028/diff/1007/src/full-codegen.cc
File src/full-codegen.cc (right):

http://codereview.chromium.org/6976028/diff/1007/src/full-codegen.cc#newcode704
src/full-codegen.cc:704: Comment cmnt(masm_, "[ BinaryOperation");
On 2011/05/31 11:46:28, Kevin Millikin wrote:
> By moving this comment into VisitComma, VisitLogical..., VisitArithmetic...,
you
> can emit a more descriptive comment.

Done.

http://codereview.chromium.org/6976028/diff/1007/src/full-codegen.cc#newcode707
src/full-codegen.cc:707: case Token::OR: return VisitAndOr(expr, false);
On 2011/05/31 11:46:28, Kevin Millikin wrote:
> Let's not pass the flag here, since we can just use the expression:
> 
> case Token::OR:
> case Token::AND:
>   return VisitLogicalOperation(expr);
> ...

Done, same for HGraphBuilder.

http://codereview.chromium.org/6976028/diff/1007/src/full-codegen.cc#newcode745
src/full-codegen.cc:745: int rightId = expr->RightId();
On 2011/05/31 11:46:28, Kevin Millikin wrote:
> right_id

Done.

http://codereview.chromium.org/6976028/diff/1007/src/full-codegen.cc#newcode748
src/full-codegen.cc:748: if (context()->IsTest()) {
On 2011/05/31 11:46:28, Kevin Millikin wrote:
> I did like having this code as virtual functions on the context classes.

In principle I agree that the explicit IfFooContext() calls are not nice, but
moving the if/then/else branches to the contexts would result in a heavy feature
envy regarding the full code generator. Removing this feature envy was basically
the main motivation for this change. Furthermore, similar ifs are elsewhere, so
this is more consistent.

In a nutshell: We should improve how we handle the triple dispatch, but not in
this change.

http://codereview.chromium.org/6976028/diff/1007/src/full-codegen.cc#newcode826
src/full-codegen.cc:826: AstVisitor::Visit(expr);
On 2011/05/31 11:46:28, Kevin Millikin wrote:
> This can just be Visit(expr), can't it?

Done.

http://codereview.chromium.org/6976028/diff/1007/src/full-codegen.h
File src/full-codegen.h (right):

http://codereview.chromium.org/6976028/diff/1007/src/full-codegen.h#newcode331
src/full-codegen.h:331: VisitInSameContext(expr);
On 2011/05/31 11:46:28, Kevin Millikin wrote:
> "SameContext" is not quite right because it raises the question "same as
what?".
>  Can we try something like VisitInCurrentContext?

Done.

http://codereview.chromium.org/6976028/diff/1007/src/full-codegen.h#newcode547
src/full-codegen.h:547: void VisitAndOr(BinaryOperation* expr, bool
is_logical_and);
On 2011/05/31 11:46:28, Kevin Millikin wrote:
> VisitLogicalOperation?   We should get Logical in there (also used in the
spec)
> to distinguish from the bitwise operations.

OK, I'm changing HGraphBuilder's corresponding method in the same way.

http://codereview.chromium.org/6976028/diff/1007/src/full-codegen.h#newcode548
src/full-codegen.h:548: void VisitCommon(BinaryOperation* expr);
On 2011/05/31 11:46:28, Kevin Millikin wrote:
> Common is nondescriptive.  How about ArithmeticOperation?

OK, I'll sync HGraphBuilder, too.

Powered by Google App Engine
This is Rietveld 408576698