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/globals.h" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1747 __ EnterStubFrame(); | 1747 __ EnterStubFrame(); |
1748 __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0); | 1748 __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0); |
1749 __ LeaveStubFrame(); | 1749 __ LeaveStubFrame(); |
1750 __ b(&done_stepping); | 1750 __ b(&done_stepping); |
1751 } | 1751 } |
1752 | 1752 |
1753 | 1753 |
1754 // Used to check class and type arguments. Arguments passed in registers: | 1754 // Used to check class and type arguments. Arguments passed in registers: |
1755 // LR: return address. | 1755 // LR: return address. |
1756 // R0: instance (must be preserved). | 1756 // R0: instance (must be preserved). |
1757 // R1: instantiator type arguments (only if n == 4, can be raw_null). | 1757 // R2: instantiator type arguments (only if n == 4, can be raw_null). |
1758 // R2: function type arguments (only if n == 4, can be raw_null). | 1758 // R1: function type arguments (only if n == 4, can be raw_null). |
1759 // R3: SubtypeTestCache. | 1759 // R3: SubtypeTestCache. |
1760 // Result in R1: null -> not found, otherwise result (true or false). | 1760 // Result in R1: null -> not found, otherwise result (true or false). |
1761 static void GenerateSubtypeNTestCacheStub(Assembler* assembler, int n) { | 1761 static void GenerateSubtypeNTestCacheStub(Assembler* assembler, int n) { |
1762 ASSERT((n == 1) || (n == 2) || (n == 4)); | 1762 ASSERT((n == 1) || (n == 2) || (n == 4)); |
1763 if (n > 1) { | 1763 if (n > 1) { |
1764 __ LoadClass(R8, R0, R4); | 1764 __ LoadClass(R8, R0, R4); |
1765 // Compute instance type arguments into R4. | 1765 // Compute instance type arguments into R4. |
1766 Label has_no_type_arguments; | 1766 Label has_no_type_arguments; |
1767 __ LoadObject(R4, Object::null_object()); | 1767 __ LoadObject(R4, Object::null_object()); |
1768 __ ldr(R9, FieldAddress( | 1768 __ ldr(R9, FieldAddress( |
1769 R8, Class::type_arguments_field_offset_in_words_offset())); | 1769 R8, Class::type_arguments_field_offset_in_words_offset())); |
1770 __ CompareImmediate(R9, Class::kNoTypeArguments); | 1770 __ CompareImmediate(R9, Class::kNoTypeArguments); |
1771 __ b(&has_no_type_arguments, EQ); | 1771 __ b(&has_no_type_arguments, EQ); |
1772 __ add(R9, R0, Operand(R9, LSL, 2)); | 1772 __ add(R9, R0, Operand(R9, LSL, 2)); |
1773 __ ldr(R4, FieldAddress(R9, 0)); | 1773 __ ldr(R4, FieldAddress(R9, 0)); |
1774 __ Bind(&has_no_type_arguments); | 1774 __ Bind(&has_no_type_arguments); |
1775 } | 1775 } |
1776 __ LoadClassId(R8, R0); | 1776 __ LoadClassId(R8, R0); |
1777 // R0: instance. | 1777 // R0: instance. |
1778 // R1: instantiator type arguments (only if n == 4, can be raw_null). | 1778 // R2: instantiator type arguments (only if n == 4, can be raw_null). |
1779 // R2: function type arguments (only if n == 4, can be raw_null). | 1779 // R1: function type arguments (only if n == 4, can be raw_null). |
1780 // R3: SubtypeTestCache. | 1780 // R3: SubtypeTestCache. |
1781 // R8: instance class id. | 1781 // R8: instance class id. |
1782 // R4: instance type arguments (null if none), used only if n > 1. | 1782 // R4: instance type arguments (null if none), used only if n > 1. |
1783 __ ldr(R3, FieldAddress(R3, SubtypeTestCache::cache_offset())); | 1783 __ ldr(R3, FieldAddress(R3, SubtypeTestCache::cache_offset())); |
1784 __ AddImmediate(R3, Array::data_offset() - kHeapObjectTag); | 1784 __ AddImmediate(R3, Array::data_offset() - kHeapObjectTag); |
1785 | 1785 |
1786 Label loop, found, not_found, next_iteration; | 1786 Label loop, found, not_found, next_iteration; |
1787 // R3: entry start. | 1787 // R3: entry start. |
1788 // R8: instance class id. | 1788 // R8: instance class id. |
1789 // R4: instance type arguments (still null if closure). | 1789 // R4: instance type arguments (still null if closure). |
(...skipping 14 matching lines...) Expand all Loading... |
1804 __ b(&next_iteration, NE); | 1804 __ b(&next_iteration, NE); |
1805 __ ldr(R9, | 1805 __ ldr(R9, |
1806 Address(R3, kWordSize * SubtypeTestCache::kInstanceTypeArguments)); | 1806 Address(R3, kWordSize * SubtypeTestCache::kInstanceTypeArguments)); |
1807 __ cmp(R9, Operand(R4)); | 1807 __ cmp(R9, Operand(R4)); |
1808 if (n == 2) { | 1808 if (n == 2) { |
1809 __ b(&found, EQ); | 1809 __ b(&found, EQ); |
1810 } else { | 1810 } else { |
1811 __ b(&next_iteration, NE); | 1811 __ b(&next_iteration, NE); |
1812 __ ldr(R9, Address(R3, kWordSize * | 1812 __ ldr(R9, Address(R3, kWordSize * |
1813 SubtypeTestCache::kInstantiatorTypeArguments)); | 1813 SubtypeTestCache::kInstantiatorTypeArguments)); |
1814 __ cmp(R9, Operand(R1)); | 1814 __ cmp(R9, Operand(R2)); |
1815 __ b(&next_iteration, NE); | 1815 __ b(&next_iteration, NE); |
1816 __ ldr(R9, | 1816 __ ldr(R9, |
1817 Address(R3, kWordSize * SubtypeTestCache::kFunctionTypeArguments)); | 1817 Address(R3, kWordSize * SubtypeTestCache::kFunctionTypeArguments)); |
1818 __ cmp(R9, Operand(R2)); | 1818 __ cmp(R9, Operand(R1)); |
1819 __ b(&found, EQ); | 1819 __ b(&found, EQ); |
1820 } | 1820 } |
1821 } | 1821 } |
1822 __ Bind(&next_iteration); | 1822 __ Bind(&next_iteration); |
1823 __ AddImmediate(R3, kWordSize * SubtypeTestCache::kTestEntryLength); | 1823 __ AddImmediate(R3, kWordSize * SubtypeTestCache::kTestEntryLength); |
1824 __ b(&loop); | 1824 __ b(&loop); |
1825 // Fall through to not found. | 1825 // Fall through to not found. |
1826 __ Bind(¬_found); | 1826 __ Bind(¬_found); |
1827 __ LoadObject(R1, Object::null_object()); | 1827 __ LoadObject(R1, Object::null_object()); |
1828 __ Ret(); | 1828 __ Ret(); |
1829 | 1829 |
1830 __ Bind(&found); | 1830 __ Bind(&found); |
1831 __ ldr(R1, Address(R3, kWordSize * SubtypeTestCache::kTestResult)); | 1831 __ ldr(R1, Address(R3, kWordSize * SubtypeTestCache::kTestResult)); |
1832 __ Ret(); | 1832 __ Ret(); |
1833 } | 1833 } |
1834 | 1834 |
1835 | 1835 |
1836 // Used to check class and type arguments. Arguments passed in registers: | 1836 // Used to check class and type arguments. Arguments passed in registers: |
1837 // LR: return address. | 1837 // LR: return address. |
1838 // R0: instance (must be preserved). | 1838 // R0: instance (must be preserved). |
| 1839 // R2: unused. |
1839 // R1: unused. | 1840 // R1: unused. |
1840 // R2: unused. | |
1841 // R3: SubtypeTestCache. | 1841 // R3: SubtypeTestCache. |
1842 // Result in R1: null -> not found, otherwise result (true or false). | 1842 // Result in R1: null -> not found, otherwise result (true or false). |
1843 void StubCode::GenerateSubtype1TestCacheStub(Assembler* assembler) { | 1843 void StubCode::GenerateSubtype1TestCacheStub(Assembler* assembler) { |
1844 GenerateSubtypeNTestCacheStub(assembler, 1); | 1844 GenerateSubtypeNTestCacheStub(assembler, 1); |
1845 } | 1845 } |
1846 | 1846 |
1847 | 1847 |
1848 // Used to check class and type arguments. Arguments passed in registers: | 1848 // Used to check class and type arguments. Arguments passed in registers: |
1849 // LR: return address. | 1849 // LR: return address. |
1850 // R0: instance (must be preserved). | 1850 // R0: instance (must be preserved). |
| 1851 // R2: unused. |
1851 // R1: unused. | 1852 // R1: unused. |
1852 // R2: unused. | |
1853 // R3: SubtypeTestCache. | 1853 // R3: SubtypeTestCache. |
1854 // Result in R1: null -> not found, otherwise result (true or false). | 1854 // Result in R1: null -> not found, otherwise result (true or false). |
1855 void StubCode::GenerateSubtype2TestCacheStub(Assembler* assembler) { | 1855 void StubCode::GenerateSubtype2TestCacheStub(Assembler* assembler) { |
1856 GenerateSubtypeNTestCacheStub(assembler, 2); | 1856 GenerateSubtypeNTestCacheStub(assembler, 2); |
1857 } | 1857 } |
1858 | 1858 |
1859 | 1859 |
1860 // Used to check class and type arguments. Arguments passed in registers: | 1860 // Used to check class and type arguments. Arguments passed in registers: |
1861 // LR: return address. | 1861 // LR: return address. |
1862 // R0: instance (must be preserved). | 1862 // R0: instance (must be preserved). |
1863 // R1: instantiator type arguments (can be raw_null). | 1863 // R2: instantiator type arguments (can be raw_null). |
1864 // R2: function type arguments (can be raw_null). | 1864 // R1: function type arguments (can be raw_null). |
1865 // R3: SubtypeTestCache. | 1865 // R3: SubtypeTestCache. |
1866 // Result in R1: null -> not found, otherwise result (true or false). | 1866 // Result in R1: null -> not found, otherwise result (true or false). |
1867 void StubCode::GenerateSubtype4TestCacheStub(Assembler* assembler) { | 1867 void StubCode::GenerateSubtype4TestCacheStub(Assembler* assembler) { |
1868 GenerateSubtypeNTestCacheStub(assembler, 4); | 1868 GenerateSubtypeNTestCacheStub(assembler, 4); |
1869 } | 1869 } |
1870 | 1870 |
1871 | 1871 |
1872 // Return the current stack pointer address, used to do stack alignment checks. | 1872 // Return the current stack pointer address, used to do stack alignment checks. |
1873 void StubCode::GenerateGetStackPointerStub(Assembler* assembler) { | 1873 void StubCode::GenerateGetStackPointerStub(Assembler* assembler) { |
1874 __ mov(R0, Operand(SP)); | 1874 __ mov(R0, Operand(SP)); |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2309 } | 2309 } |
2310 | 2310 |
2311 | 2311 |
2312 void StubCode::GenerateAsynchronousGapMarkerStub(Assembler* assembler) { | 2312 void StubCode::GenerateAsynchronousGapMarkerStub(Assembler* assembler) { |
2313 __ bkpt(0); | 2313 __ bkpt(0); |
2314 } | 2314 } |
2315 | 2315 |
2316 } // namespace dart | 2316 } // namespace dart |
2317 | 2317 |
2318 #endif // defined TARGET_ARCH_ARM | 2318 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |