| 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 part of ssa; | 5 part of ssa; |
| 6 | 6 |
| 7 class SsaCodeGeneratorTask extends CompilerTask { | 7 class SsaCodeGeneratorTask extends CompilerTask { |
| 8 | 8 |
| 9 final JavaScriptBackend backend; | 9 final JavaScriptBackend backend; |
| 10 | 10 |
| (...skipping 1643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1654 if (type != null) { | 1654 if (type != null) { |
| 1655 world.registerFieldGetter( | 1655 world.registerFieldGetter( |
| 1656 node.element.name, node.element.getLibrary(), type); | 1656 node.element.name, node.element.getLibrary(), type); |
| 1657 } | 1657 } |
| 1658 } | 1658 } |
| 1659 | 1659 |
| 1660 // Determine if an instruction is a simple number computation | 1660 // Determine if an instruction is a simple number computation |
| 1661 // involving only things with guaranteed number types and a given | 1661 // involving only things with guaranteed number types and a given |
| 1662 // field. | 1662 // field. |
| 1663 bool isSimpleFieldNumberComputation(HInstruction value, HFieldSet node) { | 1663 bool isSimpleFieldNumberComputation(HInstruction value, HFieldSet node) { |
| 1664 if (value.guaranteedType.union(HType.NUMBER) == HType.NUMBER) return true; | 1664 if (value.guaranteedType.union(HType.NUMBER, compiler) == HType.NUMBER) { |
| 1665 return true; |
| 1666 } |
| 1665 if (value is HBinaryArithmetic) { | 1667 if (value is HBinaryArithmetic) { |
| 1666 return (isSimpleFieldNumberComputation(value.left, node) && | 1668 return (isSimpleFieldNumberComputation(value.left, node) && |
| 1667 isSimpleFieldNumberComputation(value.right, node)); | 1669 isSimpleFieldNumberComputation(value.right, node)); |
| 1668 } | 1670 } |
| 1669 if (value is HFieldGet) return value.element == node.element; | 1671 if (value is HFieldGet) return value.element == node.element; |
| 1670 return false; | 1672 return false; |
| 1671 } | 1673 } |
| 1672 | 1674 |
| 1673 visitFieldSet(HFieldSet node) { | 1675 visitFieldSet(HFieldSet node) { |
| 1674 String name = backend.namer.getName(node.element); | 1676 String name = backend.namer.getName(node.element); |
| (...skipping 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3020 if (leftType.canBeNull() && rightType.canBeNull()) { | 3022 if (leftType.canBeNull() && rightType.canBeNull()) { |
| 3021 if (left.isConstantNull() || right.isConstantNull() || | 3023 if (left.isConstantNull() || right.isConstantNull() || |
| 3022 (leftType.isPrimitive() && leftType == rightType)) { | 3024 (leftType.isPrimitive() && leftType == rightType)) { |
| 3023 return '=='; | 3025 return '=='; |
| 3024 } | 3026 } |
| 3025 return null; | 3027 return null; |
| 3026 } else { | 3028 } else { |
| 3027 return '==='; | 3029 return '==='; |
| 3028 } | 3030 } |
| 3029 } | 3031 } |
| OLD | NEW |