| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library dart2js.ir_nodes; | 4 library dart2js.ir_nodes; |
| 5 | 5 |
| 6 import '../constants/values.dart' as values show ConstantValue; | 6 import '../constants/values.dart' as values show ConstantValue; |
| 7 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; | 7 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; |
| 8 import '../elements/elements.dart'; | 8 import '../elements/elements.dart'; |
| 9 import '../io/source_information.dart' show SourceInformation; | 9 import '../io/source_information.dart' show SourceInformation; |
| 10 import '../types/types.dart' show TypeMask; | 10 import '../types/types.dart' show TypeMask; |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 | 707 |
| 708 GetField(Primitive object, this.field) | 708 GetField(Primitive object, this.field) |
| 709 : this.object = new Reference<Primitive>(object); | 709 : this.object = new Reference<Primitive>(object); |
| 710 | 710 |
| 711 accept(Visitor visitor) => visitor.visitGetField(this); | 711 accept(Visitor visitor) => visitor.visitGetField(this); |
| 712 | 712 |
| 713 bool get isSafeForElimination => objectIsNotNull; | 713 bool get isSafeForElimination => objectIsNotNull; |
| 714 bool get isSafeForReordering => objectIsNotNull && field.isFinal; | 714 bool get isSafeForReordering => objectIsNotNull && field.isFinal; |
| 715 } | 715 } |
| 716 | 716 |
| 717 /// Get the length of a native list. | 717 /// Get the length of a string or native list. |
| 718 class GetLength extends Primitive { | 718 class GetLength extends Primitive { |
| 719 final Reference<Primitive> object; | 719 final Reference<Primitive> object; |
| 720 | 720 |
| 721 /// True if the object is known not to be null. | 721 /// True if the object is known not to be null. |
| 722 bool objectIsNotNull = false; | 722 bool objectIsNotNull = false; |
| 723 | 723 |
| 724 GetLength(Primitive object) : this.object = new Reference<Primitive>(object); | 724 GetLength(Primitive object) : this.object = new Reference<Primitive>(object); |
| 725 | 725 |
| 726 bool get isSafeForElimination => objectIsNotNull; | 726 bool get isSafeForElimination => objectIsNotNull; |
| 727 bool get isSafeForReordering => false; | 727 bool get isSafeForReordering => false; |
| 728 | 728 |
| 729 accept(Visitor v) => v.visitGetLength(this); | 729 accept(Visitor v) => v.visitGetLength(this); |
| 730 } | 730 } |
| 731 | 731 |
| 732 /// Read an entry from a native list. | 732 /// Read an entry from a string or native list. |
| 733 /// | 733 /// |
| 734 /// [object] must be null or a native list, and [index] must be an integer. | 734 /// [object] must be null or a native list or a string, and [index] must be |
| 735 /// an integer. |
| 735 class GetIndex extends Primitive { | 736 class GetIndex extends Primitive { |
| 736 final Reference<Primitive> object; | 737 final Reference<Primitive> object; |
| 737 final Reference<Primitive> index; | 738 final Reference<Primitive> index; |
| 738 | 739 |
| 739 /// True if the object is known not to be null. | 740 /// True if the object is known not to be null. |
| 740 bool objectIsNotNull = false; | 741 bool objectIsNotNull = false; |
| 741 | 742 |
| 742 GetIndex(Primitive object, Primitive index) | 743 GetIndex(Primitive object, Primitive index) |
| 743 : this.object = new Reference<Primitive>(object), | 744 : this.object = new Reference<Primitive>(object), |
| 744 this.index = new Reference<Primitive>(index); | 745 this.index = new Reference<Primitive>(index); |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1624 /// Visit a just-deleted subterm and unlink all [Reference]s in it. | 1625 /// Visit a just-deleted subterm and unlink all [Reference]s in it. |
| 1625 class RemovalVisitor extends RecursiveVisitor { | 1626 class RemovalVisitor extends RecursiveVisitor { |
| 1626 processReference(Reference reference) { | 1627 processReference(Reference reference) { |
| 1627 reference.unlink(); | 1628 reference.unlink(); |
| 1628 } | 1629 } |
| 1629 | 1630 |
| 1630 static void remove(Node node) { | 1631 static void remove(Node node) { |
| 1631 (new RemovalVisitor()).visit(node); | 1632 (new RemovalVisitor()).visit(node); |
| 1632 } | 1633 } |
| 1633 } | 1634 } |
| OLD | NEW |