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