| 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 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1481 } | 1481 } |
| 1482 | 1482 |
| 1483 void checkImmutableArray(HInstruction input) { | 1483 void checkImmutableArray(HInstruction input) { |
| 1484 beginExpression(JSPrecedence.PREFIX_PRECEDENCE); | 1484 beginExpression(JSPrecedence.PREFIX_PRECEDENCE); |
| 1485 buffer.add('!!'); | 1485 buffer.add('!!'); |
| 1486 use(input, JSPrecedence.MEMBER_PRECEDENCE); | 1486 use(input, JSPrecedence.MEMBER_PRECEDENCE); |
| 1487 buffer.add('.immutable\$list'); | 1487 buffer.add('.immutable\$list'); |
| 1488 endExpression(JSPrecedence.PREFIX_PRECEDENCE); | 1488 endExpression(JSPrecedence.PREFIX_PRECEDENCE); |
| 1489 } | 1489 } |
| 1490 | 1490 |
| 1491 void checkExtendableArray(HInstruction input) { |
| 1492 compiler.unimplemented("check extendable array"); |
| 1493 } |
| 1494 |
| 1491 void checkNull(HInstruction input) { | 1495 void checkNull(HInstruction input) { |
| 1492 beginExpression(JSPrecedence.EQUALITY_PRECEDENCE); | 1496 beginExpression(JSPrecedence.EQUALITY_PRECEDENCE); |
| 1493 use(input, JSPrecedence.EQUALITY_PRECEDENCE); | 1497 use(input, JSPrecedence.EQUALITY_PRECEDENCE); |
| 1494 buffer.add(" === (void 0)"); | 1498 buffer.add(" === (void 0)"); |
| 1495 endExpression(JSPrecedence.EQUALITY_PRECEDENCE); | 1499 endExpression(JSPrecedence.EQUALITY_PRECEDENCE); |
| 1496 } | 1500 } |
| 1497 | 1501 |
| 1498 void checkFunction(HInstruction input, Element element) { | 1502 void checkFunction(HInstruction input, Element element) { |
| 1499 beginExpression(JSPrecedence.LOGICAL_OR_PRECEDENCE); | 1503 beginExpression(JSPrecedence.LOGICAL_OR_PRECEDENCE); |
| 1500 beginExpression(JSPrecedence.EQUALITY_PRECEDENCE); | 1504 beginExpression(JSPrecedence.EQUALITY_PRECEDENCE); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1669 } else if (node.isBoolean()) { | 1673 } else if (node.isBoolean()) { |
| 1670 buffer.add('if ('); | 1674 buffer.add('if ('); |
| 1671 checkBool(input, '!=='); | 1675 checkBool(input, '!=='); |
| 1672 buffer.add(') '); | 1676 buffer.add(') '); |
| 1673 bailout(node, 'Not a boolean'); | 1677 bailout(node, 'Not a boolean'); |
| 1674 } else if (node.isString()) { | 1678 } else if (node.isString()) { |
| 1675 buffer.add('if ('); | 1679 buffer.add('if ('); |
| 1676 checkString(input, '!=='); | 1680 checkString(input, '!=='); |
| 1677 buffer.add(') '); | 1681 buffer.add(') '); |
| 1678 bailout(node, 'Not a string'); | 1682 bailout(node, 'Not a string'); |
| 1683 } else if (node.isExtendableArray()) { |
| 1684 buffer.add('if ('); |
| 1685 checkObject(input, '!=='); |
| 1686 buffer.add('||'); |
| 1687 checkArray(input, '!=='); |
| 1688 buffer.add('||'); |
| 1689 checkExtendableArray(input); |
| 1690 buffer.add(') '); |
| 1691 bailout(node, 'Not an extendable array'); |
| 1679 } else if (node.isMutableArray()) { | 1692 } else if (node.isMutableArray()) { |
| 1680 buffer.add('if ('); | 1693 buffer.add('if ('); |
| 1681 checkObject(input, '!=='); | 1694 checkObject(input, '!=='); |
| 1682 buffer.add('||'); | 1695 buffer.add('||'); |
| 1683 checkArray(input, '!=='); | 1696 checkArray(input, '!=='); |
| 1684 buffer.add('||'); | 1697 buffer.add('||'); |
| 1685 checkImmutableArray(input); | 1698 checkImmutableArray(input); |
| 1686 buffer.add(') '); | 1699 buffer.add(') '); |
| 1687 bailout(node, 'Not a mutable array'); | 1700 bailout(node, 'Not a mutable array'); |
| 1688 } else if (node.isArray()) { | 1701 } else if (node.isReadableArray()) { |
| 1689 buffer.add('if ('); | 1702 buffer.add('if ('); |
| 1690 checkObject(input, '!=='); | 1703 checkObject(input, '!=='); |
| 1691 buffer.add('||'); | 1704 buffer.add('||'); |
| 1692 checkArray(input, '!=='); | 1705 checkArray(input, '!=='); |
| 1693 buffer.add(') '); | 1706 buffer.add(') '); |
| 1694 bailout(node, 'Not an array'); | 1707 bailout(node, 'Not an array'); |
| 1695 } else if (node.isStringOrArray()) { | 1708 } else if (node.isIndexablePrimitive()) { |
| 1696 buffer.add('if ('); | 1709 buffer.add('if ('); |
| 1697 checkString(input, '!=='); | 1710 checkString(input, '!=='); |
| 1698 buffer.add(' && ('); | 1711 buffer.add(' && ('); |
| 1699 checkObject(input, '!=='); | 1712 checkObject(input, '!=='); |
| 1700 buffer.add('||'); | 1713 buffer.add('||'); |
| 1701 checkArray(input, '!=='); | 1714 checkArray(input, '!=='); |
| 1702 buffer.add(')) '); | 1715 buffer.add(')) '); |
| 1703 bailout(node, 'Not a string or array'); | 1716 bailout(node, 'Not a string or array'); |
| 1704 } else { | 1717 } else { |
| 1705 unreachable(); | 1718 unreachable(); |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1976 startBailoutSwitch(); | 1989 startBailoutSwitch(); |
| 1977 } | 1990 } |
| 1978 } | 1991 } |
| 1979 | 1992 |
| 1980 void endElse(HIf node) { | 1993 void endElse(HIf node) { |
| 1981 if (node.elseBlock.hasGuards()) { | 1994 if (node.elseBlock.hasGuards()) { |
| 1982 endBailoutSwitch(); | 1995 endBailoutSwitch(); |
| 1983 } | 1996 } |
| 1984 } | 1997 } |
| 1985 } | 1998 } |
| OLD | NEW |