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

Side by Side Diff: lib/compiler/implementation/ssa/types.dart

Issue 10827180: Move types out of the HInstructions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Simplifications. Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 abstract class HType { 5 abstract class HType {
6 const HType(); 6 const HType();
7 7
8 /** 8 /**
9 * Returns an [HType] that represents [type] and all types that have 9 * Returns an [HType] that represents [type] and all types that have
10 * [type] as supertype. 10 * [type] as supertype.
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 HType intersection(HType other) { 755 HType intersection(HType other) {
756 if (other.isString()) return HType.STRING; 756 if (other.isString()) return HType.STRING;
757 if (other.isStringOrNull()) { 757 if (other.isStringOrNull()) {
758 return canBeNull() ? HType.STRING_OR_NULL : HType.STRING; 758 return canBeNull() ? HType.STRING_OR_NULL : HType.STRING;
759 } 759 }
760 if (other.isReadableArray()) return HType.CONFLICTING; 760 if (other.isReadableArray()) return HType.CONFLICTING;
761 if (other.isIndexablePrimitive()) return HType.STRING; 761 if (other.isIndexablePrimitive()) return HType.STRING;
762 return super.intersection(other); 762 return super.intersection(other);
763 } 763 }
764 } 764 }
765
766 class HTypeMap {
767 Map<HInstruction, HType> _map;
768
769 HTypeMap() : _map = new Map<HInstruction, HType>();
770
771 operator [](HInstruction instruction) {
772 HType result = _map[instruction];
773 if (result == null) return instruction.guaranteedType;
774 return result;
775 }
776
777 operator []=(HInstruction instruction, HType value) {
778 _map[instruction] = value;
779 }
780 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698