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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 } else { | 534 } else { |
535 return graph.addConstantBool(false, constantSystem); | 535 return graph.addConstantBool(false, constantSystem); |
536 } | 536 } |
537 } else if (expressionType.isArray()) { | 537 } else if (expressionType.isArray()) { |
538 if (identical(element, compiler.listClass) | 538 if (identical(element, compiler.listClass) |
539 || Elements.isListSupertype(element, compiler)) { | 539 || Elements.isListSupertype(element, compiler)) { |
540 return graph.addConstantBool(true, constantSystem); | 540 return graph.addConstantBool(true, constantSystem); |
541 } else { | 541 } else { |
542 return graph.addConstantBool(false, constantSystem); | 542 return graph.addConstantBool(false, constantSystem); |
543 } | 543 } |
544 // TODO(karlklose): remove the hasTypeArguments check. | 544 // Wee need the [:hasTypeArguments:] check because we don't have |
| 545 // the notion of generics in the backend. For example, [:this:] in |
| 546 // a class [:A<T>:], is currently always considered to have the |
| 547 // raw type. |
545 } else if (expressionType.isUseful() | 548 } else if (expressionType.isUseful() |
546 && !expressionType.canBeNull() | 549 && !expressionType.canBeNull() |
547 && !RuntimeTypeInformation.hasTypeArguments(type)) { | 550 && !RuntimeTypeInformation.hasTypeArguments(type)) { |
548 DartType receiverType = expressionType.computeType(compiler); | 551 DartType receiverType = expressionType.computeType(compiler); |
549 if (receiverType != null) { | 552 if (receiverType != null) { |
550 if (!receiverType.isMalformed && | 553 if (!receiverType.isMalformed && |
551 !type.isMalformed && | 554 !type.isMalformed && |
552 compiler.types.isSubtype(receiverType, type)) { | 555 compiler.types.isSubtype(receiverType.element.rawType, type)) { |
553 return graph.addConstantBool(true, constantSystem); | 556 return graph.addConstantBool(true, constantSystem); |
554 } else if (expressionType.isExact()) { | 557 } else if (expressionType.isExact()) { |
555 return graph.addConstantBool(false, constantSystem); | 558 return graph.addConstantBool(false, constantSystem); |
556 } | 559 } |
557 } | 560 } |
558 } | 561 } |
559 return node; | 562 return node; |
560 } | 563 } |
561 | 564 |
562 HInstruction visitTypeConversion(HTypeConversion node) { | 565 HInstruction visitTypeConversion(HTypeConversion node) { |
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1543 HBasicBlock block = user.block; | 1546 HBasicBlock block = user.block; |
1544 block.addAfter(user, interceptor); | 1547 block.addAfter(user, interceptor); |
1545 block.rewrite(user, interceptor); | 1548 block.rewrite(user, interceptor); |
1546 block.remove(user); | 1549 block.remove(user); |
1547 | 1550 |
1548 // The interceptor will be removed in the dead code elimination | 1551 // The interceptor will be removed in the dead code elimination |
1549 // phase. Note that removing it here would not work because of how | 1552 // phase. Note that removing it here would not work because of how |
1550 // the [visitBasicBlock] is implemented. | 1553 // the [visitBasicBlock] is implemented. |
1551 } | 1554 } |
1552 } | 1555 } |
OLD | NEW |