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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 __ SmiUntag(R2); \ | 184 __ SmiUntag(R2); \ |
185 /* Check for maximum allowed length. */ \ | 185 /* Check for maximum allowed length. */ \ |
186 /* R2: untagged array length. */ \ | 186 /* R2: untagged array length. */ \ |
187 __ CompareImmediate(R2, max_len); \ | 187 __ CompareImmediate(R2, max_len); \ |
188 __ b(&fall_through, GT); \ | 188 __ b(&fall_through, GT); \ |
189 __ LslImmediate(R2, R2, scale_shift); \ | 189 __ LslImmediate(R2, R2, scale_shift); \ |
190 const intptr_t fixed_size_plus_alignment_padding = \ | 190 const intptr_t fixed_size_plus_alignment_padding = \ |
191 sizeof(Raw##type_name) + kObjectAlignment - 1; \ | 191 sizeof(Raw##type_name) + kObjectAlignment - 1; \ |
192 __ AddImmediate(R2, fixed_size_plus_alignment_padding); \ | 192 __ AddImmediate(R2, fixed_size_plus_alignment_padding); \ |
193 __ andi(R2, R2, Immediate(~(kObjectAlignment - 1))); \ | 193 __ andi(R2, R2, Immediate(~(kObjectAlignment - 1))); \ |
194 Heap::Space space = Heap::kNew; \ | 194 NOT_IN_PRODUCT(Heap::Space space = Heap::kNew); \ |
195 __ ldr(R3, Address(THR, Thread::heap_offset())); \ | 195 __ ldr(R0, Address(THR, Thread::top_offset())); \ |
196 __ ldr(R0, Address(R3, Heap::TopOffset(space))); \ | |
197 \ | 196 \ |
198 /* R2: allocation size. */ \ | 197 /* R2: allocation size. */ \ |
199 __ adds(R1, R0, Operand(R2)); \ | 198 __ adds(R1, R0, Operand(R2)); \ |
200 __ b(&fall_through, CS); /* Fail on unsigned overflow. */ \ | 199 __ b(&fall_through, CS); /* Fail on unsigned overflow. */ \ |
201 \ | 200 \ |
202 /* Check if the allocation fits into the remaining space. */ \ | 201 /* Check if the allocation fits into the remaining space. */ \ |
203 /* R0: potential new object start. */ \ | 202 /* R0: potential new object start. */ \ |
204 /* R1: potential next object start. */ \ | 203 /* R1: potential next object start. */ \ |
205 /* R2: allocation size. */ \ | 204 /* R2: allocation size. */ \ |
206 /* R3: heap. */ \ | 205 __ ldr(R6, Address(THR, Thread::end_offset())); \ |
207 __ ldr(R6, Address(R3, Heap::EndOffset(space))); \ | |
208 __ cmp(R1, Operand(R6)); \ | 206 __ cmp(R1, Operand(R6)); \ |
209 __ b(&fall_through, CS); \ | 207 __ b(&fall_through, CS); \ |
210 \ | 208 \ |
211 /* Successfully allocated the object(s), now update top to point to */ \ | 209 /* Successfully allocated the object(s), now update top to point to */ \ |
212 /* next object start and initialize the object. */ \ | 210 /* next object start and initialize the object. */ \ |
213 __ str(R1, Address(R3, Heap::TopOffset(space))); \ | 211 __ str(R1, Address(THR, Thread::top_offset())); \ |
214 __ AddImmediate(R0, kHeapObjectTag); \ | 212 __ AddImmediate(R0, kHeapObjectTag); \ |
215 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, R2, space)); \ | 213 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, R2, space)); \ |
216 /* Initialize the tags. */ \ | 214 /* Initialize the tags. */ \ |
217 /* R0: new object start as a tagged pointer. */ \ | 215 /* R0: new object start as a tagged pointer. */ \ |
218 /* R1: new object end address. */ \ | 216 /* R1: new object end address. */ \ |
219 /* R2: allocation size. */ \ | 217 /* R2: allocation size. */ \ |
220 { \ | 218 { \ |
221 __ CompareImmediate(R2, RawObject::SizeTag::kMaxSizeTag); \ | 219 __ CompareImmediate(R2, RawObject::SizeTag::kMaxSizeTag); \ |
222 __ LslImmediate(R2, R2, RawObject::kSizeTagPos - kObjectAlignmentLog2); \ | 220 __ LslImmediate(R2, R2, RawObject::kSizeTagPos - kObjectAlignmentLog2); \ |
223 __ csel(R2, ZR, R2, HI); \ | 221 __ csel(R2, ZR, R2, HI); \ |
(...skipping 1779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2003 // and cannot be externalized. TODO(erikcorry): We should probably just | 2001 // and cannot be externalized. TODO(erikcorry): We should probably just |
2004 // return a static zero length string here instead. | 2002 // return a static zero length string here instead. |
2005 // length <- (length != 0) ? length : (ZR + 1). | 2003 // length <- (length != 0) ? length : (ZR + 1). |
2006 __ csinc(length_reg, length_reg, ZR, NE); | 2004 __ csinc(length_reg, length_reg, ZR, NE); |
2007 const intptr_t fixed_size_plus_alignment_padding = | 2005 const intptr_t fixed_size_plus_alignment_padding = |
2008 sizeof(RawString) + kObjectAlignment - 1; | 2006 sizeof(RawString) + kObjectAlignment - 1; |
2009 __ AddImmediate(length_reg, fixed_size_plus_alignment_padding); | 2007 __ AddImmediate(length_reg, fixed_size_plus_alignment_padding); |
2010 __ andi(length_reg, length_reg, Immediate(~(kObjectAlignment - 1))); | 2008 __ andi(length_reg, length_reg, Immediate(~(kObjectAlignment - 1))); |
2011 | 2009 |
2012 const intptr_t cid = kOneByteStringCid; | 2010 const intptr_t cid = kOneByteStringCid; |
2013 Heap::Space space = Heap::kNew; | 2011 NOT_IN_PRODUCT(Heap::Space space = Heap::kNew); |
2014 __ ldr(R3, Address(THR, Thread::heap_offset())); | 2012 __ ldr(R0, Address(THR, Thread::top_offset())); |
2015 __ ldr(R0, Address(R3, Heap::TopOffset(space))); | |
2016 | 2013 |
2017 // length_reg: allocation size. | 2014 // length_reg: allocation size. |
2018 __ adds(R1, R0, Operand(length_reg)); | 2015 __ adds(R1, R0, Operand(length_reg)); |
2019 __ b(&fail, CS); // Fail on unsigned overflow. | 2016 __ b(&fail, CS); // Fail on unsigned overflow. |
2020 | 2017 |
2021 // Check if the allocation fits into the remaining space. | 2018 // Check if the allocation fits into the remaining space. |
2022 // R0: potential new object start. | 2019 // R0: potential new object start. |
2023 // R1: potential next object start. | 2020 // R1: potential next object start. |
2024 // R2: allocation size. | 2021 // R2: allocation size. |
2025 // R3: heap. | 2022 __ ldr(R7, Address(THR, Thread::end_offset())); |
2026 __ ldr(R7, Address(R3, Heap::EndOffset(space))); | |
2027 __ cmp(R1, Operand(R7)); | 2023 __ cmp(R1, Operand(R7)); |
2028 __ b(&fail, CS); | 2024 __ b(&fail, CS); |
2029 | 2025 |
2030 // Successfully allocated the object(s), now update top to point to | 2026 // Successfully allocated the object(s), now update top to point to |
2031 // next object start and initialize the object. | 2027 // next object start and initialize the object. |
2032 __ str(R1, Address(R3, Heap::TopOffset(space))); | 2028 __ str(R1, Address(THR, Thread::top_offset())); |
2033 __ AddImmediate(R0, kHeapObjectTag); | 2029 __ AddImmediate(R0, kHeapObjectTag); |
2034 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, R2, space)); | 2030 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, R2, space)); |
2035 | 2031 |
2036 // Initialize the tags. | 2032 // Initialize the tags. |
2037 // R0: new object start as a tagged pointer. | 2033 // R0: new object start as a tagged pointer. |
2038 // R1: new object end address. | 2034 // R1: new object end address. |
2039 // R2: allocation size. | 2035 // R2: allocation size. |
2040 { | 2036 { |
2041 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; | 2037 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; |
2042 | 2038 |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2302 | 2298 |
2303 void Intrinsifier::SetAsyncThreadStackTrace(Assembler* assembler) { | 2299 void Intrinsifier::SetAsyncThreadStackTrace(Assembler* assembler) { |
2304 __ ldr(R0, Address(THR, Thread::async_stack_trace_offset())); | 2300 __ ldr(R0, Address(THR, Thread::async_stack_trace_offset())); |
2305 __ LoadObject(R0, Object::null_object()); | 2301 __ LoadObject(R0, Object::null_object()); |
2306 __ ret(); | 2302 __ ret(); |
2307 } | 2303 } |
2308 | 2304 |
2309 } // namespace dart | 2305 } // namespace dart |
2310 | 2306 |
2311 #endif // defined TARGET_ARCH_ARM64 | 2307 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |