Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 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 1749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1760 // TOS + 3: SubtypeTestCache. | 1760 // TOS + 3: SubtypeTestCache. |
| 1761 // Result in RCX: null -> not found, otherwise result (true or false). | 1761 // Result in RCX: null -> not found, otherwise result (true or false). |
| 1762 static void GenerateSubtypeNTestCacheStub(Assembler* assembler, int n) { | 1762 static void GenerateSubtypeNTestCacheStub(Assembler* assembler, int n) { |
| 1763 ASSERT((1 <= n) && (n <= 3)); | 1763 ASSERT((1 <= n) && (n <= 3)); |
| 1764 const Immediate raw_null = | 1764 const Immediate raw_null = |
| 1765 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 1765 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1766 const intptr_t kInstantiatorTypeArgumentsInBytes = 1 * kWordSize; | 1766 const intptr_t kInstantiatorTypeArgumentsInBytes = 1 * kWordSize; |
| 1767 const intptr_t kInstanceOffsetInBytes = 2 * kWordSize; | 1767 const intptr_t kInstanceOffsetInBytes = 2 * kWordSize; |
| 1768 const intptr_t kCacheOffsetInBytes = 3 * kWordSize; | 1768 const intptr_t kCacheOffsetInBytes = 3 * kWordSize; |
| 1769 __ movq(RAX, Address(RSP, kInstanceOffsetInBytes)); | 1769 __ movq(RAX, Address(RSP, kInstanceOffsetInBytes)); |
| 1770 __ LoadClass(R10, RAX); | |
| 1771 // RAX: instance, R10: instance class. | |
| 1772 if (n > 1) { | 1770 if (n > 1) { |
| 1771 __ LoadClass(R10, RAX); | |
| 1773 // Compute instance type arguments into R13. | 1772 // Compute instance type arguments into R13. |
| 1774 Label has_no_type_arguments; | 1773 Label has_no_type_arguments; |
| 1775 __ movq(R13, raw_null); | 1774 __ movq(R13, raw_null); |
| 1776 __ movq(RDI, FieldAddress(R10, | 1775 __ movq(RDI, FieldAddress(R10, |
| 1777 Class::type_arguments_instance_field_offset_offset())); | 1776 Class::type_arguments_instance_field_offset_offset())); |
| 1778 __ cmpq(RDI, Immediate(Class::kNoTypeArguments)); | 1777 __ cmpq(RDI, Immediate(Class::kNoTypeArguments)); |
| 1779 __ j(EQUAL, &has_no_type_arguments, Assembler::kNearJump); | 1778 __ j(EQUAL, &has_no_type_arguments, Assembler::kNearJump); |
| 1780 __ movq(R13, FieldAddress(RAX, RDI, TIMES_1, 0)); | 1779 __ movq(R13, FieldAddress(RAX, RDI, TIMES_1, 0)); |
| 1781 __ Bind(&has_no_type_arguments); | 1780 __ Bind(&has_no_type_arguments); |
| 1782 } | 1781 } |
| 1782 __ LoadClassId(R10, RAX); | |
| 1783 // RAX: instance, R10: instance class id. | |
| 1783 // R13: instance type arguments or null, used only if n > 1. | 1784 // R13: instance type arguments or null, used only if n > 1. |
| 1784 __ movq(RDX, Address(RSP, kCacheOffsetInBytes)); | 1785 __ movq(RDX, Address(RSP, kCacheOffsetInBytes)); |
| 1785 // RDX: SubtypeTestCache. | 1786 // RDX: SubtypeTestCache. |
| 1786 __ movq(RDX, FieldAddress(RDX, SubtypeTestCache::cache_offset())); | 1787 __ movq(RDX, FieldAddress(RDX, SubtypeTestCache::cache_offset())); |
| 1787 __ addq(RDX, Immediate(Array::data_offset() - kHeapObjectTag)); | 1788 __ addq(RDX, Immediate(Array::data_offset() - kHeapObjectTag)); |
| 1788 // RDX: Entry start. | 1789 // RDX: Entry start. |
| 1789 // R10: instance class. | 1790 // R10: instance class id. |
| 1790 // R13: instance type arguments | 1791 // R13: instance type arguments |
|
regis
2012/07/11 01:56:48
period missing
srdjan
2012/07/11 18:00:41
Done.
| |
| 1791 Label loop, found, not_found, next_iteration; | 1792 Label loop, found, not_found, next_iteration; |
| 1793 __ SmiTag(R10); | |
| 1792 __ Bind(&loop); | 1794 __ Bind(&loop); |
| 1793 __ movq(RDI, Address(RDX, kWordSize * SubtypeTestCache::kInstanceClass)); | 1795 __ movq(RDI, Address(RDX, kWordSize * SubtypeTestCache::kInstanceClassId)); |
| 1794 __ cmpq(RDI, raw_null); | 1796 __ cmpq(RDI, raw_null); |
| 1795 __ j(EQUAL, ¬_found, Assembler::kNearJump); | 1797 __ j(EQUAL, ¬_found, Assembler::kNearJump); |
| 1796 __ cmpq(RDI, R10); | 1798 __ cmpq(RDI, R10); |
| 1797 if (n == 1) { | 1799 if (n == 1) { |
| 1798 __ j(EQUAL, &found, Assembler::kNearJump); | 1800 __ j(EQUAL, &found, Assembler::kNearJump); |
| 1799 } else { | 1801 } else { |
| 1800 __ j(NOT_EQUAL, &next_iteration, Assembler::kNearJump); | 1802 __ j(NOT_EQUAL, &next_iteration, Assembler::kNearJump); |
| 1801 __ movq(RDI, | 1803 __ movq(RDI, |
| 1802 Address(RDX, kWordSize * SubtypeTestCache::kInstanceTypeArguments)); | 1804 Address(RDX, kWordSize * SubtypeTestCache::kInstanceTypeArguments)); |
| 1803 __ cmpq(RDI, R13); | 1805 __ cmpq(RDI, R13); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1899 void StubCode::GenerateJumpToErrorHandlerStub(Assembler* assembler) { | 1901 void StubCode::GenerateJumpToErrorHandlerStub(Assembler* assembler) { |
| 1900 __ movq(RAX, RCX); // error object. | 1902 __ movq(RAX, RCX); // error object. |
| 1901 __ movq(RBP, RDX); // target frame_pointer. | 1903 __ movq(RBP, RDX); // target frame_pointer. |
| 1902 __ movq(RSP, RSI); // target stack_pointer. | 1904 __ movq(RSP, RSI); // target stack_pointer. |
| 1903 __ jmp(RDI); // Jump to the exception handler code. | 1905 __ jmp(RDI); // Jump to the exception handler code. |
| 1904 } | 1906 } |
| 1905 | 1907 |
| 1906 } // namespace dart | 1908 } // namespace dart |
| 1907 | 1909 |
| 1908 #endif // defined TARGET_ARCH_X64 | 1910 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |