| 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" // Needed here to get TARGET_ARCH_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/intrinsifier.h" | 8 #include "vm/intrinsifier.h" |
| 9 | 9 |
| 10 #include "vm/assembler.h" | 10 #include "vm/assembler.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 /* Special case for scaling by 16. */ \ | 169 /* Special case for scaling by 16. */ \ |
| 170 if (scale_factor == TIMES_16) { \ | 170 if (scale_factor == TIMES_16) { \ |
| 171 /* double length of array. */ \ | 171 /* double length of array. */ \ |
| 172 __ addq(RDI, RDI); \ | 172 __ addq(RDI, RDI); \ |
| 173 /* only scale by 8. */ \ | 173 /* only scale by 8. */ \ |
| 174 scale_factor = TIMES_8; \ | 174 scale_factor = TIMES_8; \ |
| 175 } \ | 175 } \ |
| 176 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \ | 176 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \ |
| 177 __ leaq(RDI, Address(RDI, scale_factor, fixed_size)); \ | 177 __ leaq(RDI, Address(RDI, scale_factor, fixed_size)); \ |
| 178 __ andq(RDI, Immediate(-kObjectAlignment)); \ | 178 __ andq(RDI, Immediate(-kObjectAlignment)); \ |
| 179 Heap::Space space = Heap::SpaceForAllocation(cid); \ | 179 Heap::Space space = Heap::kNew; \ |
| 180 __ movq(R13, Address(THR, Thread::heap_offset())); \ | 180 __ movq(R13, Address(THR, Thread::heap_offset())); \ |
| 181 __ movq(RAX, Address(R13, Heap::TopOffset(space))); \ | 181 __ movq(RAX, Address(R13, Heap::TopOffset(space))); \ |
| 182 __ movq(RCX, RAX); \ | 182 __ movq(RCX, RAX); \ |
| 183 \ | 183 \ |
| 184 /* RDI: allocation size. */ \ | 184 /* RDI: allocation size. */ \ |
| 185 __ addq(RCX, RDI); \ | 185 __ addq(RCX, RDI); \ |
| 186 __ j(CARRY, &fall_through); \ | 186 __ j(CARRY, &fall_through); \ |
| 187 \ | 187 \ |
| 188 /* Check if the allocation fits into the remaining space. */ \ | 188 /* Check if the allocation fits into the remaining space. */ \ |
| 189 /* RAX: potential new object start. */ \ | 189 /* RAX: potential new object start. */ \ |
| (...skipping 1641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1831 __ movq(RDI, length_reg); | 1831 __ movq(RDI, length_reg); |
| 1832 } | 1832 } |
| 1833 Label pop_and_fail; | 1833 Label pop_and_fail; |
| 1834 __ pushq(RDI); // Preserve length. | 1834 __ pushq(RDI); // Preserve length. |
| 1835 __ SmiUntag(RDI); | 1835 __ SmiUntag(RDI); |
| 1836 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; | 1836 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; |
| 1837 __ leaq(RDI, Address(RDI, TIMES_1, fixed_size)); // RDI is a Smi. | 1837 __ leaq(RDI, Address(RDI, TIMES_1, fixed_size)); // RDI is a Smi. |
| 1838 __ andq(RDI, Immediate(-kObjectAlignment)); | 1838 __ andq(RDI, Immediate(-kObjectAlignment)); |
| 1839 | 1839 |
| 1840 const intptr_t cid = kOneByteStringCid; | 1840 const intptr_t cid = kOneByteStringCid; |
| 1841 Heap::Space space = Heap::SpaceForAllocation(cid); | 1841 Heap::Space space = Heap::kNew; |
| 1842 __ movq(R13, Address(THR, Thread::heap_offset())); | 1842 __ movq(R13, Address(THR, Thread::heap_offset())); |
| 1843 __ movq(RAX, Address(R13, Heap::TopOffset(space))); | 1843 __ movq(RAX, Address(R13, Heap::TopOffset(space))); |
| 1844 | 1844 |
| 1845 // RDI: allocation size. | 1845 // RDI: allocation size. |
| 1846 __ movq(RCX, RAX); | 1846 __ movq(RCX, RAX); |
| 1847 __ addq(RCX, RDI); | 1847 __ addq(RCX, RDI); |
| 1848 __ j(CARRY, &pop_and_fail); | 1848 __ j(CARRY, &pop_and_fail); |
| 1849 | 1849 |
| 1850 // Check if the allocation fits into the remaining space. | 1850 // Check if the allocation fits into the remaining space. |
| 1851 // RAX: potential new object start. | 1851 // RAX: potential new object start. |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2119 __ Bind(&true_label); | 2119 __ Bind(&true_label); |
| 2120 __ LoadObject(RAX, Bool::True()); | 2120 __ LoadObject(RAX, Bool::True()); |
| 2121 __ ret(); | 2121 __ ret(); |
| 2122 } | 2122 } |
| 2123 | 2123 |
| 2124 #undef __ | 2124 #undef __ |
| 2125 | 2125 |
| 2126 } // namespace dart | 2126 } // namespace dart |
| 2127 | 2127 |
| 2128 #endif // defined TARGET_ARCH_X64 | 2128 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |