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

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

Issue 10968060: Add a value range analysis phase to remove bounds checks. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 const HUnknownType() : super("unknown"); 135 const HUnknownType() : super("unknown");
136 bool canBePrimitive() => true; 136 bool canBePrimitive() => true;
137 bool canBeNull() => true; 137 bool canBeNull() => true;
138 138
139 HType union(HType other) => this; 139 HType union(HType other) => this;
140 HType intersection(HType other) => other; 140 HType intersection(HType other) => other;
141 } 141 }
142 142
143 class HConflictingType extends HAnalysisType { 143 class HConflictingType extends HAnalysisType {
144 const HConflictingType() : super("conflicting"); 144 const HConflictingType() : super("conflicting");
145 bool canBePrimitive() => false; 145 bool canBePrimitive() => true;
146 bool canBeNull() => false; 146 bool canBeNull() => true;
147 147
148 HType union(HType other) => other; 148 HType union(HType other) => other;
149 HType intersection(HType other) => this; 149 HType intersection(HType other) => this;
150 } 150 }
151 151
152 abstract class HPrimitiveType extends HType { 152 abstract class HPrimitiveType extends HType {
153 const HPrimitiveType(); 153 const HPrimitiveType();
154 bool isPrimitive() => true; 154 bool isPrimitive() => true;
155 bool canBePrimitive() => true; 155 bool canBePrimitive() => true;
156 bool isPrimitiveOrNull() => true; 156 bool isPrimitiveOrNull() => true;
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 operator [](HInstruction instruction) { 819 operator [](HInstruction instruction) {
820 HType result = _map[instruction]; 820 HType result = _map[instruction];
821 if (result == null) return instruction.guaranteedType; 821 if (result == null) return instruction.guaranteedType;
822 return result; 822 return result;
823 } 823 }
824 824
825 operator []=(HInstruction instruction, HType value) { 825 operator []=(HInstruction instruction, HType value) {
826 _map[instruction] = value; 826 _map[instruction] = value;
827 } 827 }
828 } 828 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/ssa.dart ('k') | lib/compiler/implementation/ssa/value_range_analyzer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698