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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 __ mov(R2, Operand(R2, LSL, scale_shift)); \ | 203 __ mov(R2, Operand(R2, LSL, scale_shift)); \ |
204 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \ | 204 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \ |
205 __ AddImmediate(R2, fixed_size); \ | 205 __ AddImmediate(R2, fixed_size); \ |
206 __ bic(R2, R2, Operand(kObjectAlignment - 1)); \ | 206 __ bic(R2, R2, Operand(kObjectAlignment - 1)); \ |
207 Heap* heap = Isolate::Current()->heap(); \ | 207 Heap* heap = Isolate::Current()->heap(); \ |
208 Heap::Space space = heap->SpaceForAllocation(cid); \ | 208 Heap::Space space = heap->SpaceForAllocation(cid); \ |
209 __ LoadImmediate(R0, heap->TopAddress(space)); \ | 209 __ LoadImmediate(R0, heap->TopAddress(space)); \ |
210 __ ldr(R0, Address(R0, 0)); \ | 210 __ ldr(R0, Address(R0, 0)); \ |
211 \ | 211 \ |
212 /* R2: allocation size. */ \ | 212 /* R2: allocation size. */ \ |
213 __ add(R1, R0, Operand(R2)); \ | 213 __ add(R1, R0, Operand(R2)); \ |
zra
2015/04/21 14:55:27
adds
koda
2015/04/21 16:08:46
Done.
| |
214 __ b(&fall_through, VS); \ | 214 __ b(&fall_through, CS); /* Fail on unsigned overflow. */ \ |
215 \ | 215 \ |
216 /* Check if the allocation fits into the remaining space. */ \ | 216 /* Check if the allocation fits into the remaining space. */ \ |
217 /* R0: potential new object start. */ \ | 217 /* R0: potential new object start. */ \ |
218 /* R1: potential next object start. */ \ | 218 /* R1: potential next object start. */ \ |
219 /* R2: allocation size. */ \ | 219 /* R2: allocation size. */ \ |
220 __ LoadImmediate(R3, heap->EndAddress(space)); \ | 220 __ LoadImmediate(R3, heap->EndAddress(space)); \ |
221 __ ldr(R3, Address(R3, 0)); \ | 221 __ ldr(R3, Address(R3, 0)); \ |
222 __ cmp(R1, Operand(R3)); \ | 222 __ cmp(R1, Operand(R3)); \ |
223 __ b(&fall_through, CS); \ | 223 __ b(&fall_through, CS); \ |
224 \ | 224 \ |
(...skipping 1421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1646 // initialized. | 1646 // initialized. |
1647 // 'length-reg' (R2) contains tagged length. | 1647 // 'length-reg' (R2) contains tagged length. |
1648 // Returns new string as tagged pointer in R0. | 1648 // Returns new string as tagged pointer in R0. |
1649 static void TryAllocateOnebyteString(Assembler* assembler, | 1649 static void TryAllocateOnebyteString(Assembler* assembler, |
1650 Label* ok, | 1650 Label* ok, |
1651 Label* failure) { | 1651 Label* failure) { |
1652 const Register length_reg = R2; | 1652 const Register length_reg = R2; |
1653 Label fail; | 1653 Label fail; |
1654 | 1654 |
1655 __ mov(R6, Operand(length_reg)); // Save the length register. | 1655 __ mov(R6, Operand(length_reg)); // Save the length register. |
1656 // TODO(koda): Protect against negative length and overflow here. | |
1656 __ SmiUntag(length_reg); | 1657 __ SmiUntag(length_reg); |
1657 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; | 1658 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; |
1658 __ AddImmediate(length_reg, fixed_size); | 1659 __ AddImmediate(length_reg, fixed_size); |
1659 __ bic(length_reg, length_reg, Operand(kObjectAlignment - 1)); | 1660 __ bic(length_reg, length_reg, Operand(kObjectAlignment - 1)); |
1660 | 1661 |
1661 Isolate* isolate = Isolate::Current(); | 1662 Isolate* isolate = Isolate::Current(); |
1662 Heap* heap = isolate->heap(); | 1663 Heap* heap = isolate->heap(); |
1663 const intptr_t cid = kOneByteStringCid; | 1664 const intptr_t cid = kOneByteStringCid; |
1664 Heap::Space space = heap->SpaceForAllocation(cid); | 1665 Heap::Space space = heap->SpaceForAllocation(cid); |
1665 __ LoadImmediate(R3, heap->TopAddress(space)); | 1666 __ LoadImmediate(R3, heap->TopAddress(space)); |
1666 __ ldr(R0, Address(R3, 0)); | 1667 __ ldr(R0, Address(R3, 0)); |
1667 | 1668 |
1668 // length_reg: allocation size. | 1669 // length_reg: allocation size. |
1669 __ adds(R1, R0, Operand(length_reg)); | 1670 __ adds(R1, R0, Operand(length_reg)); |
1670 __ b(&fail, VS); // Fail on overflow. | 1671 __ b(&fail, CS); // Fail on unsigned overflow. |
1671 | 1672 |
1672 // Check if the allocation fits into the remaining space. | 1673 // Check if the allocation fits into the remaining space. |
1673 // R0: potential new object start. | 1674 // R0: potential new object start. |
1674 // R1: potential next object start. | 1675 // R1: potential next object start. |
1675 // R2: allocation size. | 1676 // R2: allocation size. |
1676 // R3: heap->TopAddress(space). | 1677 // R3: heap->TopAddress(space). |
1677 __ LoadImmediate(R7, heap->EndAddress(space)); | 1678 __ LoadImmediate(R7, heap->EndAddress(space)); |
1678 __ ldr(R7, Address(R7, 0)); | 1679 __ ldr(R7, Address(R7, 0)); |
1679 __ cmp(R1, Operand(R7)); | 1680 __ cmp(R1, Operand(R7)); |
1680 __ b(&fail, CS); | 1681 __ b(&fail, CS); |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1946 Isolate* isolate = Isolate::Current(); | 1947 Isolate* isolate = Isolate::Current(); |
1947 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); | 1948 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); |
1948 // Set return value to Isolate::current_tag_. | 1949 // Set return value to Isolate::current_tag_. |
1949 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); | 1950 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); |
1950 __ Ret(); | 1951 __ Ret(); |
1951 } | 1952 } |
1952 | 1953 |
1953 } // namespace dart | 1954 } // namespace dart |
1954 | 1955 |
1955 #endif // defined TARGET_ARCH_ARM | 1956 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |