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 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2895 if (leftType.canBeNull() && rightType.canBeNull()) { | 2900 if (leftType.canBeNull() && rightType.canBeNull()) { |
2896 if (left.isConstantNull() || right.isConstantNull() || | 2901 if (left.isConstantNull() || right.isConstantNull() || |
2897 (leftType.isPrimitive() && leftType == rightType)) { | 2902 (leftType.isPrimitive() && leftType == rightType)) { |
2898 return '=='; | 2903 return '=='; |
2899 } | 2904 } |
2900 return null; | 2905 return null; |
2901 } else { | 2906 } else { |
2902 return '==='; | 2907 return '==='; |
2903 } | 2908 } |
2904 } | 2909 } |
OLD | NEW |