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

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

Issue 9431029: Implement interface types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add test. 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 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 beginExpression(JSPrecedence.LOGICAL_OR_PRECEDENCE); 1439 beginExpression(JSPrecedence.LOGICAL_OR_PRECEDENCE);
1440 checkArray(input, '==='); 1440 checkArray(input, '===');
1441 buffer.add(' || '); 1441 buffer.add(' || ');
1442 checkType(input, element); 1442 checkType(input, element);
1443 buffer.add(')'); 1443 buffer.add(')');
1444 endExpression(JSPrecedence.LOGICAL_OR_PRECEDENCE); 1444 endExpression(JSPrecedence.LOGICAL_OR_PRECEDENCE);
1445 endExpression(JSPrecedence.LOGICAL_AND_PRECEDENCE); 1445 endExpression(JSPrecedence.LOGICAL_AND_PRECEDENCE);
1446 } 1446 }
1447 1447
1448 void visitIs(HIs node) { 1448 void visitIs(HIs node) {
1449 Element element = node.typeExpression; 1449 Type type = node.typeName;
ahe 2012/04/12 15:05:23 I don't see how typeName is an improvement over ty
1450 Element element = type.element;
1450 if (element.kind === ElementKind.TYPE_VARIABLE) { 1451 if (element.kind === ElementKind.TYPE_VARIABLE) {
1451 compiler.unimplemented("visitIs for type variables"); 1452 compiler.unimplemented("visitIs for type variables");
ahe 2012/04/12 15:05:23 Please add this argument: "instruction: node"
1453 } else if (element.kind === ElementKind.TYPEDEF) {
1454 compiler.unimplemented("visitIs for typedefs");
ahe 2012/04/12 15:05:23 Ditto.
1452 } 1455 }
1453 compiler.registerIsCheck(element); 1456 compiler.registerIsCheck(element);
1454 LibraryElement coreLibrary = compiler.coreLibrary; 1457 LibraryElement coreLibrary = compiler.coreLibrary;
1455 ClassElement objectClass = coreLibrary.find(const SourceString('Object')); 1458 ClassElement objectClass = compiler.objectClass;
1456 HInstruction input = node.expression; 1459 HInstruction input = node.expression;
1457 if (node.nullOk) { 1460 if (node.nullOk) {
1458 beginExpression(JSPrecedence.LOGICAL_OR_PRECEDENCE); 1461 beginExpression(JSPrecedence.LOGICAL_OR_PRECEDENCE);
1459 checkNull(input); 1462 checkNull(input);
1460 buffer.add(' || '); 1463 buffer.add(' || ');
1461 } 1464 }
1462 1465
1463 if (element === objectClass || element === compiler.dynamicClass) { 1466 if (element === objectClass || element === compiler.dynamicClass) {
1464 // The constant folder also does this optimization, but we make 1467 // The constant folder also does this optimization, but we make
1465 // it safe by assuming it may have not run. 1468 // it safe by assuming it may have not run.
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1854 startBailoutSwitch(); 1857 startBailoutSwitch();
1855 } 1858 }
1856 } 1859 }
1857 1860
1858 void endElse(HIf node) { 1861 void endElse(HIf node) {
1859 if (node.elseBlock.hasGuards()) { 1862 if (node.elseBlock.hasGuards()) {
1860 endBailoutSwitch(); 1863 endBailoutSwitch();
1861 } 1864 }
1862 } 1865 }
1863 } 1866 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698