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

Unified Diff: lib/compiler/implementation/ssa/codegen_helpers.dart

Issue 10695106: Allow === and == to generate inputs at the use site when compiling to a single comparison (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/compiler/implementation/ssa/codegen.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/codegen_helpers.dart
diff --git a/lib/compiler/implementation/ssa/codegen_helpers.dart b/lib/compiler/implementation/ssa/codegen_helpers.dart
index 4344721da0b14d7f8ad8f767a296dbf9ed10fc3e..9460ff3aa0774cfe270a4726e7fe1f71892bf52f 100644
--- a/lib/compiler/implementation/ssa/codegen_helpers.dart
+++ b/lib/compiler/implementation/ssa/codegen_helpers.dart
@@ -52,16 +52,26 @@ class SsaInstructionMerger extends HBaseVisitor {
// they would not be alive.
void visitTypeGuard(HTypeGuard instruction) {}
- // If an equality operation is builtin it must not have its input generated at
- // use site, because it's using it multiple times (because of null/undefined).
+ // If an equality operation is builtin it must only have its inputs generated
+ // at use site if does not require an expression with repeated uses (because
floitsch 2012/07/09 20:02:33 if it
sra1 2012/07/09 20:18:58 Done.
+ // of null / undefined).
void visitEquals(HEquals instruction) {
if (!instruction.builtin) super.visitEquals(instruction);
- // Otherwise do nothing.
+ if (singleIdentityComparison(instruction.left, instruction.right) != null) {
+ super.visitEquals(instruction);
+ }
+ // Do nothing.
}
- // Identity operations must not have its input generated at use site, because
- // it's using it multiple times (because of null/undefined).
- void visitIdentity(HIdentity instruction) {}
+ // An identity operation must only have its inputs generated at use site if
+ // does not require an expression with multiple uses (because of null /
+ // undefined).
+ void visitIdentity(HIdentity instruction) {
+ if (singleIdentityComparison(instruction.left, instruction.right) != null) {
+ super.visitIdentity(instruction);
+ }
+ // Do nothing.
+ }
void visitTypeConversion(HTypeConversion instruction) {
if (!instruction.isChecked) {
« no previous file with comments | « lib/compiler/implementation/ssa/codegen.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698