| 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; |
| 11 import '../universe/universe.dart' show Selector; | 11 import '../universe/universe.dart' show Selector; |
| 12 | 12 |
| 13 import 'builtin_operator.dart'; | 13 import 'builtin_operator.dart'; |
| 14 export 'builtin_operator.dart'; | 14 export 'builtin_operator.dart'; |
| 15 | 15 |
| 16 // These imports are only used for the JavaScript specific nodes. If we want to | 16 // These imports are only used for the JavaScript specific nodes. If we want to |
| 17 // support more than one native backend, we should probably create better | 17 // support more than one native backend, we should probably create better |
| 18 // abstractions for native code and its type and effect system. | 18 // abstractions for native code and its type and effect system. |
| 19 import '../js/js.dart' as js show Template; | 19 import '../js/js.dart' as js show Template; |
| 20 import '../native/native.dart' as native show NativeBehavior; | 20 import '../native/native.dart' as native show NativeBehavior; |
| 21 | 21 |
| 22 abstract class Node { | 22 abstract class Node { |
| 23 /// A pointer to the parent node. Is null until set by optimization passes. | 23 /// A pointer to the parent node. Is null until set by optimization passes. |
| 24 Node parent; | 24 Node parent; |
| 25 | 25 |
| 26 /// Workaround for a slow Object.hashCode in the VM. |
| 27 static int _usedHashCodes = 0; |
| 28 final int hashCode = ++_usedHashCodes; |
| 29 |
| 26 accept(Visitor visitor); | 30 accept(Visitor visitor); |
| 27 } | 31 } |
| 28 | 32 |
| 29 /// Expressions can be evaluated, and may diverge, throw, and/or have | 33 /// Expressions can be evaluated, and may diverge, throw, and/or have |
| 30 /// side-effects. | 34 /// side-effects. |
| 31 /// | 35 /// |
| 32 /// Evaluation continues by stepping into a sub-expression, invoking a | 36 /// Evaluation continues by stepping into a sub-expression, invoking a |
| 33 /// continuation, or throwing an exception. | 37 /// continuation, or throwing an exception. |
| 34 /// | 38 /// |
| 35 /// Expressions do not a return value. Expressions that produce values should | 39 /// Expressions do not a return value. Expressions that produce values should |
| (...skipping 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1625 /// Visit a just-deleted subterm and unlink all [Reference]s in it. | 1629 /// Visit a just-deleted subterm and unlink all [Reference]s in it. |
| 1626 class RemovalVisitor extends RecursiveVisitor { | 1630 class RemovalVisitor extends RecursiveVisitor { |
| 1627 processReference(Reference reference) { | 1631 processReference(Reference reference) { |
| 1628 reference.unlink(); | 1632 reference.unlink(); |
| 1629 } | 1633 } |
| 1630 | 1634 |
| 1631 static void remove(Node node) { | 1635 static void remove(Node node) { |
| 1632 (new RemovalVisitor()).visit(node); | 1636 (new RemovalVisitor()).visit(node); |
| 1633 } | 1637 } |
| 1634 } | 1638 } |
| OLD | NEW |