| 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 SsaCodeGeneratorTask(Compiler compiler) : super(compiler); | 6 SsaCodeGeneratorTask(Compiler compiler) : super(compiler); |
| 7 String get name() => 'SSA code generator'; | 7 String get name() => 'SSA code generator'; |
| 8 | 8 |
| 9 | 9 |
| 10 String generateMethod(WorkItem work, HGraph graph) { | 10 String generateMethod(WorkItem work, HGraph graph) { |
| (...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1547 } | 1547 } |
| 1548 | 1548 |
| 1549 void checkImmutableArray(HInstruction input) { | 1549 void checkImmutableArray(HInstruction input) { |
| 1550 beginExpression(JSPrecedence.PREFIX_PRECEDENCE); | 1550 beginExpression(JSPrecedence.PREFIX_PRECEDENCE); |
| 1551 buffer.add('!!'); | 1551 buffer.add('!!'); |
| 1552 use(input, JSPrecedence.MEMBER_PRECEDENCE); | 1552 use(input, JSPrecedence.MEMBER_PRECEDENCE); |
| 1553 buffer.add('.immutable\$list'); | 1553 buffer.add('.immutable\$list'); |
| 1554 endExpression(JSPrecedence.PREFIX_PRECEDENCE); | 1554 endExpression(JSPrecedence.PREFIX_PRECEDENCE); |
| 1555 } | 1555 } |
| 1556 | 1556 |
| 1557 void checkExtendableArray(HInstruction input) { |
| 1558 compiler.unimplemented("check extendable array"); |
| 1559 } |
| 1560 |
| 1557 void checkNull(HInstruction input) { | 1561 void checkNull(HInstruction input) { |
| 1558 beginExpression(JSPrecedence.EQUALITY_PRECEDENCE); | 1562 beginExpression(JSPrecedence.EQUALITY_PRECEDENCE); |
| 1559 use(input, JSPrecedence.EQUALITY_PRECEDENCE); | 1563 use(input, JSPrecedence.EQUALITY_PRECEDENCE); |
| 1560 buffer.add(" === (void 0)"); | 1564 buffer.add(" === (void 0)"); |
| 1561 endExpression(JSPrecedence.EQUALITY_PRECEDENCE); | 1565 endExpression(JSPrecedence.EQUALITY_PRECEDENCE); |
| 1562 } | 1566 } |
| 1563 | 1567 |
| 1564 void checkFunction(HInstruction input, Element element) { | 1568 void checkFunction(HInstruction input, Element element) { |
| 1565 beginExpression(JSPrecedence.LOGICAL_OR_PRECEDENCE); | 1569 beginExpression(JSPrecedence.LOGICAL_OR_PRECEDENCE); |
| 1566 beginExpression(JSPrecedence.EQUALITY_PRECEDENCE); | 1570 beginExpression(JSPrecedence.EQUALITY_PRECEDENCE); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1735 } else if (node.isBoolean()) { | 1739 } else if (node.isBoolean()) { |
| 1736 buffer.add('if ('); | 1740 buffer.add('if ('); |
| 1737 checkBool(input, '!=='); | 1741 checkBool(input, '!=='); |
| 1738 buffer.add(') '); | 1742 buffer.add(') '); |
| 1739 bailout(node, 'Not a boolean'); | 1743 bailout(node, 'Not a boolean'); |
| 1740 } else if (node.isString()) { | 1744 } else if (node.isString()) { |
| 1741 buffer.add('if ('); | 1745 buffer.add('if ('); |
| 1742 checkString(input, '!=='); | 1746 checkString(input, '!=='); |
| 1743 buffer.add(') '); | 1747 buffer.add(') '); |
| 1744 bailout(node, 'Not a string'); | 1748 bailout(node, 'Not a string'); |
| 1749 } else if (node.isExtendableArray()) { |
| 1750 buffer.add('if ('); |
| 1751 checkObject(input, '!=='); |
| 1752 buffer.add('||'); |
| 1753 checkArray(input, '!=='); |
| 1754 buffer.add('||'); |
| 1755 checkExtendableArray(input); |
| 1756 buffer.add(') '); |
| 1757 bailout(node, 'Not an extendable array'); |
| 1745 } else if (node.isMutableArray()) { | 1758 } else if (node.isMutableArray()) { |
| 1746 buffer.add('if ('); | 1759 buffer.add('if ('); |
| 1747 checkObject(input, '!=='); | 1760 checkObject(input, '!=='); |
| 1748 buffer.add('||'); | 1761 buffer.add('||'); |
| 1749 checkArray(input, '!=='); | 1762 checkArray(input, '!=='); |
| 1750 buffer.add('||'); | 1763 buffer.add('||'); |
| 1751 checkImmutableArray(input); | 1764 checkImmutableArray(input); |
| 1752 buffer.add(') '); | 1765 buffer.add(') '); |
| 1753 bailout(node, 'Not a mutable array'); | 1766 bailout(node, 'Not a mutable array'); |
| 1754 } else if (node.isArray()) { | 1767 } else if (node.isReadableArray()) { |
| 1755 buffer.add('if ('); | 1768 buffer.add('if ('); |
| 1756 checkObject(input, '!=='); | 1769 checkObject(input, '!=='); |
| 1757 buffer.add('||'); | 1770 buffer.add('||'); |
| 1758 checkArray(input, '!=='); | 1771 checkArray(input, '!=='); |
| 1759 buffer.add(') '); | 1772 buffer.add(') '); |
| 1760 bailout(node, 'Not an array'); | 1773 bailout(node, 'Not an array'); |
| 1761 } else if (node.isStringOrArray()) { | 1774 } else if (node.isIndexablePrimitive()) { |
| 1762 buffer.add('if ('); | 1775 buffer.add('if ('); |
| 1763 checkString(input, '!=='); | 1776 checkString(input, '!=='); |
| 1764 buffer.add(' && ('); | 1777 buffer.add(' && ('); |
| 1765 checkObject(input, '!=='); | 1778 checkObject(input, '!=='); |
| 1766 buffer.add('||'); | 1779 buffer.add('||'); |
| 1767 checkArray(input, '!=='); | 1780 checkArray(input, '!=='); |
| 1768 buffer.add(')) '); | 1781 buffer.add(')) '); |
| 1769 bailout(node, 'Not a string or array'); | 1782 bailout(node, 'Not a string or array'); |
| 1770 } else { | 1783 } else { |
| 1771 unreachable(); | 1784 unreachable(); |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2079 startBailoutSwitch(); | 2092 startBailoutSwitch(); |
| 2080 } | 2093 } |
| 2081 } | 2094 } |
| 2082 | 2095 |
| 2083 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) { | 2096 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) { |
| 2084 if (labeledBlockInfo.body.start.hasGuards()) { | 2097 if (labeledBlockInfo.body.start.hasGuards()) { |
| 2085 endBailoutSwitch(); | 2098 endBailoutSwitch(); |
| 2086 } | 2099 } |
| 2087 } | 2100 } |
| 2088 } | 2101 } |
| OLD | NEW |