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

Issue 10696192: Transform (x && y) && z into x && (y && z). (Closed)

Created:
8 years, 5 months ago by floitsch
Modified:
8 years, 5 months ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Transform (x && y) && z into x && (y && z). Committed: https://code.google.com/p/dart/source/detail?r=9626

Patch Set 1 #

Patch Set 2 : Remove debugging code. #

Total comments: 6

Patch Set 3 : Address comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+76 lines, -17 lines) Patch
M lib/compiler/implementation/ssa/builder.dart View 1 2 5 chunks +39 lines, -14 lines 0 comments Download
M lib/compiler/implementation/ssa/codegen_helpers.dart View 1 2 chunks +30 lines, -1 line 0 comments Download
M lib/compiler/implementation/tree/nodes.dart View 1 chunk +5 lines, -1 line 0 comments Download
M tests/compiler/dart2js/ssa_phi_codegen_test.dart View 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 3 (0 generated)
floitsch
8 years, 5 months ago (2012-07-12 11:33:40 UTC) #1
Lasse Reichstein Nielsen
LGTM https://chromiumcodereview.appspot.com/10696192/diff/2001/lib/compiler/implementation/ssa/builder.dart File lib/compiler/implementation/ssa/builder.dart (right): https://chromiumcodereview.appspot.com/10696192/diff/2001/lib/compiler/implementation/ssa/builder.dart#newcode3501 lib/compiler/implementation/ssa/builder.dart:3501: // where left is a logical and or ...
8 years, 5 months ago (2012-07-12 13:35:14 UTC) #2
floitsch
8 years, 5 months ago (2012-07-13 11:43:53 UTC) #3
https://chromiumcodereview.appspot.com/10696192/diff/2001/lib/compiler/implem...
File lib/compiler/implementation/ssa/builder.dart (right):

https://chromiumcodereview.appspot.com/10696192/diff/2001/lib/compiler/implem...
lib/compiler/implementation/ssa/builder.dart:3501: // where left is a logical
and or logical or.
On 2012/07/12 13:35:14, Lasse Reichstein Nielsen wrote:
> Put quotes around "and" and "or" when referencing the operation. Too many
"or"s
> in that sentence: "... and or logical or".

Done.

https://chromiumcodereview.appspot.com/10696192/diff/2001/lib/compiler/implem...
lib/compiler/implementation/ssa/builder.dart:3503: // For example (x && y) && z
is transformed into x && (y && z):
On 2012/07/12 13:35:14, Lasse Reichstein Nielsen wrote:
> Do we really want this?
> In the JS grammar, the former would not require a parenthesis, but the latter
> would, since the production is:
>   LogicalANDExpression :  LogicalANDExpression && BitwiseORExpression;
> I.e, it's left-associative, so why do we want to build right-associative
> expressions?

Yes. We have more parenthesis now, but in return the conditions are correctly
nested now, which helps with the propagations.

https://chromiumcodereview.appspot.com/10696192/diff/2001/lib/compiler/implem...
lib/compiler/implementation/ssa/builder.dart:3516: (send.isLogicalAnd && isAnd
|| send.isLogicalOr && !isAnd)) {
On 2012/07/12 13:35:14, Lasse Reichstein Nielsen wrote:
> More parentheses here, please. Not everyone knows the precedence difference
> between && and || :)
> Or just rewrite to:
>  isAnd ? send.isLogicalAnd : send.isLogicalOr

Done.

Powered by Google App Engine
This is Rietveld 408576698