OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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/globals.h" // Needed here to get TARGET_ARCH_DBC. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_DBC. |
6 #if defined(TARGET_ARCH_DBC) | 6 #if defined(TARGET_ARCH_DBC) |
7 | 7 |
8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 | 9 |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 DECLARE_FLAG(bool, emit_edge_counters); | 28 DECLARE_FLAG(bool, emit_edge_counters); |
29 DECLARE_FLAG(int, optimization_counter_threshold); | 29 DECLARE_FLAG(int, optimization_counter_threshold); |
30 | 30 |
31 // List of instructions that are still unimplemented by DBC backend. | 31 // List of instructions that are still unimplemented by DBC backend. |
32 #define FOR_EACH_UNIMPLEMENTED_INSTRUCTION(M) \ | 32 #define FOR_EACH_UNIMPLEMENTED_INSTRUCTION(M) \ |
33 M(LoadCodeUnits) \ | 33 M(LoadCodeUnits) \ |
34 M(BinaryInt32Op) \ | 34 M(BinaryInt32Op) \ |
35 M(Int32ToDouble) \ | 35 M(Int32ToDouble) \ |
36 M(DoubleToInteger) \ | 36 M(DoubleToInteger) \ |
37 M(DoubleToDouble) \ | |
38 M(DoubleToFloat) \ | |
39 M(FloatToDouble) \ | |
40 M(BoxInt64) \ | 37 M(BoxInt64) \ |
41 M(MergedMath) \ | 38 M(MergedMath) \ |
42 M(GuardFieldClass) \ | 39 M(GuardFieldClass) \ |
43 M(GuardFieldLength) \ | 40 M(GuardFieldLength) \ |
44 M(IfThenElse) \ | 41 M(IfThenElse) \ |
45 M(ExtractNthOutput) \ | 42 M(ExtractNthOutput) \ |
46 M(BinaryUint32Op) \ | 43 M(BinaryUint32Op) \ |
47 M(ShiftUint32Op) \ | 44 M(ShiftUint32Op) \ |
48 M(UnaryUint32Op) \ | 45 M(UnaryUint32Op) \ |
49 M(UnboxedIntConverter) \ | 46 M(UnboxedIntConverter) \ |
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 UNREACHABLE(); | 733 UNREACHABLE(); |
737 } | 734 } |
738 if (index_scale() == 1) { | 735 if (index_scale() == 1) { |
739 __ StoreIndexedUint32(array, index, value); | 736 __ StoreIndexedUint32(array, index, value); |
740 } else { | 737 } else { |
741 __ ShlImm(temp, index, Utils::ShiftForPowerOfTwo(index_scale())); | 738 __ ShlImm(temp, index, Utils::ShiftForPowerOfTwo(index_scale())); |
742 __ StoreIndexedUint32(array, temp, value); | 739 __ StoreIndexedUint32(array, temp, value); |
743 } | 740 } |
744 break; | 741 break; |
745 } | 742 } |
| 743 case kTypedDataFloat32ArrayCid: |
| 744 if (IsExternal()) { |
| 745 Unsupported(compiler); |
| 746 UNREACHABLE(); |
| 747 } |
| 748 if (index_scale() == 1) { |
| 749 __ StoreIndexedFloat32(array, index, value); |
| 750 } else if (index_scale() == 4) { |
| 751 __ StoreIndexed4Float32(array, index, value); |
| 752 } else { |
| 753 __ ShlImm(temp, index, Utils::ShiftForPowerOfTwo(index_scale())); |
| 754 __ StoreIndexedFloat32(array, temp, value); |
| 755 } |
| 756 break; |
746 case kTypedDataFloat64ArrayCid: | 757 case kTypedDataFloat64ArrayCid: |
747 if (IsExternal()) { | 758 if (IsExternal()) { |
748 Unsupported(compiler); | 759 Unsupported(compiler); |
749 UNREACHABLE(); | 760 UNREACHABLE(); |
750 } | 761 } |
751 if (index_scale() == 1) { | 762 if (index_scale() == 1) { |
752 __ StoreIndexedFloat64(array, index, value); | 763 __ StoreIndexedFloat64(array, index, value); |
753 } else if (index_scale() == 8) { | 764 } else if (index_scale() == 8) { |
754 __ StoreIndexed8Float64(array, index, value); | 765 __ StoreIndexed8Float64(array, index, value); |
755 } else { | 766 } else { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 case kOneByteStringCid: | 811 case kOneByteStringCid: |
801 ASSERT(index_scale() == 1); | 812 ASSERT(index_scale() == 1); |
802 __ LoadIndexedOneByteString(result, array, index); | 813 __ LoadIndexedOneByteString(result, array, index); |
803 break; | 814 break; |
804 case kTwoByteStringCid: | 815 case kTwoByteStringCid: |
805 if (index_scale() != 2) { | 816 if (index_scale() != 2) { |
806 // TODO(zra): Fix-up index. | 817 // TODO(zra): Fix-up index. |
807 Unsupported(compiler); | 818 Unsupported(compiler); |
808 UNREACHABLE(); | 819 UNREACHABLE(); |
809 } | 820 } |
| 821 if (IsExternal()) { |
| 822 Unsupported(compiler); |
| 823 UNREACHABLE(); |
| 824 } |
810 __ LoadIndexedTwoByteString(result, array, index); | 825 __ LoadIndexedTwoByteString(result, array, index); |
811 break; | 826 break; |
812 case kTypedDataInt32ArrayCid: | 827 case kTypedDataInt32ArrayCid: |
813 ASSERT(representation() == kUnboxedInt32); | 828 ASSERT(representation() == kUnboxedInt32); |
| 829 if (IsExternal()) { |
| 830 Unsupported(compiler); |
| 831 UNREACHABLE(); |
| 832 } |
814 if (index_scale() == 1) { | 833 if (index_scale() == 1) { |
815 __ LoadIndexedInt32(result, array, index); | 834 __ LoadIndexedInt32(result, array, index); |
816 } else { | 835 } else { |
817 __ ShlImm(temp, index, Utils::ShiftForPowerOfTwo(index_scale())); | 836 __ ShlImm(temp, index, Utils::ShiftForPowerOfTwo(index_scale())); |
818 __ LoadIndexedInt32(result, array, temp); | 837 __ LoadIndexedInt32(result, array, temp); |
819 } | 838 } |
820 break; | 839 break; |
821 case kTypedDataUint32ArrayCid: | 840 case kTypedDataUint32ArrayCid: |
822 ASSERT(representation() == kUnboxedUint32); | 841 ASSERT(representation() == kUnboxedUint32); |
| 842 if (IsExternal()) { |
| 843 Unsupported(compiler); |
| 844 UNREACHABLE(); |
| 845 } |
823 if (index_scale() == 1) { | 846 if (index_scale() == 1) { |
824 __ LoadIndexedUint32(result, array, index); | 847 __ LoadIndexedUint32(result, array, index); |
825 } else { | 848 } else { |
826 __ ShlImm(temp, index, Utils::ShiftForPowerOfTwo(index_scale())); | 849 __ ShlImm(temp, index, Utils::ShiftForPowerOfTwo(index_scale())); |
827 __ LoadIndexedUint32(result, array, temp); | 850 __ LoadIndexedUint32(result, array, temp); |
828 } | 851 } |
829 break; | 852 break; |
| 853 case kTypedDataFloat32ArrayCid: |
| 854 if (IsExternal()) { |
| 855 Unsupported(compiler); |
| 856 UNREACHABLE(); |
| 857 } |
| 858 if (index_scale() == 1) { |
| 859 __ LoadIndexedFloat32(result, array, index); |
| 860 } else if (index_scale() == 4) { |
| 861 __ LoadIndexed4Float32(result, array, index); |
| 862 } else { |
| 863 __ ShlImm(temp, index, Utils::ShiftForPowerOfTwo(index_scale())); |
| 864 __ LoadIndexedFloat32(result, array, temp); |
| 865 } |
| 866 break; |
830 case kTypedDataFloat64ArrayCid: | 867 case kTypedDataFloat64ArrayCid: |
| 868 if (IsExternal()) { |
| 869 Unsupported(compiler); |
| 870 UNREACHABLE(); |
| 871 } |
831 if (index_scale() == 1) { | 872 if (index_scale() == 1) { |
832 __ LoadIndexedFloat64(result, array, index); | 873 __ LoadIndexedFloat64(result, array, index); |
833 } else if (index_scale() == 8) { | 874 } else if (index_scale() == 8) { |
834 __ LoadIndexed8Float64(result, array, index); | 875 __ LoadIndexed8Float64(result, array, index); |
835 } else { | 876 } else { |
836 __ ShlImm(temp, index, Utils::ShiftForPowerOfTwo(index_scale())); | 877 __ ShlImm(temp, index, Utils::ShiftForPowerOfTwo(index_scale())); |
837 __ LoadIndexedFloat64(result, array, temp); | 878 __ LoadIndexedFloat64(result, array, temp); |
838 } | 879 } |
839 break; | 880 break; |
840 default: | 881 default: |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1590 __ DSqrt(result, value); | 1631 __ DSqrt(result, value); |
1591 } else if (kind() == MathUnaryInstr::kDoubleSquare) { | 1632 } else if (kind() == MathUnaryInstr::kDoubleSquare) { |
1592 __ DMul(result, value, value); | 1633 __ DMul(result, value, value); |
1593 } else { | 1634 } else { |
1594 Unsupported(compiler); | 1635 Unsupported(compiler); |
1595 UNREACHABLE(); | 1636 UNREACHABLE(); |
1596 } | 1637 } |
1597 } | 1638 } |
1598 | 1639 |
1599 | 1640 |
| 1641 EMIT_NATIVE_CODE(DoubleToDouble, 1, Location::RequiresRegister()) { |
| 1642 const Register in = locs()->in(0).reg(); |
| 1643 const Register result = locs()->out(0).reg(); |
| 1644 switch (recognized_kind()) { |
| 1645 case MethodRecognizer::kDoubleTruncate: |
| 1646 __ DTruncate(result, in); |
| 1647 break; |
| 1648 case MethodRecognizer::kDoubleFloor: |
| 1649 __ DFloor(result, in); |
| 1650 break; |
| 1651 case MethodRecognizer::kDoubleCeil: |
| 1652 __ DCeil(result, in); |
| 1653 break; |
| 1654 default: |
| 1655 UNREACHABLE(); |
| 1656 } |
| 1657 } |
| 1658 |
| 1659 |
| 1660 EMIT_NATIVE_CODE(DoubleToFloat, 1, Location::RequiresRegister()) { |
| 1661 const Register in = locs()->in(0).reg(); |
| 1662 const Register result = locs()->out(0).reg(); |
| 1663 __ DoubleToFloat(result, in); |
| 1664 } |
| 1665 |
| 1666 |
| 1667 EMIT_NATIVE_CODE(FloatToDouble, 1, Location::RequiresRegister()) { |
| 1668 const Register in = locs()->in(0).reg(); |
| 1669 const Register result = locs()->out(0).reg(); |
| 1670 __ FloatToDouble(result, in); |
| 1671 } |
| 1672 |
| 1673 |
1600 EMIT_NATIVE_CODE(InvokeMathCFunction, | 1674 EMIT_NATIVE_CODE(InvokeMathCFunction, |
1601 InputCount(), Location::RequiresRegister()) { | 1675 InputCount(), Location::RequiresRegister()) { |
1602 const Register left = locs()->in(0).reg(); | 1676 const Register left = locs()->in(0).reg(); |
1603 const Register result = locs()->out(0).reg(); | 1677 const Register result = locs()->out(0).reg(); |
1604 if (recognized_kind() == MethodRecognizer::kMathDoublePow) { | 1678 if (recognized_kind() == MethodRecognizer::kMathDoublePow) { |
1605 const Register right = locs()->in(1).reg(); | 1679 const Register right = locs()->in(1).reg(); |
1606 __ DPow(result, left, right); | 1680 __ DPow(result, left, right); |
1607 } else if (recognized_kind() == MethodRecognizer::kDoubleMod) { | 1681 } else if (recognized_kind() == MethodRecognizer::kDoubleMod) { |
1608 const Register right = locs()->in(1).reg(); | 1682 const Register right = locs()->in(1).reg(); |
1609 __ DMod(result, left, right); | 1683 __ DMod(result, left, right); |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1809 __ IfULe(length, index); | 1883 __ IfULe(length, index); |
1810 compiler->EmitDeopt(deopt_id(), | 1884 compiler->EmitDeopt(deopt_id(), |
1811 ICData::kDeoptCheckArrayBound, | 1885 ICData::kDeoptCheckArrayBound, |
1812 (generalized_ ? ICData::kGeneralized : 0) | | 1886 (generalized_ ? ICData::kGeneralized : 0) | |
1813 (licm_hoisted_ ? ICData::kHoisted : 0)); | 1887 (licm_hoisted_ ? ICData::kHoisted : 0)); |
1814 } | 1888 } |
1815 | 1889 |
1816 } // namespace dart | 1890 } // namespace dart |
1817 | 1891 |
1818 #endif // defined TARGET_ARCH_DBC | 1892 #endif // defined TARGET_ARCH_DBC |
OLD | NEW |