| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import '../closure.dart'; | 5 import '../closure.dart'; |
| 6 import '../common.dart'; | 6 import '../common.dart'; |
| 7 import '../compiler.dart' show Compiler; | 7 import '../compiler.dart' show Compiler; |
| 8 import '../elements/resolution_types.dart'; | 8 import '../elements/resolution_types.dart'; |
| 9 import '../elements/elements.dart'; | 9 import '../elements/elements.dart'; |
| 10 import '../io/source_information.dart'; | 10 import '../io/source_information.dart'; |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 result = new TypeMask.nonNullSubclass(cls.declaration, closedWorld); | 633 result = new TypeMask.nonNullSubclass(cls.declaration, closedWorld); |
| 634 } | 634 } |
| 635 cachedTypeOfThis = result; | 635 cachedTypeOfThis = result; |
| 636 } | 636 } |
| 637 return result; | 637 return result; |
| 638 } | 638 } |
| 639 | 639 |
| 640 Map<Element, TypeMask> cachedTypesOfCapturedVariables = | 640 Map<Element, TypeMask> cachedTypesOfCapturedVariables = |
| 641 new Map<Element, TypeMask>(); | 641 new Map<Element, TypeMask>(); |
| 642 | 642 |
| 643 TypeMask getTypeOfCapturedVariable(Element element) { | 643 TypeMask getTypeOfCapturedVariable(FieldElement element) { |
| 644 assert(element.isField); | |
| 645 return cachedTypesOfCapturedVariables.putIfAbsent(element, () { | 644 return cachedTypesOfCapturedVariables.putIfAbsent(element, () { |
| 646 return TypeMaskFactory.inferredTypeForElement( | 645 return TypeMaskFactory.inferredTypeForElement( |
| 647 element, _globalInferenceResults); | 646 element, _globalInferenceResults); |
| 648 }); | 647 }); |
| 649 } | 648 } |
| 650 | 649 |
| 651 /// Variables stored in the current activation. These variables are | 650 /// Variables stored in the current activation. These variables are |
| 652 /// being updated in try/catch blocks, and should be | 651 /// being updated in try/catch blocks, and should be |
| 653 /// accessed indirectly through [HLocalGet] and [HLocalSet]. | 652 /// accessed indirectly through [HLocalGet] and [HLocalSet]. |
| 654 Map<Local, HLocalValue> activationVariables = <Local, HLocalValue>{}; | 653 Map<Local, HLocalValue> activationVariables = <Local, HLocalValue>{}; |
| 655 } | 654 } |
| 656 | 655 |
| 657 /// A synthetic local variable only used with the SSA graph. | 656 /// A synthetic local variable only used with the SSA graph. |
| 658 /// | 657 /// |
| 659 /// For instance used for holding return value of function or the exception of a | 658 /// For instance used for holding return value of function or the exception of a |
| 660 /// try-catch statement. | 659 /// try-catch statement. |
| 661 class SyntheticLocal extends Local { | 660 class SyntheticLocal extends Local { |
| 662 final String name; | 661 final String name; |
| 663 final ExecutableElement executableContext; | 662 final ExecutableElement executableContext; |
| 664 | 663 |
| 665 // Avoid slow Object.hashCode. | 664 // Avoid slow Object.hashCode. |
| 666 final int hashCode = _nextHashCode = (_nextHashCode + 1).toUnsigned(30); | 665 final int hashCode = _nextHashCode = (_nextHashCode + 1).toUnsigned(30); |
| 667 static int _nextHashCode = 0; | 666 static int _nextHashCode = 0; |
| 668 | 667 |
| 669 SyntheticLocal(this.name, this.executableContext); | 668 SyntheticLocal(this.name, this.executableContext); |
| 670 | 669 |
| 671 toString() => 'SyntheticLocal($name)'; | 670 toString() => 'SyntheticLocal($name)'; |
| 672 } | 671 } |
| OLD | NEW |