Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(579)

Side by Side Diff: runtime/vm/stub_code_ia32.cc

Issue 10414026: Started porting inlined type checks to x64 (will be the future pattern for other architectures). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/stub_code_x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/code_generator.h" 10 #include "vm/code_generator.h"
(...skipping 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after
1794 // TOS + 2: instance. 1794 // TOS + 2: instance.
1795 // TOS + 3: SubtypeTestCache. 1795 // TOS + 3: SubtypeTestCache.
1796 // Result in ECX: null -> not found, otherwise result (true or false). 1796 // Result in ECX: null -> not found, otherwise result (true or false).
1797 static void GenerateSubtypeNTestCacheStub(Assembler* assembler, int n) { 1797 static void GenerateSubtypeNTestCacheStub(Assembler* assembler, int n) {
1798 ASSERT((1 <= n) && (n <= 3)); 1798 ASSERT((1 <= n) && (n <= 3));
1799 const intptr_t kInstantiatorTypeArgumentsInBytes = 1 * kWordSize; 1799 const intptr_t kInstantiatorTypeArgumentsInBytes = 1 * kWordSize;
1800 const intptr_t kInstanceOffsetInBytes = 2 * kWordSize; 1800 const intptr_t kInstanceOffsetInBytes = 2 * kWordSize;
1801 const intptr_t kCacheOffsetInBytes = 3 * kWordSize; 1801 const intptr_t kCacheOffsetInBytes = 3 * kWordSize;
1802 const Immediate raw_null = 1802 const Immediate raw_null =
1803 Immediate(reinterpret_cast<intptr_t>(Object::null())); 1803 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1804 Label not_found;
1805 __ movl(EAX, Address(ESP, kInstanceOffsetInBytes)); 1804 __ movl(EAX, Address(ESP, kInstanceOffsetInBytes));
1806 __ movl(ECX, FieldAddress(EAX, Object::class_offset())); 1805 __ movl(ECX, FieldAddress(EAX, Object::class_offset()));
1807 // EAX: instance, ECX: instance-class. 1806 // EAX: instance, ECX: instance-class.
1808 // Get instance type arguments 1807 // Get instance type arguments
1809 if (n > 1) { 1808 if (n > 1) {
1810 // Compute instance type arguments into EBX. 1809 // Compute instance type arguments into EBX.
1811 Label has_no_type_arguments; 1810 Label has_no_type_arguments;
1812 __ movl(EBX, raw_null); 1811 __ movl(EBX, raw_null);
1813 __ movl(EDI, FieldAddress(ECX, 1812 __ movl(EDI, FieldAddress(ECX,
1814 Class::type_arguments_instance_field_offset_offset())); 1813 Class::type_arguments_instance_field_offset_offset()));
1815 __ cmpl(EDI, Immediate(Class::kNoTypeArguments)); 1814 __ cmpl(EDI, Immediate(Class::kNoTypeArguments));
1816 __ j(EQUAL, &has_no_type_arguments, Assembler::kNearJump); 1815 __ j(EQUAL, &has_no_type_arguments, Assembler::kNearJump);
1817 __ movl(EBX, FieldAddress(EAX, EDI, TIMES_1, 0)); 1816 __ movl(EBX, FieldAddress(EAX, EDI, TIMES_1, 0));
1818 __ Bind(&has_no_type_arguments); 1817 __ Bind(&has_no_type_arguments);
1819 } 1818 }
1820 // EBX: instance type arguments (null if none). 1819 // EBX: instance type arguments (null if none), used only if n > 1.
1821 __ movl(EDX, Address(ESP, kCacheOffsetInBytes)); 1820 __ movl(EDX, Address(ESP, kCacheOffsetInBytes));
1822 // EDX: SubtypeTestCache. 1821 // EDX: SubtypeTestCache.
1823 __ movl(EDX, FieldAddress(EDX, SubtypeTestCache::cache_offset())); 1822 __ movl(EDX, FieldAddress(EDX, SubtypeTestCache::cache_offset()));
1824 __ addl(EDX, Immediate(Array::data_offset() - kHeapObjectTag)); 1823 __ addl(EDX, Immediate(Array::data_offset() - kHeapObjectTag));
1825 1824
1826 Label loop, found, next_iteration; 1825 Label loop, found, not_found, next_iteration;
1827 // EDX: Entry start. 1826 // EDX: Entry start.
1828 // ECX: instance class. 1827 // ECX: instance class.
1829 // EBX: instance type arguments 1828 // EBX: instance type arguments
1830 __ Bind(&loop); 1829 __ Bind(&loop);
1831 __ movl(EDI, Address(EDX, kWordSize * SubtypeTestCache::kInstanceClass)); 1830 __ movl(EDI, Address(EDX, kWordSize * SubtypeTestCache::kInstanceClass));
1832 __ cmpl(EDI, raw_null); 1831 __ cmpl(EDI, raw_null);
1833 __ j(EQUAL, &not_found, Assembler::kNearJump); 1832 __ j(EQUAL, &not_found, Assembler::kNearJump);
1834 __ cmpl(EDI, ECX); 1833 __ cmpl(EDI, ECX);
1835 if (n == 1) { 1834 if (n == 1) {
1836 __ j(EQUAL, &found, Assembler::kNearJump); 1835 __ j(EQUAL, &found, Assembler::kNearJump);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1892 // TOS + 2: instance. 1891 // TOS + 2: instance.
1893 // TOS + 3: cache array. 1892 // TOS + 3: cache array.
1894 // Result in ECX: null -> not found, otherwise result (true or false). 1893 // Result in ECX: null -> not found, otherwise result (true or false).
1895 void StubCode::GenerateSubtype3TestCacheStub(Assembler* assembler) { 1894 void StubCode::GenerateSubtype3TestCacheStub(Assembler* assembler) {
1896 GenerateSubtypeNTestCacheStub(assembler, 3); 1895 GenerateSubtypeNTestCacheStub(assembler, 3);
1897 } 1896 }
1898 1897
1899 } // namespace dart 1898 } // namespace dart
1900 1899
1901 #endif // defined TARGET_ARCH_IA32 1900 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/stub_code_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698