Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/assembler_macros.h" | 9 #include "vm/assembler_macros.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 1791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1802 // TOS + 3: SubtypeTestCache. | 1802 // TOS + 3: SubtypeTestCache. |
| 1803 // Result in ECX: null -> not found, otherwise result (true or false). | 1803 // Result in ECX: null -> not found, otherwise result (true or false). |
| 1804 static void GenerateSubtypeNTestCacheStub(Assembler* assembler, int n) { | 1804 static void GenerateSubtypeNTestCacheStub(Assembler* assembler, int n) { |
| 1805 ASSERT((1 <= n) && (n <= 3)); | 1805 ASSERT((1 <= n) && (n <= 3)); |
| 1806 const intptr_t kInstantiatorTypeArgumentsInBytes = 1 * kWordSize; | 1806 const intptr_t kInstantiatorTypeArgumentsInBytes = 1 * kWordSize; |
| 1807 const intptr_t kInstanceOffsetInBytes = 2 * kWordSize; | 1807 const intptr_t kInstanceOffsetInBytes = 2 * kWordSize; |
| 1808 const intptr_t kCacheOffsetInBytes = 3 * kWordSize; | 1808 const intptr_t kCacheOffsetInBytes = 3 * kWordSize; |
| 1809 const Immediate raw_null = | 1809 const Immediate raw_null = |
| 1810 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 1810 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1811 __ movl(EAX, Address(ESP, kInstanceOffsetInBytes)); | 1811 __ movl(EAX, Address(ESP, kInstanceOffsetInBytes)); |
| 1812 __ LoadClass(ECX, EAX, EBX); | |
| 1813 // EAX: instance, ECX: instance-class. | |
| 1814 // Get instance type arguments | |
| 1815 if (n > 1) { | 1812 if (n > 1) { |
| 1813 // Get instance type arguments | |
|
regis
2012/07/11 01:56:48
period missing
srdjan
2012/07/11 18:00:41
Done.
| |
| 1814 __ LoadClass(ECX, EAX, EBX); | |
| 1816 // Compute instance type arguments into EBX. | 1815 // Compute instance type arguments into EBX. |
| 1817 Label has_no_type_arguments; | 1816 Label has_no_type_arguments; |
| 1818 __ movl(EBX, raw_null); | 1817 __ movl(EBX, raw_null); |
| 1819 __ movl(EDI, FieldAddress(ECX, | 1818 __ movl(EDI, FieldAddress(ECX, |
| 1820 Class::type_arguments_instance_field_offset_offset())); | 1819 Class::type_arguments_instance_field_offset_offset())); |
| 1821 __ cmpl(EDI, Immediate(Class::kNoTypeArguments)); | 1820 __ cmpl(EDI, Immediate(Class::kNoTypeArguments)); |
| 1822 __ j(EQUAL, &has_no_type_arguments, Assembler::kNearJump); | 1821 __ j(EQUAL, &has_no_type_arguments, Assembler::kNearJump); |
| 1823 __ movl(EBX, FieldAddress(EAX, EDI, TIMES_1, 0)); | 1822 __ movl(EBX, FieldAddress(EAX, EDI, TIMES_1, 0)); |
| 1824 __ Bind(&has_no_type_arguments); | 1823 __ Bind(&has_no_type_arguments); |
| 1825 } | 1824 } |
| 1825 __ LoadClassId(ECX, EAX); | |
| 1826 // EAX: instance, ECX: instance class id. | |
| 1826 // EBX: instance type arguments (null if none), used only if n > 1. | 1827 // EBX: instance type arguments (null if none), used only if n > 1. |
| 1827 __ movl(EDX, Address(ESP, kCacheOffsetInBytes)); | 1828 __ movl(EDX, Address(ESP, kCacheOffsetInBytes)); |
| 1828 // EDX: SubtypeTestCache. | 1829 // EDX: SubtypeTestCache. |
| 1829 __ movl(EDX, FieldAddress(EDX, SubtypeTestCache::cache_offset())); | 1830 __ movl(EDX, FieldAddress(EDX, SubtypeTestCache::cache_offset())); |
| 1830 __ addl(EDX, Immediate(Array::data_offset() - kHeapObjectTag)); | 1831 __ addl(EDX, Immediate(Array::data_offset() - kHeapObjectTag)); |
| 1831 | 1832 |
| 1832 Label loop, found, not_found, next_iteration; | 1833 Label loop, found, not_found, next_iteration; |
| 1833 // EDX: Entry start. | 1834 // EDX: Entry start. |
| 1834 // ECX: instance class. | 1835 // ECX: instance class id. |
| 1835 // EBX: instance type arguments | 1836 // EBX: instance type arguments |
|
regis
2012/07/11 01:56:48
period missing
srdjan
2012/07/11 18:00:41
Done.
| |
| 1837 __ SmiTag(ECX); | |
| 1836 __ Bind(&loop); | 1838 __ Bind(&loop); |
| 1837 __ movl(EDI, Address(EDX, kWordSize * SubtypeTestCache::kInstanceClass)); | 1839 __ movl(EDI, Address(EDX, kWordSize * SubtypeTestCache::kInstanceClassId)); |
| 1838 __ cmpl(EDI, raw_null); | 1840 __ cmpl(EDI, raw_null); |
| 1839 __ j(EQUAL, ¬_found, Assembler::kNearJump); | 1841 __ j(EQUAL, ¬_found, Assembler::kNearJump); |
| 1840 __ cmpl(EDI, ECX); | 1842 __ cmpl(EDI, ECX); |
| 1841 if (n == 1) { | 1843 if (n == 1) { |
| 1842 __ j(EQUAL, &found, Assembler::kNearJump); | 1844 __ j(EQUAL, &found, Assembler::kNearJump); |
| 1843 } else { | 1845 } else { |
| 1844 __ j(NOT_EQUAL, &next_iteration, Assembler::kNearJump); | 1846 __ j(NOT_EQUAL, &next_iteration, Assembler::kNearJump); |
| 1845 __ movl(EDI, | 1847 __ movl(EDI, |
| 1846 Address(EDX, kWordSize * SubtypeTestCache::kInstanceTypeArguments)); | 1848 Address(EDX, kWordSize * SubtypeTestCache::kInstanceTypeArguments)); |
| 1847 __ cmpl(EDI, EBX); | 1849 __ cmpl(EDI, EBX); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1944 __ movl(EAX, Address(ESP, 4 * kWordSize)); // Load error object. | 1946 __ movl(EAX, Address(ESP, 4 * kWordSize)); // Load error object. |
| 1945 __ movl(EBP, Address(ESP, 3 * kWordSize)); // Load target frame_pointer. | 1947 __ movl(EBP, Address(ESP, 3 * kWordSize)); // Load target frame_pointer. |
| 1946 __ movl(EBX, Address(ESP, 1 * kWordSize)); // Load target PC into EBX. | 1948 __ movl(EBX, Address(ESP, 1 * kWordSize)); // Load target PC into EBX. |
| 1947 __ movl(ESP, Address(ESP, 2 * kWordSize)); // Load target stack_pointer. | 1949 __ movl(ESP, Address(ESP, 2 * kWordSize)); // Load target stack_pointer. |
| 1948 __ jmp(EBX); // Jump to the exception handler code. | 1950 __ jmp(EBX); // Jump to the exception handler code. |
| 1949 } | 1951 } |
| 1950 | 1952 |
| 1951 } // namespace dart | 1953 } // namespace dart |
| 1952 | 1954 |
| 1953 #endif // defined TARGET_ARCH_IA32 | 1955 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |