| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 #include "vm/flow_graph_optimizer.h" | 5 #include "vm/flow_graph_optimizer.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/cha.h" | 8 #include "vm/cha.h" |
| 9 #include "vm/flow_graph_builder.h" | 9 #include "vm/flow_graph_builder.h" |
| 10 #include "vm/flow_graph_compiler.h" | 10 #include "vm/flow_graph_compiler.h" |
| (...skipping 1629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1640 default: | 1640 default: |
| 1641 // Unsupported method. | 1641 // Unsupported method. |
| 1642 return false; | 1642 return false; |
| 1643 } | 1643 } |
| 1644 } | 1644 } |
| 1645 | 1645 |
| 1646 if (IsSupportedByteArrayCid(class_ids[0]) && | 1646 if (IsSupportedByteArrayCid(class_ids[0]) && |
| 1647 (ic_data.NumberOfChecks() == 1)) { | 1647 (ic_data.NumberOfChecks() == 1)) { |
| 1648 // For elements that may not fit into a smi on all platforms, check if | 1648 // For elements that may not fit into a smi on all platforms, check if |
| 1649 // elements fit into a smi or the platform supports unboxed mints. | 1649 // elements fit into a smi or the platform supports unboxed mints. |
| 1650 if ((recognized_kind == MethodRecognizer::kByteArrayBaseGetInt32) || | 1650 if ((recognized_kind == MethodRecognizer::kTypedListGetInt32) || |
| 1651 (recognized_kind == MethodRecognizer::kByteArrayBaseGetUint32) || | 1651 (recognized_kind == MethodRecognizer::kTypedListGetUint32) || |
| 1652 (recognized_kind == MethodRecognizer::kByteArrayBaseSetInt32) || | 1652 (recognized_kind == MethodRecognizer::kTypedListSetInt32) || |
| 1653 (recognized_kind == MethodRecognizer::kByteArrayBaseSetUint32)) { | 1653 (recognized_kind == MethodRecognizer::kTypedListSetUint32)) { |
| 1654 if (!CanUnboxInt32()) return false; | 1654 if (!CanUnboxInt32()) return false; |
| 1655 } | 1655 } |
| 1656 | 1656 |
| 1657 switch (recognized_kind) { | 1657 switch (recognized_kind) { |
| 1658 // ByteArray getters. | 1658 // ByteArray getters. |
| 1659 case MethodRecognizer::kByteArrayBaseGetInt8: | 1659 case MethodRecognizer::kTypedListGetInt8: |
| 1660 return BuildByteArrayViewLoad(call, class_ids[0], kInt8ArrayCid); | 1660 return BuildByteArrayViewLoad(call, class_ids[0], kInt8ArrayCid); |
| 1661 case MethodRecognizer::kByteArrayBaseGetUint8: | 1661 case MethodRecognizer::kTypedListGetUint8: |
| 1662 return BuildByteArrayViewLoad(call, class_ids[0], kUint8ArrayCid); | 1662 return BuildByteArrayViewLoad(call, class_ids[0], kUint8ArrayCid); |
| 1663 case MethodRecognizer::kByteArrayBaseGetInt16: | 1663 case MethodRecognizer::kTypedListGetInt16: |
| 1664 return BuildByteArrayViewLoad(call, class_ids[0], kInt16ArrayCid); | 1664 return BuildByteArrayViewLoad(call, class_ids[0], kInt16ArrayCid); |
| 1665 case MethodRecognizer::kByteArrayBaseGetUint16: | 1665 case MethodRecognizer::kTypedListGetUint16: |
| 1666 return BuildByteArrayViewLoad(call, class_ids[0], kUint16ArrayCid); | 1666 return BuildByteArrayViewLoad(call, class_ids[0], kUint16ArrayCid); |
| 1667 case MethodRecognizer::kByteArrayBaseGetInt32: | 1667 case MethodRecognizer::kTypedListGetInt32: |
| 1668 return BuildByteArrayViewLoad(call, class_ids[0], kInt32ArrayCid); | 1668 return BuildByteArrayViewLoad(call, class_ids[0], kInt32ArrayCid); |
| 1669 case MethodRecognizer::kByteArrayBaseGetUint32: | 1669 case MethodRecognizer::kTypedListGetUint32: |
| 1670 return BuildByteArrayViewLoad(call, class_ids[0], kUint32ArrayCid); | 1670 return BuildByteArrayViewLoad(call, class_ids[0], kUint32ArrayCid); |
| 1671 case MethodRecognizer::kByteArrayBaseGetFloat32: | 1671 case MethodRecognizer::kTypedListGetFloat32: |
| 1672 return BuildByteArrayViewLoad(call, class_ids[0], kFloat32ArrayCid); | 1672 return BuildByteArrayViewLoad(call, class_ids[0], kFloat32ArrayCid); |
| 1673 case MethodRecognizer::kByteArrayBaseGetFloat64: | 1673 case MethodRecognizer::kTypedListGetFloat64: |
| 1674 return BuildByteArrayViewLoad(call, class_ids[0], kFloat64ArrayCid); | 1674 return BuildByteArrayViewLoad(call, class_ids[0], kFloat64ArrayCid); |
| 1675 | 1675 |
| 1676 // ByteArray setters. | 1676 // ByteArray setters. |
| 1677 case MethodRecognizer::kByteArrayBaseSetInt8: | 1677 case MethodRecognizer::kTypedListSetInt8: |
| 1678 return BuildByteArrayViewStore(call, class_ids[0], kInt8ArrayCid); | 1678 return BuildByteArrayViewStore(call, class_ids[0], kInt8ArrayCid); |
| 1679 case MethodRecognizer::kByteArrayBaseSetUint8: | 1679 case MethodRecognizer::kTypedListSetUint8: |
| 1680 return BuildByteArrayViewStore(call, class_ids[0], kUint8ArrayCid); | 1680 return BuildByteArrayViewStore(call, class_ids[0], kUint8ArrayCid); |
| 1681 case MethodRecognizer::kByteArrayBaseSetInt16: | 1681 case MethodRecognizer::kTypedListSetInt16: |
| 1682 return BuildByteArrayViewStore(call, class_ids[0], kInt16ArrayCid); | 1682 return BuildByteArrayViewStore(call, class_ids[0], kInt16ArrayCid); |
| 1683 case MethodRecognizer::kByteArrayBaseSetUint16: | 1683 case MethodRecognizer::kTypedListSetUint16: |
| 1684 return BuildByteArrayViewStore(call, class_ids[0], kUint16ArrayCid); | 1684 return BuildByteArrayViewStore(call, class_ids[0], kUint16ArrayCid); |
| 1685 case MethodRecognizer::kByteArrayBaseSetInt32: | 1685 case MethodRecognizer::kTypedListSetInt32: |
| 1686 return BuildByteArrayViewStore(call, class_ids[0], kInt32ArrayCid); | 1686 return BuildByteArrayViewStore(call, class_ids[0], kInt32ArrayCid); |
| 1687 case MethodRecognizer::kByteArrayBaseSetUint32: | 1687 case MethodRecognizer::kTypedListSetUint32: |
| 1688 return BuildByteArrayViewStore(call, class_ids[0], kUint32ArrayCid); | 1688 return BuildByteArrayViewStore(call, class_ids[0], kUint32ArrayCid); |
| 1689 case MethodRecognizer::kByteArrayBaseSetFloat32: | 1689 case MethodRecognizer::kTypedListSetFloat32: |
| 1690 return BuildByteArrayViewStore(call, class_ids[0], kFloat32ArrayCid); | 1690 return BuildByteArrayViewStore(call, class_ids[0], kFloat32ArrayCid); |
| 1691 case MethodRecognizer::kByteArrayBaseSetFloat64: | 1691 case MethodRecognizer::kTypedListSetFloat64: |
| 1692 return BuildByteArrayViewStore(call, class_ids[0], kFloat64ArrayCid); | 1692 return BuildByteArrayViewStore(call, class_ids[0], kFloat64ArrayCid); |
| 1693 default: | 1693 default: |
| 1694 // Unsupported method. | 1694 // Unsupported method. |
| 1695 return false; | 1695 return false; |
| 1696 } | 1696 } |
| 1697 } | 1697 } |
| 1698 return false; | 1698 return false; |
| 1699 } | 1699 } |
| 1700 | 1700 |
| 1701 | 1701 |
| (...skipping 3006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4708 if (changed) { | 4708 if (changed) { |
| 4709 // We may have changed the block order and the dominator tree. | 4709 // We may have changed the block order and the dominator tree. |
| 4710 flow_graph->DiscoverBlocks(); | 4710 flow_graph->DiscoverBlocks(); |
| 4711 GrowableArray<BitVector*> dominance_frontier; | 4711 GrowableArray<BitVector*> dominance_frontier; |
| 4712 flow_graph->ComputeDominators(&dominance_frontier); | 4712 flow_graph->ComputeDominators(&dominance_frontier); |
| 4713 } | 4713 } |
| 4714 } | 4714 } |
| 4715 | 4715 |
| 4716 | 4716 |
| 4717 } // namespace dart | 4717 } // namespace dart |
| OLD | NEW |