Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: pkg/compiler/lib/src/ssa/locals_handler.dart

Issue 2615623002: Revert "Reduce use of Element in optimize.dart" (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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(FieldElement element) { 643 TypeMask getTypeOfCapturedVariable(Element element) {
644 assert(element.isField);
644 return cachedTypesOfCapturedVariables.putIfAbsent(element, () { 645 return cachedTypesOfCapturedVariables.putIfAbsent(element, () {
645 return TypeMaskFactory.inferredTypeForElement( 646 return TypeMaskFactory.inferredTypeForElement(
646 element, _globalInferenceResults); 647 element, _globalInferenceResults);
647 }); 648 });
648 } 649 }
649 650
650 /// Variables stored in the current activation. These variables are 651 /// Variables stored in the current activation. These variables are
651 /// being updated in try/catch blocks, and should be 652 /// being updated in try/catch blocks, and should be
652 /// accessed indirectly through [HLocalGet] and [HLocalSet]. 653 /// accessed indirectly through [HLocalGet] and [HLocalSet].
653 Map<Local, HLocalValue> activationVariables = <Local, HLocalValue>{}; 654 Map<Local, HLocalValue> activationVariables = <Local, HLocalValue>{};
654 } 655 }
655 656
656 /// A synthetic local variable only used with the SSA graph. 657 /// A synthetic local variable only used with the SSA graph.
657 /// 658 ///
658 /// For instance used for holding return value of function or the exception of a 659 /// For instance used for holding return value of function or the exception of a
659 /// try-catch statement. 660 /// try-catch statement.
660 class SyntheticLocal extends Local { 661 class SyntheticLocal extends Local {
661 final String name; 662 final String name;
662 final ExecutableElement executableContext; 663 final ExecutableElement executableContext;
663 664
664 // Avoid slow Object.hashCode. 665 // Avoid slow Object.hashCode.
665 final int hashCode = _nextHashCode = (_nextHashCode + 1).toUnsigned(30); 666 final int hashCode = _nextHashCode = (_nextHashCode + 1).toUnsigned(30);
666 static int _nextHashCode = 0; 667 static int _nextHashCode = 0;
667 668
668 SyntheticLocal(this.name, this.executableContext); 669 SyntheticLocal(this.name, this.executableContext);
669 670
670 toString() => 'SyntheticLocal($name)'; 671 toString() => 'SyntheticLocal($name)';
671 } 672 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/interceptor_simplifier.dart ('k') | pkg/compiler/lib/src/ssa/optimize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698