Chromium Code Reviews| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 213 __ LslImmediate(R2, R2, scale_shift); \ | 213 __ LslImmediate(R2, R2, scale_shift); \ |
| 214 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \ | 214 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \ |
| 215 __ AddImmediate(R2, R2, fixed_size, kNoPP); \ | 215 __ AddImmediate(R2, R2, fixed_size, kNoPP); \ |
| 216 __ andi(R2, R2, Immediate(~(kObjectAlignment - 1))); \ | 216 __ andi(R2, R2, Immediate(~(kObjectAlignment - 1))); \ |
| 217 Heap* heap = Isolate::Current()->heap(); \ | 217 Heap* heap = Isolate::Current()->heap(); \ |
| 218 Heap::Space space = heap->SpaceForAllocation(cid); \ | 218 Heap::Space space = heap->SpaceForAllocation(cid); \ |
| 219 __ LoadImmediate(R0, heap->TopAddress(space), kNoPP); \ | 219 __ LoadImmediate(R0, heap->TopAddress(space), kNoPP); \ |
| 220 __ ldr(R0, Address(R0, 0)); \ | 220 __ ldr(R0, Address(R0, 0)); \ |
| 221 \ | 221 \ |
| 222 /* R2: allocation size. */ \ | 222 /* R2: allocation size. */ \ |
| 223 __ add(R1, R0, Operand(R2)); \ | 223 __ add(R1, R0, Operand(R2)); \ |
|
zra
2015/04/21 14:55:27
adds
koda
2015/04/21 16:08:46
Done.
| |
| 224 __ b(&fall_through, VS); \ | 224 __ b(&fall_through, CS); /* Fail on unsigned overflow. */ \ |
| 225 \ | 225 \ |
| 226 /* Check if the allocation fits into the remaining space. */ \ | 226 /* Check if the allocation fits into the remaining space. */ \ |
| 227 /* R0: potential new object start. */ \ | 227 /* R0: potential new object start. */ \ |
| 228 /* R1: potential next object start. */ \ | 228 /* R1: potential next object start. */ \ |
| 229 /* R2: allocation size. */ \ | 229 /* R2: allocation size. */ \ |
| 230 __ LoadImmediate(R3, heap->EndAddress(space), kNoPP); \ | 230 __ LoadImmediate(R3, heap->EndAddress(space), kNoPP); \ |
| 231 __ ldr(R3, Address(R3, 0)); \ | 231 __ ldr(R3, Address(R3, 0)); \ |
| 232 __ cmp(R1, Operand(R3)); \ | 232 __ cmp(R1, Operand(R3)); \ |
| 233 __ b(&fall_through, CS); \ | 233 __ b(&fall_through, CS); \ |
| 234 \ | 234 \ |
| (...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1723 // initialized. | 1723 // initialized. |
| 1724 // 'length-reg' (R2) contains tagged length. | 1724 // 'length-reg' (R2) contains tagged length. |
| 1725 // Returns new string as tagged pointer in R0. | 1725 // Returns new string as tagged pointer in R0. |
| 1726 static void TryAllocateOnebyteString(Assembler* assembler, | 1726 static void TryAllocateOnebyteString(Assembler* assembler, |
| 1727 Label* ok, | 1727 Label* ok, |
| 1728 Label* failure) { | 1728 Label* failure) { |
| 1729 const Register length_reg = R2; | 1729 const Register length_reg = R2; |
| 1730 Label fail; | 1730 Label fail; |
| 1731 | 1731 |
| 1732 __ mov(R6, length_reg); // Save the length register. | 1732 __ mov(R6, length_reg); // Save the length register. |
| 1733 // TODO(koda): Protect against negative length and overflow here. | |
| 1733 __ SmiUntag(length_reg); | 1734 __ SmiUntag(length_reg); |
| 1734 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; | 1735 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; |
| 1735 __ AddImmediate(length_reg, length_reg, fixed_size, kNoPP); | 1736 __ AddImmediate(length_reg, length_reg, fixed_size, kNoPP); |
| 1736 __ andi(length_reg, length_reg, Immediate(~(kObjectAlignment - 1))); | 1737 __ andi(length_reg, length_reg, Immediate(~(kObjectAlignment - 1))); |
| 1737 | 1738 |
| 1738 Isolate* isolate = Isolate::Current(); | 1739 Isolate* isolate = Isolate::Current(); |
| 1739 Heap* heap = isolate->heap(); | 1740 Heap* heap = isolate->heap(); |
| 1740 const intptr_t cid = kOneByteStringCid; | 1741 const intptr_t cid = kOneByteStringCid; |
| 1741 Heap::Space space = heap->SpaceForAllocation(cid); | 1742 Heap::Space space = heap->SpaceForAllocation(cid); |
| 1742 __ LoadImmediate(R3, heap->TopAddress(space), kNoPP); | 1743 __ LoadImmediate(R3, heap->TopAddress(space), kNoPP); |
| 1743 __ ldr(R0, Address(R3)); | 1744 __ ldr(R0, Address(R3)); |
| 1744 | 1745 |
| 1745 // length_reg: allocation size. | 1746 // length_reg: allocation size. |
| 1746 __ adds(R1, R0, Operand(length_reg)); | 1747 __ adds(R1, R0, Operand(length_reg)); |
| 1747 __ b(&fail, VS); // Fail on overflow. | 1748 __ b(&fail, CS); // Fail on unsigned overflow. |
| 1748 | 1749 |
| 1749 // Check if the allocation fits into the remaining space. | 1750 // Check if the allocation fits into the remaining space. |
| 1750 // R0: potential new object start. | 1751 // R0: potential new object start. |
| 1751 // R1: potential next object start. | 1752 // R1: potential next object start. |
| 1752 // R2: allocation size. | 1753 // R2: allocation size. |
| 1753 // R3: heap->TopAddress(space). | 1754 // R3: heap->TopAddress(space). |
| 1754 __ LoadImmediate(R7, heap->EndAddress(space), kNoPP); | 1755 __ LoadImmediate(R7, heap->EndAddress(space), kNoPP); |
| 1755 __ ldr(R7, Address(R7)); | 1756 __ ldr(R7, Address(R7)); |
| 1756 __ cmp(R1, Operand(R7)); | 1757 __ cmp(R1, Operand(R7)); |
| 1757 __ b(&fail, CS); | 1758 __ b(&fail, CS); |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2020 Isolate* isolate = Isolate::Current(); | 2021 Isolate* isolate = Isolate::Current(); |
| 2021 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP); | 2022 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP); |
| 2022 // Set return value to Isolate::current_tag_. | 2023 // Set return value to Isolate::current_tag_. |
| 2023 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); | 2024 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); |
| 2024 __ ret(); | 2025 __ ret(); |
| 2025 } | 2026 } |
| 2026 | 2027 |
| 2027 } // namespace dart | 2028 } // namespace dart |
| 2028 | 2029 |
| 2029 #endif // defined TARGET_ARCH_ARM64 | 2030 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |