OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library tree_ir_nodes; | 5 library tree_ir_nodes; |
6 | 6 |
7 import '../constants/values.dart' as values; | 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; |
(...skipping 25 matching lines...) Expand all Loading... |
36 // In contrast to the CPS-based IR, non-primitive expressions can be named and | 36 // In contrast to the CPS-based IR, non-primitive expressions can be named and |
37 // arguments (to calls, primitives, and blocks) can be arbitrary expressions. | 37 // arguments (to calls, primitives, and blocks) can be arbitrary expressions. |
38 // | 38 // |
39 // Additionally, variables are considered in scope within inner functions; | 39 // Additionally, variables are considered in scope within inner functions; |
40 // closure variables are thus handled directly instead of using ref cells. | 40 // closure variables are thus handled directly instead of using ref cells. |
41 | 41 |
42 /** | 42 /** |
43 * The base class of all Tree nodes. | 43 * The base class of all Tree nodes. |
44 */ | 44 */ |
45 abstract class Node { | 45 abstract class Node { |
| 46 /// Workaround for a slow Object.hashCode in the VM. |
| 47 static int _usedHashCodes = 0; |
| 48 final int hashCode = ++_usedHashCodes; |
46 } | 49 } |
47 | 50 |
48 /** | 51 /** |
49 * The base class of [Expression]s. | 52 * The base class of [Expression]s. |
50 */ | 53 */ |
51 abstract class Expression extends Node { | 54 abstract class Expression extends Node { |
52 accept(ExpressionVisitor v); | 55 accept(ExpressionVisitor v); |
53 accept1(ExpressionVisitor1 v, arg); | 56 accept1(ExpressionVisitor1 v, arg); |
54 } | 57 } |
55 | 58 |
(...skipping 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1534 | 1537 |
1535 /// Number of uses of the current fallthrough target. | 1538 /// Number of uses of the current fallthrough target. |
1536 int get useCount => _stack.last.useCount; | 1539 int get useCount => _stack.last.useCount; |
1537 | 1540 |
1538 /// Indicate that a statement will fall through to the current fallthrough | 1541 /// Indicate that a statement will fall through to the current fallthrough |
1539 /// target. | 1542 /// target. |
1540 void use() { | 1543 void use() { |
1541 ++_stack.last.useCount; | 1544 ++_stack.last.useCount; |
1542 } | 1545 } |
1543 } | 1546 } |
OLD | NEW |