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 | 6 |
7 final JavaScriptBackend backend; | 7 final JavaScriptBackend backend; |
8 | 8 |
9 SsaCodeGeneratorTask(JavaScriptBackend backend) | 9 SsaCodeGeneratorTask(JavaScriptBackend backend) |
10 : this.backend = backend, | 10 : this.backend = backend, |
(...skipping 1697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1708 } else if (constant.isString()) { | 1708 } else if (constant.isString()) { |
1709 // TODO(floitsch): get rid of the code buffer. | 1709 // TODO(floitsch): get rid of the code buffer. |
1710 CodeBuffer buffer = new CodeBuffer(); | 1710 CodeBuffer buffer = new CodeBuffer(); |
1711 handler.writeConstant(buffer, constant); | 1711 handler.writeConstant(buffer, constant); |
1712 push(new js.LiteralString(buffer.toString())); | 1712 push(new js.LiteralString(buffer.toString())); |
1713 } else if (constant.isFunction()) { | 1713 } else if (constant.isFunction()) { |
1714 FunctionConstant function = constant; | 1714 FunctionConstant function = constant; |
1715 world.registerStaticUse(function.element); | 1715 world.registerStaticUse(function.element); |
1716 push(new js.VariableUse( | 1716 push(new js.VariableUse( |
1717 compiler.namer.isolateAccess(function.element))); | 1717 compiler.namer.isolateAccess(function.element))); |
| 1718 } else if (constant.isSentinel()) { |
| 1719 // TODO(floitsch): get rid of the code buffer. |
| 1720 CodeBuffer buffer = new CodeBuffer(); |
| 1721 handler.writeConstant(buffer, constant); |
| 1722 push(new js.VariableUse(buffer.toString())); |
1718 } else { | 1723 } else { |
1719 compiler.internalError( | 1724 compiler.internalError( |
1720 "The compiler does not know how generate code for " | 1725 "The compiler does not know how generate code for " |
1721 "constant $constant"); | 1726 "constant $constant"); |
1722 } | 1727 } |
1723 } else { | 1728 } else { |
1724 js.VariableUse currentIsolateUse = | 1729 js.VariableUse currentIsolateUse = |
1725 new js.VariableUse(compiler.namer.CURRENT_ISOLATE); | 1730 new js.VariableUse(compiler.namer.CURRENT_ISOLATE); |
1726 push(new js.PropertyAccess.field(currentIsolateUse, name)); | 1731 push(new js.PropertyAccess.field(currentIsolateUse, name)); |
1727 } | 1732 } |
(...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2892 if (leftType.canBeNull() && rightType.canBeNull()) { | 2897 if (leftType.canBeNull() && rightType.canBeNull()) { |
2893 if (left.isConstantNull() || right.isConstantNull() || | 2898 if (left.isConstantNull() || right.isConstantNull() || |
2894 (leftType.isPrimitive() && leftType == rightType)) { | 2899 (leftType.isPrimitive() && leftType == rightType)) { |
2895 return '=='; | 2900 return '=='; |
2896 } | 2901 } |
2897 return null; | 2902 return null; |
2898 } else { | 2903 } else { |
2899 return '==='; | 2904 return '==='; |
2900 } | 2905 } |
2901 } | 2906 } |
OLD | NEW |