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 1825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1836 | 1836 |
1837 // Allocates one-byte string of length 'end - start'. The content is not | 1837 // Allocates one-byte string of length 'end - start'. The content is not |
1838 // initialized. | 1838 // initialized. |
1839 // 'length-reg' (R2) contains tagged length. | 1839 // 'length-reg' (R2) contains tagged length. |
1840 // Returns new string as tagged pointer in R0. | 1840 // Returns new string as tagged pointer in R0. |
1841 static void TryAllocateOnebyteString(Assembler* assembler, | 1841 static void TryAllocateOnebyteString(Assembler* assembler, |
1842 Label* ok, | 1842 Label* ok, |
1843 Label* failure) { | 1843 Label* failure) { |
1844 const Register length_reg = R2; | 1844 const Register length_reg = R2; |
1845 Label fail; | 1845 Label fail; |
1846 | 1846 __ MaybeTraceAllocation(kOneByteStringCid, R0, kNoPP, failure); |
1847 __ mov(R6, length_reg); // Save the length register. | 1847 __ mov(R6, length_reg); // Save the length register. |
1848 // TODO(koda): Protect against negative length and overflow here. | 1848 // TODO(koda): Protect against negative length and overflow here. |
1849 __ SmiUntag(length_reg); | 1849 __ SmiUntag(length_reg); |
1850 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; | 1850 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; |
1851 __ AddImmediate(length_reg, length_reg, fixed_size, kNoPP); | 1851 __ AddImmediate(length_reg, length_reg, fixed_size, kNoPP); |
1852 __ andi(length_reg, length_reg, Immediate(~(kObjectAlignment - 1))); | 1852 __ andi(length_reg, length_reg, Immediate(~(kObjectAlignment - 1))); |
1853 | 1853 |
1854 Isolate* isolate = Isolate::Current(); | 1854 Isolate* isolate = Isolate::Current(); |
1855 Heap* heap = isolate->heap(); | 1855 Heap* heap = isolate->heap(); |
1856 const intptr_t cid = kOneByteStringCid; | 1856 const intptr_t cid = kOneByteStringCid; |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2138 Isolate* isolate = Isolate::Current(); | 2138 Isolate* isolate = Isolate::Current(); |
2139 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP); | 2139 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP); |
2140 // Set return value to Isolate::current_tag_. | 2140 // Set return value to Isolate::current_tag_. |
2141 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); | 2141 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); |
2142 __ ret(); | 2142 __ ret(); |
2143 } | 2143 } |
2144 | 2144 |
2145 } // namespace dart | 2145 } // namespace dart |
2146 | 2146 |
2147 #endif // defined TARGET_ARCH_ARM64 | 2147 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |