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 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 922 use(input, JSPrecedence.MEMBER_PRECEDENCE); | 922 use(input, JSPrecedence.MEMBER_PRECEDENCE); |
| 923 buffer.add('.constructor $cmp Array'); | 923 buffer.add('.constructor $cmp Array'); |
| 924 endExpression(JSPrecedence.EQUALITY_PRECEDENCE); | 924 endExpression(JSPrecedence.EQUALITY_PRECEDENCE); |
| 925 } | 925 } |
| 926 | 926 |
| 927 void visitIs(HIs node) { | 927 void visitIs(HIs node) { |
| 928 ClassElement element = node.typeExpression; | 928 ClassElement element = node.typeExpression; |
| 929 LibraryElement coreLibrary = compiler.coreLibrary; | 929 LibraryElement coreLibrary = compiler.coreLibrary; |
| 930 ClassElement objectClass = coreLibrary.find(const SourceString('Object')); | 930 ClassElement objectClass = coreLibrary.find(const SourceString('Object')); |
| 931 HInstruction input = node.expression; | 931 HInstruction input = node.expression; |
| 932 if (node.nullOk) { | |
| 933 use(input, JSPrecedence.LOGICAL_OR_PRECEDENCE); | |
|
Lasse Reichstein Nielsen
2012/03/01 08:38:17
That should be EQUALITY_PRECEDENCE. It's the left
ahe
2012/03/06 10:16:01
Done.
| |
| 934 buffer.add(' === (void 0) ||'); | |
|
ahe
2012/02/29 20:44:20
I think this will work well for checked mode as we
| |
| 935 } | |
|
Lasse Reichstein Nielsen
2012/03/02 09:44:09
This also changes the expected precedence for the
ahe
2012/03/06 10:16:01
Done.
| |
| 932 if (element == objectClass) { | 936 if (element == objectClass) { |
| 933 // TODO(ahe): This probably belongs in the constant folder. | 937 // TODO(ahe): This probably belongs in the constant folder. |
| 934 buffer.add('true'); | 938 buffer.add('true'); |
| 935 } else if (element == coreLibrary.find(const SourceString('String'))) { | 939 } else if (element == coreLibrary.find(const SourceString('String'))) { |
| 936 checkString(input, '==='); | 940 checkString(input, '==='); |
| 937 } else if (element == coreLibrary.find(const SourceString('double'))) { | 941 } else if (element == coreLibrary.find(const SourceString('double'))) { |
| 938 checkDouble(input, '==='); | 942 checkDouble(input, '==='); |
| 939 } else if (element == coreLibrary.find(const SourceString('num'))) { | 943 } else if (element == coreLibrary.find(const SourceString('num'))) { |
| 940 checkNum(input, '==='); | 944 checkNum(input, '==='); |
| 941 } else if (element == coreLibrary.find(const SourceString('bool'))) { | 945 } else if (element == coreLibrary.find(const SourceString('bool'))) { |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1375 startBailoutSwitch(); | 1379 startBailoutSwitch(); |
| 1376 } | 1380 } |
| 1377 } | 1381 } |
| 1378 | 1382 |
| 1379 void endElse(HIf node) { | 1383 void endElse(HIf node) { |
| 1380 if (node.elseBlock.hasBailouts()) { | 1384 if (node.elseBlock.hasBailouts()) { |
| 1381 endBailoutSwitch(); | 1385 endBailoutSwitch(); |
| 1382 } | 1386 } |
| 1383 } | 1387 } |
| 1384 } | 1388 } |
| OLD | NEW |