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