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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/optimize.dart

Issue 16104002: Detect (null type == null type), and change it to true. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of ssa; 5 part of ssa;
6 6
7 abstract class OptimizationPhase { 7 abstract class OptimizationPhase {
8 String get name; 8 String get name;
9 void visitGraph(HGraph graph); 9 void visitGraph(HGraph graph);
10 } 10 }
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 HType leftType = left.instructionType; 481 HType leftType = left.instructionType;
482 HType rightType = right.instructionType; 482 HType rightType = right.instructionType;
483 483
484 // Intersection of int and double return conflicting, so 484 // Intersection of int and double return conflicting, so
485 // we don't optimize on numbers to preserve the runtime semantics. 485 // we don't optimize on numbers to preserve the runtime semantics.
486 if (!(left.isNumberOrNull() && right.isNumberOrNull()) && 486 if (!(left.isNumberOrNull() && right.isNumberOrNull()) &&
487 leftType.intersection(rightType, compiler).isConflicting()) { 487 leftType.intersection(rightType, compiler).isConflicting()) {
488 return graph.addConstantBool(false, constantSystem); 488 return graph.addConstantBool(false, constantSystem);
489 } 489 }
490 490
491 if (left.isNull() && right.isNull()) {
492 return graph.addConstantBool(true, constantSystem);
493 }
494
491 if (left.isConstantBoolean() && right.isBoolean()) { 495 if (left.isConstantBoolean() && right.isBoolean()) {
492 HConstant constant = left; 496 HConstant constant = left;
493 if (constant.constant.isTrue()) { 497 if (constant.constant.isTrue()) {
494 return right; 498 return right;
495 } else { 499 } else {
496 return new HNot(right); 500 return new HNot(right);
497 } 501 }
498 } 502 }
499 503
500 if (right.isConstantBoolean() && left.isBoolean()) { 504 if (right.isConstantBoolean() && left.isBoolean()) {
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after
1484 } 1488 }
1485 1489
1486 // For other fields having setters in the generative constructor body, set 1490 // For other fields having setters in the generative constructor body, set
1487 // the type to UNKNOWN to avoid relying on the type set in the initializer 1491 // the type to UNKNOWN to avoid relying on the type set in the initializer
1488 // list. 1492 // list.
1489 allSetters.forEach((Element element) { 1493 allSetters.forEach((Element element) {
1490 backend.registerFieldConstructor(element, HType.UNKNOWN); 1494 backend.registerFieldConstructor(element, HType.UNKNOWN);
1491 }); 1495 });
1492 } 1496 }
1493 } 1497 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/nodes.dart ('k') | tests/compiler/dart2js/dead_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698