Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 String generate(WorkItem work, HGraph graph) { | 9 String generate(WorkItem work, HGraph graph) { |
| 10 return measure(() { | 10 return measure(() { |
| (...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 963 } | 963 } |
| 964 | 964 |
| 965 void checkType(HInstruction input, Element element) { | 965 void checkType(HInstruction input, Element element) { |
| 966 buffer.add('!!'); | 966 buffer.add('!!'); |
| 967 use(input, JSPrecedence.MEMBER_PRECEDENCE); | 967 use(input, JSPrecedence.MEMBER_PRECEDENCE); |
| 968 buffer.add('.'); | 968 buffer.add('.'); |
| 969 buffer.add(compiler.namer.operatorIs(element)); | 969 buffer.add(compiler.namer.operatorIs(element)); |
| 970 } | 970 } |
| 971 | 971 |
| 972 void visitIs(HIs node) { | 972 void visitIs(HIs node) { |
| 973 Element element = node.typeExpression; | 973 ClassElement element = node.typeExpression; |
|
ngeoffray
2012/03/15 11:47:40
This is not right, because it could be a typedef.
karlklose
2012/03/16 14:58:47
Done.
| |
| 974 if (node.typeExpression.kind === ElementKind.TYPE_VARIABLE) { | |
| 975 compiler.unimplemented("visitIs for type variables"); | |
| 976 } | |
| 974 compiler.registerIsCheck(element); | 977 compiler.registerIsCheck(element); |
| 975 LibraryElement coreLibrary = compiler.coreLibrary; | 978 LibraryElement coreLibrary = compiler.coreLibrary; |
| 976 ClassElement objectClass = coreLibrary.find(const SourceString('Object')); | 979 ClassElement objectClass = coreLibrary.find(const SourceString('Object')); |
| 977 HInstruction input = node.expression; | 980 HInstruction input = node.expression; |
| 978 if (node.nullOk) { | 981 if (node.nullOk) { |
| 979 beginExpression(JSPrecedence.LOGICAL_OR_PRECEDENCE); | 982 beginExpression(JSPrecedence.LOGICAL_OR_PRECEDENCE); |
| 980 checkNull(input); | 983 checkNull(input); |
| 981 buffer.add(' || '); | 984 buffer.add(' || '); |
| 982 } | 985 } |
| 983 if (element == objectClass) { | 986 if (element == objectClass) { |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1431 startBailoutSwitch(); | 1434 startBailoutSwitch(); |
| 1432 } | 1435 } |
| 1433 } | 1436 } |
| 1434 | 1437 |
| 1435 void endElse(HIf node) { | 1438 void endElse(HIf node) { |
| 1436 if (node.elseBlock.hasBailouts()) { | 1439 if (node.elseBlock.hasBailouts()) { |
| 1437 endBailoutSwitch(); | 1440 endBailoutSwitch(); |
| 1438 } | 1441 } |
| 1439 } | 1442 } |
| 1440 } | 1443 } |
| OLD | NEW |