OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
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 1745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1756 | 1756 |
1757 // Allocates one-byte string of length 'end - start'. The content is not | 1757 // Allocates one-byte string of length 'end - start'. The content is not |
1758 // initialized. | 1758 // initialized. |
1759 // 'length-reg' (R2) contains tagged length. | 1759 // 'length-reg' (R2) contains tagged length. |
1760 // Returns new string as tagged pointer in R0. | 1760 // Returns new string as tagged pointer in R0. |
1761 static void TryAllocateOnebyteString(Assembler* assembler, | 1761 static void TryAllocateOnebyteString(Assembler* assembler, |
1762 Label* ok, | 1762 Label* ok, |
1763 Label* failure) { | 1763 Label* failure) { |
1764 const Register length_reg = R2; | 1764 const Register length_reg = R2; |
1765 Label fail; | 1765 Label fail; |
1766 | 1766 __ MaybeTraceAllocation(kOneByteStringCid, R0, failure); |
1767 __ mov(R6, Operand(length_reg)); // Save the length register. | 1767 __ mov(R6, Operand(length_reg)); // Save the length register. |
1768 // TODO(koda): Protect against negative length and overflow here. | 1768 // TODO(koda): Protect against negative length and overflow here. |
1769 __ SmiUntag(length_reg); | 1769 __ SmiUntag(length_reg); |
1770 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; | 1770 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; |
1771 __ AddImmediate(length_reg, fixed_size); | 1771 __ AddImmediate(length_reg, fixed_size); |
1772 __ bic(length_reg, length_reg, Operand(kObjectAlignment - 1)); | 1772 __ bic(length_reg, length_reg, Operand(kObjectAlignment - 1)); |
1773 | 1773 |
1774 Isolate* isolate = Isolate::Current(); | 1774 Isolate* isolate = Isolate::Current(); |
1775 Heap* heap = isolate->heap(); | 1775 Heap* heap = isolate->heap(); |
1776 const intptr_t cid = kOneByteStringCid; | 1776 const intptr_t cid = kOneByteStringCid; |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2061 Isolate* isolate = Isolate::Current(); | 2061 Isolate* isolate = Isolate::Current(); |
2062 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); | 2062 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); |
2063 // Set return value to Isolate::current_tag_. | 2063 // Set return value to Isolate::current_tag_. |
2064 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); | 2064 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); |
2065 __ Ret(); | 2065 __ Ret(); |
2066 } | 2066 } |
2067 | 2067 |
2068 } // namespace dart | 2068 } // namespace dart |
2069 | 2069 |
2070 #endif // defined TARGET_ARCH_ARM | 2070 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |