| OLD | NEW |
| 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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 // If the intersection of the types is still the incoming type then | 504 // If the intersection of the types is still the incoming type then |
| 505 // the incoming type was a subtype of the guarded type, and no check | 505 // the incoming type was a subtype of the guarded type, and no check |
| 506 // is required. | 506 // is required. |
| 507 HType combinedType = types[value].intersection(node.guardedType, compiler); | 507 HType combinedType = types[value].intersection(node.guardedType, compiler); |
| 508 return (combinedType == types[value]) ? value : node; | 508 return (combinedType == types[value]) ? value : node; |
| 509 } | 509 } |
| 510 | 510 |
| 511 HInstruction visitIs(HIs node) { | 511 HInstruction visitIs(HIs node) { |
| 512 DartType type = node.typeExpression; | 512 DartType type = node.typeExpression; |
| 513 Element element = type.element; | 513 Element element = type.element; |
| 514 if (identical(element.kind, ElementKind.TYPE_VARIABLE)) { | 514 if (element.isTypeVariable()) { |
| 515 compiler.unimplemented("visitIs for type variables"); | 515 compiler.unimplemented("visitIs for type variables"); |
| 516 } if (element.isTypedef()) { |
| 517 return node; |
| 516 } | 518 } |
| 517 | 519 |
| 518 HType expressionType = types[node.expression]; | 520 HType expressionType = types[node.expression]; |
| 519 if (identical(element, compiler.objectClass) | 521 if (identical(element, compiler.objectClass) |
| 520 || identical(element, compiler.dynamicClass)) { | 522 || identical(element, compiler.dynamicClass)) { |
| 521 return graph.addConstantBool(true, constantSystem); | 523 return graph.addConstantBool(true, constantSystem); |
| 522 } else if (expressionType.isInteger()) { | 524 } else if (expressionType.isInteger()) { |
| 523 if (identical(element, compiler.intClass) | 525 if (identical(element, compiler.intClass) |
| 524 || identical(element, compiler.numClass) | 526 || identical(element, compiler.numClass) |
| 525 || Elements.isNumberOrStringSupertype(element, compiler)) { | 527 || Elements.isNumberOrStringSupertype(element, compiler)) { |
| (...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1475 HInstruction receiver = interceptor.receiver; | 1477 HInstruction receiver = interceptor.receiver; |
| 1476 for (var user in receiver.usedBy) { | 1478 for (var user in receiver.usedBy) { |
| 1477 if (user is HInterceptor && interceptor.dominates(user)) { | 1479 if (user is HInterceptor && interceptor.dominates(user)) { |
| 1478 user.interceptedClasses = interceptor.interceptedClasses; | 1480 user.interceptedClasses = interceptor.interceptedClasses; |
| 1479 } | 1481 } |
| 1480 } | 1482 } |
| 1481 } | 1483 } |
| 1482 | 1484 |
| 1483 // TODO(ngeoffray): Also implement it for non-intercepted calls. | 1485 // TODO(ngeoffray): Also implement it for non-intercepted calls. |
| 1484 } | 1486 } |
| OLD | NEW |