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

Side by Side Diff: lib/compiler/implementation/ssa/codegen.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) 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 class SsaCodeGeneratorTask extends CompilerTask { 5 class SsaCodeGeneratorTask extends CompilerTask {
6 SsaCodeGeneratorTask(Compiler compiler) : super(compiler); 6 SsaCodeGeneratorTask(Compiler compiler) : super(compiler);
7 String get name() => 'SSA code generator'; 7 String get name() => 'SSA code generator';
8 8
9 9
10 String generateMethod(WorkItem work, HGraph graph) { 10 String generateMethod(WorkItem work, HGraph graph) {
(...skipping 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after
1458 beginExpression(JSPrecedence.LOGICAL_OR_PRECEDENCE); 1458 beginExpression(JSPrecedence.LOGICAL_OR_PRECEDENCE);
1459 checkArray(input, '==='); 1459 checkArray(input, '===');
1460 buffer.add(' || '); 1460 buffer.add(' || ');
1461 checkType(input, element); 1461 checkType(input, element);
1462 buffer.add(')'); 1462 buffer.add(')');
1463 endExpression(JSPrecedence.LOGICAL_OR_PRECEDENCE); 1463 endExpression(JSPrecedence.LOGICAL_OR_PRECEDENCE);
1464 endExpression(JSPrecedence.LOGICAL_AND_PRECEDENCE); 1464 endExpression(JSPrecedence.LOGICAL_AND_PRECEDENCE);
1465 } 1465 }
1466 1466
1467 void visitIs(HIs node) { 1467 void visitIs(HIs node) {
1468 Element element = node.typeExpression; 1468 Type type = node.typeName;
1469 Element element = type.element;
1469 if (element.kind === ElementKind.TYPE_VARIABLE) { 1470 if (element.kind === ElementKind.TYPE_VARIABLE) {
1470 compiler.unimplemented("visitIs for type variables"); 1471 compiler.unimplemented("visitIs for type variables");
1472 } else if (element.kind === ElementKind.TYPEDEF) {
1473 compiler.unimplemented("visitIs for typedefs");
1471 } 1474 }
1472 compiler.registerIsCheck(element); 1475 compiler.registerIsCheck(element);
1473 LibraryElement coreLibrary = compiler.coreLibrary; 1476 LibraryElement coreLibrary = compiler.coreLibrary;
1474 ClassElement objectClass = coreLibrary.find(const SourceString('Object')); 1477 ClassElement objectClass = compiler.objectClass;
1475 HInstruction input = node.expression; 1478 HInstruction input = node.expression;
1476 if (node.nullOk) { 1479 if (node.nullOk) {
1477 beginExpression(JSPrecedence.LOGICAL_OR_PRECEDENCE); 1480 beginExpression(JSPrecedence.LOGICAL_OR_PRECEDENCE);
1478 checkNull(input); 1481 checkNull(input);
1479 buffer.add(' || '); 1482 buffer.add(' || ');
1480 } 1483 }
1481 1484
1482 if (element === objectClass || element === compiler.dynamicClass) { 1485 if (element === objectClass || element === compiler.dynamicClass) {
1483 // The constant folder also does this optimization, but we make 1486 // The constant folder also does this optimization, but we make
1484 // it safe by assuming it may have not run. 1487 // it safe by assuming it may have not run.
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
1882 startBailoutSwitch(); 1885 startBailoutSwitch();
1883 } 1886 }
1884 } 1887 }
1885 1888
1886 void endElse(HIf node) { 1889 void endElse(HIf node) {
1887 if (node.elseBlock.hasGuards()) { 1890 if (node.elseBlock.hasGuards()) {
1888 endBailoutSwitch(); 1891 endBailoutSwitch();
1889 } 1892 }
1890 } 1893 }
1891 } 1894 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/builder.dart ('k') | lib/compiler/implementation/ssa/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698