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

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

Issue 10095014: Implement interface types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 interface OptimizationPhase { 5 interface OptimizationPhase {
6 String get name(); 6 String get name();
7 void visitGraph(HGraph graph); 7 void visitGraph(HGraph graph);
8 } 8 }
9 9
10 class SsaOptimizerTask extends CompilerTask { 10 class SsaOptimizerTask extends CompilerTask {
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 HInstruction value = node.guarded; 188 HInstruction value = node.guarded;
189 return (value.type.combine(node.type) == value.type) ? value : node; 189 return (value.type.combine(node.type) == value.type) ? value : node;
190 } 190 }
191 191
192 HInstruction visitIntegerCheck(HIntegerCheck node) { 192 HInstruction visitIntegerCheck(HIntegerCheck node) {
193 HInstruction value = node.value; 193 HInstruction value = node.value;
194 return value.isInteger() ? value : node; 194 return value.isInteger() ? value : node;
195 } 195 }
196 196
197 HInstruction visitIs(HIs node) { 197 HInstruction visitIs(HIs node) {
198 Element element = node.typeExpression; 198 Type type = node.typeName;
199 Element element = type.element;
199 if (element.kind === ElementKind.TYPE_VARIABLE) { 200 if (element.kind === ElementKind.TYPE_VARIABLE) {
200 compiler.unimplemented("visitIs for type variables"); 201 compiler.unimplemented("visitIs for type variables");
201 } 202 }
202 203
203 HType expressionType = node.expression.type; 204 HType expressionType = node.expression.type;
204 if (element === compiler.objectClass 205 if (element === compiler.objectClass
205 || element === compiler.dynamicClass) { 206 || element === compiler.dynamicClass) {
206 return graph.addConstantBool(true); 207 return graph.addConstantBool(true);
207 } else if (expressionType.isInteger()) { 208 } else if (expressionType.isInteger()) {
208 if (element === compiler.intClass || element === compiler.numClass) { 209 if (element === compiler.intClass || element === compiler.numClass) {
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 } 705 }
705 } 706 }
706 if (!canBeMoved) continue; 707 if (!canBeMoved) continue;
707 708
708 // This is safe because we are running after GVN. 709 // This is safe because we are running after GVN.
709 // TODO(ngeoffray): ensure GVN has been run. 710 // TODO(ngeoffray): ensure GVN has been run.
710 set_.add(current); 711 set_.add(current);
711 } 712 }
712 } 713 }
713 } 714 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/nodes.dart ('k') | lib/compiler/implementation/typechecker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698