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 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 798 } else if (element == coreLibrary.find(const SourceString('bool'))) { | 798 } else if (element == coreLibrary.find(const SourceString('bool'))) { |
| 799 checkBool(input, '==='); | 799 checkBool(input, '==='); |
| 800 } else if (element == coreLibrary.find(const SourceString('int'))) { | 800 } else if (element == coreLibrary.find(const SourceString('int'))) { |
| 801 checkNum(input, '==='); | 801 checkNum(input, '==='); |
| 802 buffer.add(' && '); | 802 buffer.add(' && '); |
| 803 checkInt(input, '==='); | 803 checkInt(input, '==='); |
| 804 } else { | 804 } else { |
| 805 checkObject(input, '==='); | 805 checkObject(input, '==='); |
| 806 buffer.add(' && ('); | 806 buffer.add(' && ('); |
| 807 if (element == coreLibrary.find(const SourceString('List'))) { | 807 if (element == coreLibrary.find(const SourceString('List'))) { |
| 808 buffer.add('('); | |
| 809 checkObject(input, '==='); | |
|
ngeoffray
2012/02/21 12:23:51
checkObject is already done line 805.
| |
| 810 buffer.add(' && '); | |
| 808 checkArray(input, '==='); | 811 checkArray(input, '==='); |
| 809 buffer.add(' || '); | 812 buffer.add(') || '); |
| 810 } | 813 } |
| 811 buffer.add('!!('); | 814 buffer.add('!!('); |
| 812 use(input); | 815 use(input); |
| 813 buffer.add('.'); | 816 buffer.add('.'); |
| 814 buffer.add(compiler.namer.operatorIs(node.typeExpression)); | 817 buffer.add(compiler.namer.operatorIs(node.typeExpression)); |
| 815 buffer.add('))'); | 818 buffer.add('))'); |
| 816 } | 819 } |
| 817 buffer.add(')'); | 820 buffer.add(')'); |
| 818 } | 821 } |
| 819 } | 822 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 883 checkBool(input, '!=='); | 886 checkBool(input, '!=='); |
| 884 buffer.add(') '); | 887 buffer.add(') '); |
| 885 bailout(node, 'Not a boolean'); | 888 bailout(node, 'Not a boolean'); |
| 886 } else if (node.isString()) { | 889 } else if (node.isString()) { |
| 887 buffer.add('if ('); | 890 buffer.add('if ('); |
| 888 checkString(input, '!=='); | 891 checkString(input, '!=='); |
| 889 buffer.add(') '); | 892 buffer.add(') '); |
| 890 bailout(node, 'Not a string'); | 893 bailout(node, 'Not a string'); |
| 891 } else if (node.isArray()) { | 894 } else if (node.isArray()) { |
| 892 buffer.add('if ('); | 895 buffer.add('if ('); |
| 896 checkObject(input, '!=='); | |
|
ngeoffray
2012/02/21 12:23:51
Please add a comment that this is actually a null
| |
| 897 buffer.add('||'); | |
| 893 checkArray(input, '!=='); | 898 checkArray(input, '!=='); |
| 894 buffer.add(') '); | 899 buffer.add(') '); |
| 895 bailout(node, 'Not an array'); | 900 bailout(node, 'Not an array'); |
| 896 } else if (node.isStringOrArray()) { | 901 } else if (node.isStringOrArray()) { |
| 897 buffer.add('if ('); | 902 buffer.add('if ('); |
| 898 checkString(input, '!=='); | 903 checkString(input, '!=='); |
| 899 buffer.add(' && '); | 904 buffer.add(' && ('); |
| 905 checkObject(input, '!=='); | |
| 906 buffer.add('||'); | |
| 900 checkArray(input, '!=='); | 907 checkArray(input, '!=='); |
| 901 buffer.add(') '); | 908 buffer.add(')) '); |
| 902 bailout(node, 'Not a string or array'); | 909 bailout(node, 'Not a string or array'); |
| 903 } else { | 910 } else { |
| 904 unreachable(); | 911 unreachable(); |
| 905 } | 912 } |
| 906 } | 913 } |
| 907 | 914 |
| 908 void beginLoop(HBasicBlock block) { | 915 void beginLoop(HBasicBlock block) { |
| 909 addIndentation(); | 916 addIndentation(); |
| 910 buffer.add('while (true) {\n'); | 917 buffer.add('while (true) {\n'); |
| 911 indent++; | 918 indent++; |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1156 startBailoutSwitch(); | 1163 startBailoutSwitch(); |
| 1157 } | 1164 } |
| 1158 } | 1165 } |
| 1159 | 1166 |
| 1160 void endElse(HIf node) { | 1167 void endElse(HIf node) { |
| 1161 if (node.elseBlock.hasBailouts()) { | 1168 if (node.elseBlock.hasBailouts()) { |
| 1162 endBailoutSwitch(); | 1169 endBailoutSwitch(); |
| 1163 } | 1170 } |
| 1164 } | 1171 } |
| 1165 } | 1172 } |
| OLD | NEW |