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 'dart:collection'; | 6 import 'dart:collection'; |
7 import '../constants/values.dart' as values show ConstantValue; | 7 import '../constants/values.dart' as values; |
8 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; | 8 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; |
9 import '../elements/elements.dart'; | 9 import '../elements/elements.dart'; |
10 import '../io/source_information.dart' show SourceInformation; | 10 import '../io/source_information.dart' show SourceInformation; |
11 import '../types/types.dart' show TypeMask; | 11 import '../types/types.dart' show TypeMask; |
12 import '../universe/universe.dart' show Selector; | 12 import '../universe/universe.dart' show Selector; |
13 | 13 |
14 import 'builtin_operator.dart'; | 14 import 'builtin_operator.dart'; |
15 export 'builtin_operator.dart'; | 15 export 'builtin_operator.dart'; |
16 | 16 |
17 // These imports are only used for the JavaScript specific nodes. If we want to | 17 // These imports are only used for the JavaScript specific nodes. If we want to |
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 bool get isSafeForReordering => true; | 962 bool get isSafeForReordering => true; |
963 | 963 |
964 toString() => 'CreateInstance($classElement)'; | 964 toString() => 'CreateInstance($classElement)'; |
965 } | 965 } |
966 | 966 |
967 class Interceptor extends Primitive { | 967 class Interceptor extends Primitive { |
968 final Reference<Primitive> input; | 968 final Reference<Primitive> input; |
969 final Set<ClassElement> interceptedClasses = new Set<ClassElement>(); | 969 final Set<ClassElement> interceptedClasses = new Set<ClassElement>(); |
970 final SourceInformation sourceInformation; | 970 final SourceInformation sourceInformation; |
971 | 971 |
| 972 /// If non-null, all uses of this the interceptor call are guaranteed to |
| 973 /// see this value. |
| 974 /// |
| 975 /// The interceptor call is not immediately replaced by the constant, because |
| 976 /// that might prevent the interceptor from being shared. |
| 977 /// |
| 978 /// The precise input type is not known when sharing interceptors, because |
| 979 /// refinement nodes have been removed by then. So this field carries the |
| 980 /// known constant until we know if it should be shared or replaced by |
| 981 /// the constant. |
| 982 values.InterceptorConstantValue constantValue; |
| 983 |
972 Interceptor(Primitive input, this.sourceInformation) | 984 Interceptor(Primitive input, this.sourceInformation) |
973 : this.input = new Reference<Primitive>(input); | 985 : this.input = new Reference<Primitive>(input); |
974 | 986 |
975 accept(Visitor visitor) => visitor.visitInterceptor(this); | 987 accept(Visitor visitor) => visitor.visitInterceptor(this); |
976 | 988 |
977 bool get isSafeForElimination => true; | 989 bool get isSafeForElimination => true; |
978 bool get isSafeForReordering => true; | 990 bool get isSafeForReordering => true; |
979 } | 991 } |
980 | 992 |
981 /// Create an instance of [Invocation] for use in a call to `noSuchMethod`. | 993 /// Create an instance of [Invocation] for use in a call to `noSuchMethod`. |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1721 /// Visit a just-deleted subterm and unlink all [Reference]s in it. | 1733 /// Visit a just-deleted subterm and unlink all [Reference]s in it. |
1722 class RemovalVisitor extends RecursiveVisitor { | 1734 class RemovalVisitor extends RecursiveVisitor { |
1723 processReference(Reference reference) { | 1735 processReference(Reference reference) { |
1724 reference.unlink(); | 1736 reference.unlink(); |
1725 } | 1737 } |
1726 | 1738 |
1727 static void remove(Node node) { | 1739 static void remove(Node node) { |
1728 (new RemovalVisitor()).visit(node); | 1740 (new RemovalVisitor()).visit(node); |
1729 } | 1741 } |
1730 } | 1742 } |
OLD | NEW |