| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
| 6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 __ b(&fall_through, LT); \ | 193 __ b(&fall_through, LT); \ |
| 194 __ SmiUntag(R2); \ | 194 __ SmiUntag(R2); \ |
| 195 /* Check for maximum allowed length. */ \ | 195 /* Check for maximum allowed length. */ \ |
| 196 /* R2: untagged array length. */ \ | 196 /* R2: untagged array length. */ \ |
| 197 __ CompareImmediate(R2, max_len); \ | 197 __ CompareImmediate(R2, max_len); \ |
| 198 __ b(&fall_through, GT); \ | 198 __ b(&fall_through, GT); \ |
| 199 __ LslImmediate(R2, R2, scale_shift); \ | 199 __ LslImmediate(R2, R2, scale_shift); \ |
| 200 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \ | 200 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \ |
| 201 __ AddImmediate(R2, R2, fixed_size); \ | 201 __ AddImmediate(R2, R2, fixed_size); \ |
| 202 __ andi(R2, R2, Immediate(~(kObjectAlignment - 1))); \ | 202 __ andi(R2, R2, Immediate(~(kObjectAlignment - 1))); \ |
| 203 Heap::Space space = Heap::SpaceForAllocation(cid); \ | 203 Heap::Space space = Heap::kNew; \ |
| 204 __ ldr(R3, Address(THR, Thread::heap_offset())); \ | 204 __ ldr(R3, Address(THR, Thread::heap_offset())); \ |
| 205 __ ldr(R0, Address(R3, Heap::TopOffset(space))); \ | 205 __ ldr(R0, Address(R3, Heap::TopOffset(space))); \ |
| 206 \ | 206 \ |
| 207 /* R2: allocation size. */ \ | 207 /* R2: allocation size. */ \ |
| 208 __ adds(R1, R0, Operand(R2)); \ | 208 __ adds(R1, R0, Operand(R2)); \ |
| 209 __ b(&fall_through, CS); /* Fail on unsigned overflow. */ \ | 209 __ b(&fall_through, CS); /* Fail on unsigned overflow. */ \ |
| 210 \ | 210 \ |
| 211 /* Check if the allocation fits into the remaining space. */ \ | 211 /* Check if the allocation fits into the remaining space. */ \ |
| 212 /* R0: potential new object start. */ \ | 212 /* R0: potential new object start. */ \ |
| 213 /* R1: potential next object start. */ \ | 213 /* R1: potential next object start. */ \ |
| (...skipping 1695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1909 Label fail; | 1909 Label fail; |
| 1910 __ MaybeTraceAllocation(kOneByteStringCid, R0, failure); | 1910 __ MaybeTraceAllocation(kOneByteStringCid, R0, failure); |
| 1911 __ mov(R6, length_reg); // Save the length register. | 1911 __ mov(R6, length_reg); // Save the length register. |
| 1912 // TODO(koda): Protect against negative length and overflow here. | 1912 // TODO(koda): Protect against negative length and overflow here. |
| 1913 __ SmiUntag(length_reg); | 1913 __ SmiUntag(length_reg); |
| 1914 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; | 1914 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; |
| 1915 __ AddImmediate(length_reg, length_reg, fixed_size); | 1915 __ AddImmediate(length_reg, length_reg, fixed_size); |
| 1916 __ andi(length_reg, length_reg, Immediate(~(kObjectAlignment - 1))); | 1916 __ andi(length_reg, length_reg, Immediate(~(kObjectAlignment - 1))); |
| 1917 | 1917 |
| 1918 const intptr_t cid = kOneByteStringCid; | 1918 const intptr_t cid = kOneByteStringCid; |
| 1919 Heap::Space space = Heap::SpaceForAllocation(cid); | 1919 Heap::Space space = Heap::kNew; |
| 1920 __ ldr(R3, Address(THR, Thread::heap_offset())); | 1920 __ ldr(R3, Address(THR, Thread::heap_offset())); |
| 1921 __ ldr(R0, Address(R3, Heap::TopOffset(space))); | 1921 __ ldr(R0, Address(R3, Heap::TopOffset(space))); |
| 1922 | 1922 |
| 1923 // length_reg: allocation size. | 1923 // length_reg: allocation size. |
| 1924 __ adds(R1, R0, Operand(length_reg)); | 1924 __ adds(R1, R0, Operand(length_reg)); |
| 1925 __ b(&fail, CS); // Fail on unsigned overflow. | 1925 __ b(&fail, CS); // Fail on unsigned overflow. |
| 1926 | 1926 |
| 1927 // Check if the allocation fits into the remaining space. | 1927 // Check if the allocation fits into the remaining space. |
| 1928 // R0: potential new object start. | 1928 // R0: potential new object start. |
| 1929 // R1: potential next object start. | 1929 // R1: potential next object start. |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2207 __ cmp(R0, Operand(0)); | 2207 __ cmp(R0, Operand(0)); |
| 2208 __ LoadObject(R0, Bool::False()); | 2208 __ LoadObject(R0, Bool::False()); |
| 2209 __ LoadObject(TMP, Bool::True()); | 2209 __ LoadObject(TMP, Bool::True()); |
| 2210 __ csel(R0, TMP, R0, NE); | 2210 __ csel(R0, TMP, R0, NE); |
| 2211 __ ret(); | 2211 __ ret(); |
| 2212 } | 2212 } |
| 2213 | 2213 |
| 2214 } // namespace dart | 2214 } // namespace dart |
| 2215 | 2215 |
| 2216 #endif // defined TARGET_ARCH_ARM64 | 2216 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |