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

Issue 10830275: Optimize expressions of the form (expr === true) when expr has boolean type. (Closed)

Created:
8 years, 4 months ago by Florian Schneider
Modified:
8 years, 4 months ago
CC:
reviews_dartlang.org, vm-dev_dartlang.org, zerny-google
Visibility:
Public.

Description

Optimize expressions of the form (expr === true) when expr has boolean type. This allows us to generate better code for many short-circuit expressions like a || b, a && b if we can statically determine the type of the subexpressions. Also: Avoid disassembling optimized functions twice with --disassemble --disassemble-optimized. Committed: https://code.google.com/p/dart/source/detail?r=10568

Patch Set 1 #

Patch Set 2 : fixed off-by-one in ReplaceUsesWith #

Patch Set 3 : #

Patch Set 4 : ready for review #

Total comments: 4

Patch Set 5 : addressed comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+102 lines, -7 lines) Patch
M vm/compiler.cc View 1 2 3 2 chunks +4 lines, -2 lines 0 comments Download
M vm/flow_graph_optimizer.h View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M vm/flow_graph_optimizer.cc View 1 2 3 2 chunks +25 lines, -1 line 0 comments Download
M vm/il_printer.cc View 1 2 3 3 chunks +11 lines, -0 lines 0 comments Download
M vm/intermediate_language.h View 1 2 3 5 chunks +11 lines, -0 lines 0 comments Download
M vm/intermediate_language.cc View 1 2 3 4 3 chunks +49 lines, -2 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
Florian Schneider
8 years, 4 months ago (2012-08-13 10:15:12 UTC) #1
Florian Schneider
On 2012/08/13 10:15:12, Florian Schneider wrote: Oops, don't review yet....
8 years, 4 months ago (2012-08-13 10:16:20 UTC) #2
Florian Schneider
Ready for review.
8 years, 4 months ago (2012-08-13 12:11:21 UTC) #3
Kevin Millikin (Google)
I think it's missing a NULL check. https://chromiumcodereview.appspot.com/10830275/diff/6005/vm/intermediate_language.cc File vm/intermediate_language.cc (right): https://chromiumcodereview.appspot.com/10830275/diff/6005/vm/intermediate_language.cc#newcode1025 vm/intermediate_language.cc:1025: right_use->definition()->AsBind()->computation()->AsConstant(); right->computation()->AsConstant() ...
8 years, 4 months ago (2012-08-13 12:43:34 UTC) #4
Kevin Millikin (Google)
But otherwise LGTM.
8 years, 4 months ago (2012-08-13 12:43:54 UTC) #5
Florian Schneider
8 years, 4 months ago (2012-08-13 12:58:07 UTC) #6
https://chromiumcodereview.appspot.com/10830275/diff/6005/vm/intermediate_lan...
File vm/intermediate_language.cc (right):

https://chromiumcodereview.appspot.com/10830275/diff/6005/vm/intermediate_lan...
vm/intermediate_language.cc:1025:
right_use->definition()->AsBind()->computation()->AsConstant();
On 2012/08/13 12:43:34, kmillikin wrote:
> right->computation()->AsConstant()

Done.

https://chromiumcodereview.appspot.com/10830275/diff/6005/vm/intermediate_lan...
vm/intermediate_language.cc:1032: (kind() == Token::kEQ_STRICT) &&
On 2012/08/13 12:43:34, kmillikin wrote:
> (left_type.raw() == Type::BoolInterface()) &&
> (kind() == Token::kEQ_STRICT) &&
> (right_constant != NULL) &
> (right_constant->value().raw() == Bool::True())

Thanks. Done.

Powered by Google App Engine
This is Rietveld 408576698