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 <setjmp.h> // NOLINT | 5 #include <setjmp.h> // NOLINT |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 | 7 |
8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
9 #if defined(TARGET_ARCH_DBC) | 9 #if defined(TARGET_ARCH_DBC) |
10 | 10 |
(...skipping 1692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1703 const intptr_t shift_amount = | 1703 const intptr_t shift_amount = |
1704 (rhs >= kBitsPerWord) ? (kBitsPerWord - 1) : rhs; | 1704 (rhs >= kBitsPerWord) ? (kBitsPerWord - 1) : rhs; |
1705 const intptr_t lhs = reinterpret_cast<intptr_t>(FP[rB]) >> kSmiTagSize; | 1705 const intptr_t lhs = reinterpret_cast<intptr_t>(FP[rB]) >> kSmiTagSize; |
1706 *reinterpret_cast<intptr_t*>(&FP[rA]) = | 1706 *reinterpret_cast<intptr_t*>(&FP[rA]) = |
1707 (lhs >> shift_amount) << kSmiTagSize; | 1707 (lhs >> shift_amount) << kSmiTagSize; |
1708 pc++; | 1708 pc++; |
1709 } | 1709 } |
1710 DISPATCH(); | 1710 DISPATCH(); |
1711 } | 1711 } |
1712 | 1712 |
| 1713 { |
| 1714 BYTECODE(Min, A_B_C); |
| 1715 const intptr_t lhs = reinterpret_cast<intptr_t>(FP[rB]); |
| 1716 const intptr_t rhs = reinterpret_cast<intptr_t>(FP[rC]); |
| 1717 FP[rA] = reinterpret_cast<RawObject*>((lhs < rhs) ? lhs : rhs); |
| 1718 DISPATCH(); |
| 1719 } |
| 1720 |
| 1721 { |
| 1722 BYTECODE(Max, A_B_C); |
| 1723 const intptr_t lhs = reinterpret_cast<intptr_t>(FP[rB]); |
| 1724 const intptr_t rhs = reinterpret_cast<intptr_t>(FP[rC]); |
| 1725 FP[rA] = reinterpret_cast<RawObject*>((lhs > rhs) ? lhs : rhs); |
| 1726 DISPATCH(); |
| 1727 } |
| 1728 |
1713 #if defined(ARCH_IS_64_BIT) | 1729 #if defined(ARCH_IS_64_BIT) |
1714 { | 1730 { |
1715 BYTECODE(WriteIntoDouble, A_D); | 1731 BYTECODE(WriteIntoDouble, A_D); |
1716 const double value = bit_cast<double, RawObject*>(FP[rD]); | 1732 const double value = bit_cast<double, RawObject*>(FP[rD]); |
1717 RawDouble* box = RAW_CAST(Double, *SP--); | 1733 RawDouble* box = RAW_CAST(Double, *SP--); |
1718 box->ptr()->value_ = value; | 1734 box->ptr()->value_ = value; |
1719 FP[rA] = box; | 1735 FP[rA] = box; |
1720 DISPATCH(); | 1736 DISPATCH(); |
1721 } | 1737 } |
1722 | 1738 |
(...skipping 14 matching lines...) Expand all Loading... |
1737 pc++; | 1753 pc++; |
1738 } else if (box_cid == kDoubleCid) { | 1754 } else if (box_cid == kDoubleCid) { |
1739 const RawDouble* box = RAW_CAST(Double, FP[rD]); | 1755 const RawDouble* box = RAW_CAST(Double, FP[rD]); |
1740 FP[rA] = bit_cast<RawObject*, double>(box->ptr()->value_); | 1756 FP[rA] = bit_cast<RawObject*, double>(box->ptr()->value_); |
1741 pc++; | 1757 pc++; |
1742 } | 1758 } |
1743 DISPATCH(); | 1759 DISPATCH(); |
1744 } | 1760 } |
1745 | 1761 |
1746 { | 1762 { |
| 1763 BYTECODE(DoubleToSmi, A_D); |
| 1764 const double value = bit_cast<double, RawObject*>(FP[rD]); |
| 1765 if (!isnan(value)) { |
| 1766 const intptr_t result = static_cast<intptr_t>(value); |
| 1767 if ((result <= Smi::kMaxValue) && (result >= Smi::kMinValue)) { |
| 1768 FP[rA] = reinterpret_cast<RawObject*>(result << kSmiTagSize); |
| 1769 pc++; |
| 1770 } |
| 1771 } |
| 1772 DISPATCH(); |
| 1773 } |
| 1774 |
| 1775 { |
1747 BYTECODE(SmiToDouble, A_D); | 1776 BYTECODE(SmiToDouble, A_D); |
1748 const intptr_t value = reinterpret_cast<intptr_t>(FP[rD]) >> kSmiTagSize; | 1777 const intptr_t value = reinterpret_cast<intptr_t>(FP[rD]) >> kSmiTagSize; |
1749 const double result = static_cast<double>(value); | 1778 const double result = static_cast<double>(value); |
1750 FP[rA] = bit_cast<RawObject*, double>(result); | 1779 FP[rA] = bit_cast<RawObject*, double>(result); |
1751 DISPATCH(); | 1780 DISPATCH(); |
1752 } | 1781 } |
1753 | 1782 |
1754 { | 1783 { |
1755 BYTECODE(DAdd, A_B_C); | 1784 BYTECODE(DAdd, A_B_C); |
1756 const double lhs = bit_cast<double, RawObject*>(FP[rB]); | 1785 const double lhs = bit_cast<double, RawObject*>(FP[rB]); |
(...skipping 26 matching lines...) Expand all Loading... |
1783 FP[rA] = bit_cast<RawObject*, double>(result); | 1812 FP[rA] = bit_cast<RawObject*, double>(result); |
1784 DISPATCH(); | 1813 DISPATCH(); |
1785 } | 1814 } |
1786 | 1815 |
1787 { | 1816 { |
1788 BYTECODE(DNeg, A_D); | 1817 BYTECODE(DNeg, A_D); |
1789 const double value = bit_cast<double, RawObject*>(FP[rD]); | 1818 const double value = bit_cast<double, RawObject*>(FP[rD]); |
1790 FP[rA] = bit_cast<RawObject*, double>(-value); | 1819 FP[rA] = bit_cast<RawObject*, double>(-value); |
1791 DISPATCH(); | 1820 DISPATCH(); |
1792 } | 1821 } |
| 1822 |
| 1823 { |
| 1824 BYTECODE(DSqrt, A_D); |
| 1825 const double value = bit_cast<double, RawObject*>(FP[rD]); |
| 1826 FP[rA] = bit_cast<RawObject*, double>(sqrt(value)); |
| 1827 DISPATCH(); |
| 1828 } |
| 1829 |
| 1830 { |
| 1831 BYTECODE(DMin, A_B_C); |
| 1832 const double lhs = bit_cast<double, RawObject*>(FP[rB]); |
| 1833 const double rhs = bit_cast<double, RawObject*>(FP[rC]); |
| 1834 FP[rA] = bit_cast<RawObject*, double>(fmin(lhs, rhs)); |
| 1835 DISPATCH(); |
| 1836 } |
| 1837 |
| 1838 { |
| 1839 BYTECODE(DMax, A_B_C); |
| 1840 const double lhs = bit_cast<double, RawObject*>(FP[rB]); |
| 1841 const double rhs = bit_cast<double, RawObject*>(FP[rC]); |
| 1842 FP[rA] = bit_cast<RawObject*, double>(fmax(lhs, rhs)); |
| 1843 DISPATCH(); |
| 1844 } |
1793 #else // defined(ARCH_IS_64_BIT) | 1845 #else // defined(ARCH_IS_64_BIT) |
1794 { | 1846 { |
1795 BYTECODE(WriteIntoDouble, A_D); | 1847 BYTECODE(WriteIntoDouble, A_D); |
1796 UNIMPLEMENTED(); | 1848 UNIMPLEMENTED(); |
1797 DISPATCH(); | 1849 DISPATCH(); |
1798 } | 1850 } |
1799 | 1851 |
1800 { | 1852 { |
1801 BYTECODE(UnboxDouble, A_D); | 1853 BYTECODE(UnboxDouble, A_D); |
1802 UNIMPLEMENTED(); | 1854 UNIMPLEMENTED(); |
1803 DISPATCH(); | 1855 DISPATCH(); |
1804 } | 1856 } |
1805 | 1857 |
1806 { | 1858 { |
1807 BYTECODE(CheckedUnboxDouble, A_D); | 1859 BYTECODE(CheckedUnboxDouble, A_D); |
1808 UNIMPLEMENTED(); | 1860 UNIMPLEMENTED(); |
1809 DISPATCH(); | 1861 DISPATCH(); |
1810 } | 1862 } |
1811 | 1863 |
1812 { | 1864 { |
| 1865 BYTECODE(DoubleToSmi, A_D); |
| 1866 UNREACHABLE(); |
| 1867 DISPATCH(); |
| 1868 } |
| 1869 |
| 1870 { |
1813 BYTECODE(SmiToDouble, A_D); | 1871 BYTECODE(SmiToDouble, A_D); |
1814 UNIMPLEMENTED(); | 1872 UNIMPLEMENTED(); |
1815 DISPATCH(); | 1873 DISPATCH(); |
1816 } | 1874 } |
1817 | 1875 |
1818 { | 1876 { |
1819 BYTECODE(DAdd, A_B_C); | 1877 BYTECODE(DAdd, A_B_C); |
1820 UNIMPLEMENTED(); | 1878 UNIMPLEMENTED(); |
1821 DISPATCH(); | 1879 DISPATCH(); |
1822 } | 1880 } |
(...skipping 14 matching lines...) Expand all Loading... |
1837 BYTECODE(DDiv, A_B_C); | 1895 BYTECODE(DDiv, A_B_C); |
1838 UNIMPLEMENTED(); | 1896 UNIMPLEMENTED(); |
1839 DISPATCH(); | 1897 DISPATCH(); |
1840 } | 1898 } |
1841 | 1899 |
1842 { | 1900 { |
1843 BYTECODE(DNeg, A_D); | 1901 BYTECODE(DNeg, A_D); |
1844 UNIMPLEMENTED(); | 1902 UNIMPLEMENTED(); |
1845 DISPATCH(); | 1903 DISPATCH(); |
1846 } | 1904 } |
| 1905 |
| 1906 { |
| 1907 BYTECODE(DSqrt, A_D); |
| 1908 UNREACHABLE(); |
| 1909 DISPATCH(); |
| 1910 } |
| 1911 |
| 1912 { |
| 1913 BYTECODE(DMin, A_B_C); |
| 1914 UNREACHABLE(); |
| 1915 DISPATCH(); |
| 1916 } |
| 1917 |
| 1918 { |
| 1919 BYTECODE(DMax, A_B_C); |
| 1920 UNREACHABLE(); |
| 1921 DISPATCH(); |
| 1922 } |
1847 #endif // defined(ARCH_IS_64_BIT) | 1923 #endif // defined(ARCH_IS_64_BIT) |
1848 | 1924 |
1849 // Return and return like instructions (Instrinsic). | 1925 // Return and return like instructions (Instrinsic). |
1850 { | 1926 { |
1851 RawObject* result; // result to return to the caller. | 1927 RawObject* result; // result to return to the caller. |
1852 | 1928 |
1853 BYTECODE(Intrinsic, A); | 1929 BYTECODE(Intrinsic, A); |
1854 // Try invoking intrinsic handler. If it succeeds (returns true) | 1930 // Try invoking intrinsic handler. If it succeeds (returns true) |
1855 // then just return the value it returned to the caller. | 1931 // then just return the value it returned to the caller. |
1856 result = null_value; | 1932 result = null_value; |
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2810 pc_ = pc; | 2886 pc_ = pc; |
2811 special_[kExceptionSpecialIndex] = raw_exception; | 2887 special_[kExceptionSpecialIndex] = raw_exception; |
2812 special_[kStacktraceSpecialIndex] = raw_stacktrace; | 2888 special_[kStacktraceSpecialIndex] = raw_stacktrace; |
2813 buf->Longjmp(); | 2889 buf->Longjmp(); |
2814 UNREACHABLE(); | 2890 UNREACHABLE(); |
2815 } | 2891 } |
2816 | 2892 |
2817 } // namespace dart | 2893 } // namespace dart |
2818 | 2894 |
2819 #endif // defined TARGET_ARCH_DBC | 2895 #endif // defined TARGET_ARCH_DBC |
OLD | NEW |