| 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 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 } | 986 } |
| 987 compiler.registerIsCheck(element); | 987 compiler.registerIsCheck(element); |
| 988 LibraryElement coreLibrary = compiler.coreLibrary; | 988 LibraryElement coreLibrary = compiler.coreLibrary; |
| 989 ClassElement objectClass = coreLibrary.find(const SourceString('Object')); | 989 ClassElement objectClass = coreLibrary.find(const SourceString('Object')); |
| 990 HInstruction input = node.expression; | 990 HInstruction input = node.expression; |
| 991 if (node.nullOk) { | 991 if (node.nullOk) { |
| 992 beginExpression(JSPrecedence.LOGICAL_OR_PRECEDENCE); | 992 beginExpression(JSPrecedence.LOGICAL_OR_PRECEDENCE); |
| 993 checkNull(input); | 993 checkNull(input); |
| 994 buffer.add(' || '); | 994 buffer.add(' || '); |
| 995 } | 995 } |
| 996 if (element == objectClass) { | 996 if (element === objectClass || element === compiler.dynamicClass) { |
| 997 // TODO(ahe): This probably belongs in the constant folder. | 997 // TODO(ahe): This probably belongs in the constant folder. |
| 998 buffer.add('true'); | 998 buffer.add('true'); |
| 999 } else if (element == coreLibrary.find(const SourceString('String'))) { | 999 } else if (element == compiler.stringClass) { |
| 1000 checkString(input, '==='); | 1000 checkString(input, '==='); |
| 1001 } else if (element == coreLibrary.find(const SourceString('double'))) { | 1001 } else if (element == compiler.doubleClass) { |
| 1002 checkDouble(input, '==='); | 1002 checkDouble(input, '==='); |
| 1003 } else if (element == coreLibrary.find(const SourceString('num'))) { | 1003 } else if (element == compiler.numClass) { |
| 1004 checkNum(input, '==='); | 1004 checkNum(input, '==='); |
| 1005 } else if (element == coreLibrary.find(const SourceString('bool'))) { | 1005 } else if (element == compiler.boolClass) { |
| 1006 checkBool(input, '==='); | 1006 checkBool(input, '==='); |
| 1007 } else if (element == coreLibrary.find(const SourceString('Function'))) { | 1007 } else if (element == compiler.functionClass) { |
| 1008 checkFunction(input, element); | 1008 checkFunction(input, element); |
| 1009 } else if (element == coreLibrary.find(const SourceString('int'))) { | 1009 } else if (element == compiler.intClass) { |
| 1010 beginExpression(JSPrecedence.LOGICAL_AND_PRECEDENCE); | 1010 beginExpression(JSPrecedence.LOGICAL_AND_PRECEDENCE); |
| 1011 checkNum(input, '==='); | 1011 checkNum(input, '==='); |
| 1012 buffer.add(' && '); | 1012 buffer.add(' && '); |
| 1013 checkInt(input, '==='); | 1013 checkInt(input, '==='); |
| 1014 endExpression(JSPrecedence.LOGICAL_AND_PRECEDENCE); | 1014 endExpression(JSPrecedence.LOGICAL_AND_PRECEDENCE); |
| 1015 } else { | 1015 } else { |
| 1016 beginExpression(JSPrecedence.LOGICAL_AND_PRECEDENCE); | 1016 beginExpression(JSPrecedence.LOGICAL_AND_PRECEDENCE); |
| 1017 if (isStringSupertype(element)) { | 1017 if (isStringSupertype(element)) { |
| 1018 checkString(input, '==='); | 1018 checkString(input, '==='); |
| 1019 buffer.add(' || '); | 1019 buffer.add(' || '); |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1444 startBailoutSwitch(); | 1444 startBailoutSwitch(); |
| 1445 } | 1445 } |
| 1446 } | 1446 } |
| 1447 | 1447 |
| 1448 void endElse(HIf node) { | 1448 void endElse(HIf node) { |
| 1449 if (node.elseBlock.hasBailouts()) { | 1449 if (node.elseBlock.hasBailouts()) { |
| 1450 endBailoutSwitch(); | 1450 endBailoutSwitch(); |
| 1451 } | 1451 } |
| 1452 } | 1452 } |
| 1453 } | 1453 } |
| OLD | NEW |