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 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 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1657 } | 1657 } |
| 1658 } | 1658 } |
| 1659 | 1659 |
| 1660 visitFieldGet(HFieldGet node) { | 1660 visitFieldGet(HFieldGet node) { |
| 1661 use(node.receiver); | 1661 use(node.receiver); |
| 1662 Element element = node.element; | 1662 Element element = node.element; |
| 1663 if (element == backend.jsIndexableLength) { | 1663 if (element == backend.jsIndexableLength) { |
| 1664 // We're accessing a native JavaScript property called 'length' | 1664 // We're accessing a native JavaScript property called 'length' |
| 1665 // on a JS String or a JS array. Therefore, the name of that | 1665 // on a JS String or a JS array. Therefore, the name of that |
| 1666 // property should not be mangled. | 1666 // property should not be mangled. |
| 1667 push(new js.PropertyAccess.field(pop(), 'length'), node); | 1667 if (backend.isTypedArray( |
| 1668 node.receiver.instructionType.computeMask(compiler))) { | |
| 1669 // TODO(...): Remove this custom code for typed arrays once V8 | |
|
bakster
2013/08/30 07:56:27
Please replace ... with your name.
ngeoffray
2013/08/30 08:51:34
Done.
| |
| 1670 // optimizes their length access. | |
| 1671 Element element = compiler.findRequiredElement( | |
| 1672 compiler.typedDataLibrary, const SourceString('fetchLength')); | |
| 1673 Constant constant = compiler.constantHandler.compileConstant(element); | |
| 1674 var jsConstant = backend.emitter.constantReference(constant); | |
| 1675 push(new js.Call(jsConstant, [pop()]), node); | |
| 1676 } else { | |
| 1677 push(new js.PropertyAccess.field(pop(), 'length'), node); | |
| 1678 } | |
| 1668 } else { | 1679 } else { |
| 1669 String name = _fieldPropertyName(element); | 1680 String name = _fieldPropertyName(element); |
| 1670 push(new js.PropertyAccess.field(pop(), name), node); | 1681 push(new js.PropertyAccess.field(pop(), name), node); |
| 1671 world.registerFieldGetter(element); | 1682 world.registerFieldGetter(element); |
| 1672 } | 1683 } |
| 1673 } | 1684 } |
| 1674 | 1685 |
| 1675 visitFieldSet(HFieldSet node) { | 1686 visitFieldSet(HFieldSet node) { |
| 1676 Element element = node.element; | 1687 Element element = node.element; |
| 1677 world.registerFieldSetter(element); | 1688 world.registerFieldSetter(element); |
| (...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2973 if (leftType.canBeNull() && rightType.canBeNull()) { | 2984 if (leftType.canBeNull() && rightType.canBeNull()) { |
| 2974 if (left.isConstantNull() || right.isConstantNull() || | 2985 if (left.isConstantNull() || right.isConstantNull() || |
| 2975 (leftType.isPrimitive(compiler) && leftType == rightType)) { | 2986 (leftType.isPrimitive(compiler) && leftType == rightType)) { |
| 2976 return '=='; | 2987 return '=='; |
| 2977 } | 2988 } |
| 2978 return null; | 2989 return null; |
| 2979 } else { | 2990 } else { |
| 2980 return '==='; | 2991 return '==='; |
| 2981 } | 2992 } |
| 2982 } | 2993 } |
| OLD | NEW |