| 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 __ SmiUntag(R2); \ | 193 __ SmiUntag(R2); \ |
| 194 /* Check for maximum allowed length. */ \ | 194 /* Check for maximum allowed length. */ \ |
| 195 /* R2: untagged array length. */ \ | 195 /* R2: untagged array length. */ \ |
| 196 __ CompareImmediate(R2, max_len); \ | 196 __ CompareImmediate(R2, max_len); \ |
| 197 __ b(&fall_through, GT); \ | 197 __ b(&fall_through, GT); \ |
| 198 __ LslImmediate(R2, R2, scale_shift); \ | 198 __ LslImmediate(R2, R2, scale_shift); \ |
| 199 const intptr_t fixed_size_plus_alignment_padding = \ | 199 const intptr_t fixed_size_plus_alignment_padding = \ |
| 200 sizeof(Raw##type_name) + kObjectAlignment - 1; \ | 200 sizeof(Raw##type_name) + kObjectAlignment - 1; \ |
| 201 __ AddImmediate(R2, fixed_size_plus_alignment_padding); \ | 201 __ AddImmediate(R2, fixed_size_plus_alignment_padding); \ |
| 202 __ andi(R2, R2, Immediate(~(kObjectAlignment - 1))); \ | 202 __ andi(R2, R2, Immediate(~(kObjectAlignment - 1))); \ |
| 203 NOT_IN_PRODUCT(Heap::Space space = Heap::kNew); \ | 203 Heap::Space space = Heap::kNew; \ |
| 204 __ ldr(R0, Address(THR, Thread::top_offset())); \ | 204 __ ldr(R3, Address(THR, Thread::heap_offset())); \ |
| 205 __ ldr(R0, Address(R3, Heap::TopOffset(space))); \ |
| 205 \ | 206 \ |
| 206 /* R2: allocation size. */ \ | 207 /* R2: allocation size. */ \ |
| 207 __ adds(R1, R0, Operand(R2)); \ | 208 __ adds(R1, R0, Operand(R2)); \ |
| 208 __ b(&fall_through, CS); /* Fail on unsigned overflow. */ \ | 209 __ b(&fall_through, CS); /* Fail on unsigned overflow. */ \ |
| 209 \ | 210 \ |
| 210 /* Check if the allocation fits into the remaining space. */ \ | 211 /* Check if the allocation fits into the remaining space. */ \ |
| 211 /* R0: potential new object start. */ \ | 212 /* R0: potential new object start. */ \ |
| 212 /* R1: potential next object start. */ \ | 213 /* R1: potential next object start. */ \ |
| 213 /* R2: allocation size. */ \ | 214 /* R2: allocation size. */ \ |
| 214 __ ldr(R6, Address(THR, Thread::end_offset())); \ | 215 /* R3: heap. */ \ |
| 216 __ ldr(R6, Address(R3, Heap::EndOffset(space))); \ |
| 215 __ cmp(R1, Operand(R6)); \ | 217 __ cmp(R1, Operand(R6)); \ |
| 216 __ b(&fall_through, CS); \ | 218 __ b(&fall_through, CS); \ |
| 217 \ | 219 \ |
| 218 /* Successfully allocated the object(s), now update top to point to */ \ | 220 /* Successfully allocated the object(s), now update top to point to */ \ |
| 219 /* next object start and initialize the object. */ \ | 221 /* next object start and initialize the object. */ \ |
| 220 __ str(R1, Address(THR, Thread::top_offset())); \ | 222 __ str(R1, Address(R3, Heap::TopOffset(space))); \ |
| 221 __ AddImmediate(R0, kHeapObjectTag); \ | 223 __ AddImmediate(R0, kHeapObjectTag); \ |
| 222 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, R2, space)); \ | 224 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, R2, space)); \ |
| 223 /* Initialize the tags. */ \ | 225 /* Initialize the tags. */ \ |
| 224 /* R0: new object start as a tagged pointer. */ \ | 226 /* R0: new object start as a tagged pointer. */ \ |
| 225 /* R1: new object end address. */ \ | 227 /* R1: new object end address. */ \ |
| 226 /* R2: allocation size. */ \ | 228 /* R2: allocation size. */ \ |
| 227 { \ | 229 { \ |
| 228 __ CompareImmediate(R2, RawObject::SizeTag::kMaxSizeTag); \ | 230 __ CompareImmediate(R2, RawObject::SizeTag::kMaxSizeTag); \ |
| 229 __ LslImmediate(R2, R2, RawObject::kSizeTagPos - kObjectAlignmentLog2); \ | 231 __ LslImmediate(R2, R2, RawObject::kSizeTagPos - kObjectAlignmentLog2); \ |
| 230 __ csel(R2, ZR, R2, HI); \ | 232 __ csel(R2, ZR, R2, HI); \ |
| (...skipping 1855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2086 // and cannot be externalized. TODO(erikcorry): We should probably just | 2088 // and cannot be externalized. TODO(erikcorry): We should probably just |
| 2087 // return a static zero length string here instead. | 2089 // return a static zero length string here instead. |
| 2088 // length <- (length != 0) ? length : (ZR + 1). | 2090 // length <- (length != 0) ? length : (ZR + 1). |
| 2089 __ csinc(length_reg, length_reg, ZR, NE); | 2091 __ csinc(length_reg, length_reg, ZR, NE); |
| 2090 const intptr_t fixed_size_plus_alignment_padding = | 2092 const intptr_t fixed_size_plus_alignment_padding = |
| 2091 sizeof(RawString) + kObjectAlignment - 1; | 2093 sizeof(RawString) + kObjectAlignment - 1; |
| 2092 __ AddImmediate(length_reg, fixed_size_plus_alignment_padding); | 2094 __ AddImmediate(length_reg, fixed_size_plus_alignment_padding); |
| 2093 __ andi(length_reg, length_reg, Immediate(~(kObjectAlignment - 1))); | 2095 __ andi(length_reg, length_reg, Immediate(~(kObjectAlignment - 1))); |
| 2094 | 2096 |
| 2095 const intptr_t cid = kOneByteStringCid; | 2097 const intptr_t cid = kOneByteStringCid; |
| 2096 NOT_IN_PRODUCT(Heap::Space space = Heap::kNew); | 2098 Heap::Space space = Heap::kNew; |
| 2097 __ ldr(R0, Address(THR, Thread::top_offset())); | 2099 __ ldr(R3, Address(THR, Thread::heap_offset())); |
| 2100 __ ldr(R0, Address(R3, Heap::TopOffset(space))); |
| 2098 | 2101 |
| 2099 // length_reg: allocation size. | 2102 // length_reg: allocation size. |
| 2100 __ adds(R1, R0, Operand(length_reg)); | 2103 __ adds(R1, R0, Operand(length_reg)); |
| 2101 __ b(&fail, CS); // Fail on unsigned overflow. | 2104 __ b(&fail, CS); // Fail on unsigned overflow. |
| 2102 | 2105 |
| 2103 // Check if the allocation fits into the remaining space. | 2106 // Check if the allocation fits into the remaining space. |
| 2104 // R0: potential new object start. | 2107 // R0: potential new object start. |
| 2105 // R1: potential next object start. | 2108 // R1: potential next object start. |
| 2106 // R2: allocation size. | 2109 // R2: allocation size. |
| 2107 __ ldr(R7, Address(THR, Thread::end_offset())); | 2110 // R3: heap. |
| 2111 __ ldr(R7, Address(R3, Heap::EndOffset(space))); |
| 2108 __ cmp(R1, Operand(R7)); | 2112 __ cmp(R1, Operand(R7)); |
| 2109 __ b(&fail, CS); | 2113 __ b(&fail, CS); |
| 2110 | 2114 |
| 2111 // Successfully allocated the object(s), now update top to point to | 2115 // Successfully allocated the object(s), now update top to point to |
| 2112 // next object start and initialize the object. | 2116 // next object start and initialize the object. |
| 2113 __ str(R1, Address(THR, Thread::top_offset())); | 2117 __ str(R1, Address(R3, Heap::TopOffset(space))); |
| 2114 __ AddImmediate(R0, kHeapObjectTag); | 2118 __ AddImmediate(R0, kHeapObjectTag); |
| 2115 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, R2, space)); | 2119 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, R2, space)); |
| 2116 | 2120 |
| 2117 // Initialize the tags. | 2121 // Initialize the tags. |
| 2118 // R0: new object start as a tagged pointer. | 2122 // R0: new object start as a tagged pointer. |
| 2119 // R1: new object end address. | 2123 // R1: new object end address. |
| 2120 // R2: allocation size. | 2124 // R2: allocation size. |
| 2121 { | 2125 { |
| 2122 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; | 2126 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; |
| 2123 | 2127 |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2396 | 2400 |
| 2397 void Intrinsifier::SetAsyncThreadStackTrace(Assembler* assembler) { | 2401 void Intrinsifier::SetAsyncThreadStackTrace(Assembler* assembler) { |
| 2398 __ ldr(R0, Address(THR, Thread::async_stack_trace_offset())); | 2402 __ ldr(R0, Address(THR, Thread::async_stack_trace_offset())); |
| 2399 __ LoadObject(R0, Object::null_object()); | 2403 __ LoadObject(R0, Object::null_object()); |
| 2400 __ ret(); | 2404 __ ret(); |
| 2401 } | 2405 } |
| 2402 | 2406 |
| 2403 } // namespace dart | 2407 } // namespace dart |
| 2404 | 2408 |
| 2405 #endif // defined TARGET_ARCH_ARM64 | 2409 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |