| 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 1599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1610 | 1610 |
| 1611 push(new js.VariableUse(backend.namer.isolateAccess(node.element))); | 1611 push(new js.VariableUse(backend.namer.isolateAccess(node.element))); |
| 1612 push(new js.Call(pop(), visitArguments(node.inputs, start: 0)), node); | 1612 push(new js.Call(pop(), visitArguments(node.inputs, start: 0)), node); |
| 1613 } | 1613 } |
| 1614 | 1614 |
| 1615 visitInvokeSuper(HInvokeSuper node) { | 1615 visitInvokeSuper(HInvokeSuper node) { |
| 1616 Element superMethod = node.element; | 1616 Element superMethod = node.element; |
| 1617 world.registerStaticUse(superMethod); | 1617 world.registerStaticUse(superMethod); |
| 1618 ClassElement superClass = superMethod.getEnclosingClass(); | 1618 ClassElement superClass = superMethod.getEnclosingClass(); |
| 1619 if (superMethod.kind == ElementKind.FIELD) { | 1619 if (superMethod.kind == ElementKind.FIELD) { |
| 1620 String fieldName = superMethod.hasFixedBackendName() | 1620 String fieldName = backend.namer.instanceFieldPropertyName(superMethod); |
| 1621 ? superMethod.fixedBackendName() | |
| 1622 : node.caller.isShadowedByField(superMethod) | |
| 1623 ? backend.namer.shadowedFieldName(superMethod) | |
| 1624 : backend.namer.instanceFieldName(superMethod); | |
| 1625 use(node.inputs[0]); | 1621 use(node.inputs[0]); |
| 1626 js.PropertyAccess access = | 1622 js.PropertyAccess access = |
| 1627 new js.PropertyAccess.field(pop(), fieldName); | 1623 new js.PropertyAccess.field(pop(), fieldName); |
| 1628 if (node.isSetter) { | 1624 if (node.isSetter) { |
| 1629 use(node.value); | 1625 use(node.value); |
| 1630 push(new js.Assignment(access, pop()), node); | 1626 push(new js.Assignment(access, pop()), node); |
| 1631 } else { | 1627 } else { |
| 1632 push(access, node); | 1628 push(access, node); |
| 1633 } | 1629 } |
| 1634 } else { | 1630 } else { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1682 compiler.constantHandler.getConstantForVariable(element); | 1678 compiler.constantHandler.getConstantForVariable(element); |
| 1683 assert(invariant(element, constant != null, | 1679 assert(invariant(element, constant != null, |
| 1684 message: 'No constant computed for $element')); | 1680 message: 'No constant computed for $element')); |
| 1685 var jsConstant = backend.emitter.constantReference(constant); | 1681 var jsConstant = backend.emitter.constantReference(constant); |
| 1686 push(new js.Call(jsConstant, [pop()]), node); | 1682 push(new js.Call(jsConstant, [pop()]), node); |
| 1687 } | 1683 } |
| 1688 } else { | 1684 } else { |
| 1689 push(new js.PropertyAccess.field(pop(), 'length'), node); | 1685 push(new js.PropertyAccess.field(pop(), 'length'), node); |
| 1690 } | 1686 } |
| 1691 } else { | 1687 } else { |
| 1692 String name = _fieldPropertyName(element); | 1688 String name = backend.namer.instanceFieldPropertyName(element); |
| 1693 push(new js.PropertyAccess.field(pop(), name), node); | 1689 push(new js.PropertyAccess.field(pop(), name), node); |
| 1694 world.registerFieldGetter(element); | 1690 world.registerFieldGetter(element); |
| 1695 } | 1691 } |
| 1696 } | 1692 } |
| 1697 | 1693 |
| 1698 visitFieldSet(HFieldSet node) { | 1694 visitFieldSet(HFieldSet node) { |
| 1699 Element element = node.element; | 1695 Element element = node.element; |
| 1700 world.registerFieldSetter(element); | 1696 world.registerFieldSetter(element); |
| 1701 String name = _fieldPropertyName(element); | 1697 String name = backend.namer.instanceFieldPropertyName(element); |
| 1702 use(node.receiver); | 1698 use(node.receiver); |
| 1703 js.Expression receiver = pop(); | 1699 js.Expression receiver = pop(); |
| 1704 use(node.value); | 1700 use(node.value); |
| 1705 push(new js.Assignment(new js.PropertyAccess.field(receiver, name), pop()), | 1701 push(new js.Assignment(new js.PropertyAccess.field(receiver, name), pop()), |
| 1706 node); | 1702 node); |
| 1707 } | 1703 } |
| 1708 | 1704 |
| 1709 String _fieldPropertyName(Element element) => element.hasFixedBackendName() | |
| 1710 ? element.fixedBackendName() | |
| 1711 : backend.namer.getNameOfInstanceMember(element); | |
| 1712 | |
| 1713 visitLocalGet(HLocalGet node) { | 1705 visitLocalGet(HLocalGet node) { |
| 1714 use(node.receiver); | 1706 use(node.receiver); |
| 1715 } | 1707 } |
| 1716 | 1708 |
| 1717 visitLocalSet(HLocalSet node) { | 1709 visitLocalSet(HLocalSet node) { |
| 1718 use(node.value); | 1710 use(node.value); |
| 1719 assignVariable(variableNames.getName(node.receiver), pop()); | 1711 assignVariable(variableNames.getName(node.receiver), pop()); |
| 1720 } | 1712 } |
| 1721 | 1713 |
| 1722 void registerForeignTypes(HForeign node) { | 1714 void registerForeignTypes(HForeign node) { |
| (...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2589 if (left.isConstantNull() || right.isConstantNull() || | 2581 if (left.isConstantNull() || right.isConstantNull() || |
| 2590 (left.isPrimitive(compiler) && | 2582 (left.isPrimitive(compiler) && |
| 2591 left.instructionType == right.instructionType)) { | 2583 left.instructionType == right.instructionType)) { |
| 2592 return '=='; | 2584 return '=='; |
| 2593 } | 2585 } |
| 2594 return null; | 2586 return null; |
| 2595 } else { | 2587 } else { |
| 2596 return '==='; | 2588 return '==='; |
| 2597 } | 2589 } |
| 2598 } | 2590 } |
| OLD | NEW |