| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 __ StoreIntoObject(R2, FieldAddress(R1, Array::data_offset()), R0); | 149 __ StoreIntoObject(R2, FieldAddress(R1, Array::data_offset()), R0); |
| 150 __ LoadObject(R0, Object::null_object()); | 150 __ LoadObject(R0, Object::null_object()); |
| 151 __ Ret(); | 151 __ Ret(); |
| 152 __ Bind(&fall_through); | 152 __ Bind(&fall_through); |
| 153 } | 153 } |
| 154 | 154 |
| 155 | 155 |
| 156 #define TYPED_ARRAY_ALLOCATION(type_name, cid, max_len, scale_shift) \ | 156 #define TYPED_ARRAY_ALLOCATION(type_name, cid, max_len, scale_shift) \ |
| 157 Label fall_through; \ | 157 Label fall_through; \ |
| 158 const intptr_t kArrayLengthStackOffset = 0 * kWordSize; \ | 158 const intptr_t kArrayLengthStackOffset = 0 * kWordSize; \ |
| 159 __ MaybeTraceAllocation(cid, R2, &fall_through, \ | 159 __ MaybeTraceAllocation(cid, R2, &fall_through); \ |
| 160 /* inline_isolate = */ false); \ | |
| 161 __ ldr(R2, Address(SP, kArrayLengthStackOffset)); /* Array length. */ \ | 160 __ ldr(R2, Address(SP, kArrayLengthStackOffset)); /* Array length. */ \ |
| 162 /* Check that length is a positive Smi. */ \ | 161 /* Check that length is a positive Smi. */ \ |
| 163 /* R2: requested array length argument. */ \ | 162 /* R2: requested array length argument. */ \ |
| 164 __ tst(R2, Operand(kSmiTagMask)); \ | 163 __ tst(R2, Operand(kSmiTagMask)); \ |
| 165 __ b(&fall_through, NE); \ | 164 __ b(&fall_through, NE); \ |
| 166 __ CompareImmediate(R2, 0); \ | 165 __ CompareImmediate(R2, 0); \ |
| 167 __ b(&fall_through, LT); \ | 166 __ b(&fall_through, LT); \ |
| 168 __ SmiUntag(R2); \ | 167 __ SmiUntag(R2); \ |
| 169 /* Check for maximum allowed length. */ \ | 168 /* Check for maximum allowed length. */ \ |
| 170 /* R2: untagged array length. */ \ | 169 /* R2: untagged array length. */ \ |
| (...skipping 15 matching lines...) Expand all Loading... |
| 186 /* R0: potential new object start. */ \ | 185 /* R0: potential new object start. */ \ |
| 187 /* R1: potential next object start. */ \ | 186 /* R1: potential next object start. */ \ |
| 188 /* R2: allocation size. */ \ | 187 /* R2: allocation size. */ \ |
| 189 /* R3: heap. */ \ | 188 /* R3: heap. */ \ |
| 190 __ ldr(IP, Address(R3, Heap::EndOffset(space))); \ | 189 __ ldr(IP, Address(R3, Heap::EndOffset(space))); \ |
| 191 __ cmp(R1, Operand(IP)); \ | 190 __ cmp(R1, Operand(IP)); \ |
| 192 __ b(&fall_through, CS); \ | 191 __ b(&fall_through, CS); \ |
| 193 \ | 192 \ |
| 194 /* Successfully allocated the object(s), now update top to point to */ \ | 193 /* Successfully allocated the object(s), now update top to point to */ \ |
| 195 /* next object start and initialize the object. */ \ | 194 /* next object start and initialize the object. */ \ |
| 196 __ LoadAllocationStatsAddress(R4, cid, /* inline_isolate = */ false); \ | 195 __ LoadAllocationStatsAddress(R4, cid); \ |
| 197 __ str(R1, Address(R3, Heap::TopOffset(space))); \ | 196 __ str(R1, Address(R3, Heap::TopOffset(space))); \ |
| 198 __ AddImmediate(R0, kHeapObjectTag); \ | 197 __ AddImmediate(R0, kHeapObjectTag); \ |
| 199 /* Initialize the tags. */ \ | 198 /* Initialize the tags. */ \ |
| 200 /* R0: new object start as a tagged pointer. */ \ | 199 /* R0: new object start as a tagged pointer. */ \ |
| 201 /* R1: new object end address. */ \ | 200 /* R1: new object end address. */ \ |
| 202 /* R2: allocation size. */ \ | 201 /* R2: allocation size. */ \ |
| 203 /* R4: allocation stats address */ \ | 202 /* R4: allocation stats address */ \ |
| 204 { \ | 203 { \ |
| 205 __ CompareImmediate(R2, RawObject::SizeTag::kMaxSizeTag); \ | 204 __ CompareImmediate(R2, RawObject::SizeTag::kMaxSizeTag); \ |
| 206 __ mov(R3, Operand(R2, LSL, \ | 205 __ mov(R3, Operand(R2, LSL, \ |
| (...skipping 1633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1840 | 1839 |
| 1841 // Allocates one-byte string of length 'end - start'. The content is not | 1840 // Allocates one-byte string of length 'end - start'. The content is not |
| 1842 // initialized. | 1841 // initialized. |
| 1843 // 'length-reg' (R2) contains tagged length. | 1842 // 'length-reg' (R2) contains tagged length. |
| 1844 // Returns new string as tagged pointer in R0. | 1843 // Returns new string as tagged pointer in R0. |
| 1845 static void TryAllocateOnebyteString(Assembler* assembler, | 1844 static void TryAllocateOnebyteString(Assembler* assembler, |
| 1846 Label* ok, | 1845 Label* ok, |
| 1847 Label* failure) { | 1846 Label* failure) { |
| 1848 const Register length_reg = R2; | 1847 const Register length_reg = R2; |
| 1849 Label fail; | 1848 Label fail; |
| 1850 __ MaybeTraceAllocation(kOneByteStringCid, R0, failure, | 1849 __ MaybeTraceAllocation(kOneByteStringCid, R0, failure); |
| 1851 /* inline_isolate = */ false); | |
| 1852 __ mov(R8, Operand(length_reg)); // Save the length register. | 1850 __ mov(R8, Operand(length_reg)); // Save the length register. |
| 1853 // TODO(koda): Protect against negative length and overflow here. | 1851 // TODO(koda): Protect against negative length and overflow here. |
| 1854 __ SmiUntag(length_reg); | 1852 __ SmiUntag(length_reg); |
| 1855 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; | 1853 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; |
| 1856 __ AddImmediate(length_reg, fixed_size); | 1854 __ AddImmediate(length_reg, fixed_size); |
| 1857 __ bic(length_reg, length_reg, Operand(kObjectAlignment - 1)); | 1855 __ bic(length_reg, length_reg, Operand(kObjectAlignment - 1)); |
| 1858 | 1856 |
| 1859 const intptr_t cid = kOneByteStringCid; | 1857 const intptr_t cid = kOneByteStringCid; |
| 1860 Heap::Space space = Heap::SpaceForAllocation(cid); | 1858 Heap::Space space = Heap::SpaceForAllocation(cid); |
| 1861 __ ldr(R3, Address(THR, Thread::heap_offset())); | 1859 __ ldr(R3, Address(THR, Thread::heap_offset())); |
| 1862 __ ldr(R0, Address(R3, Heap::TopOffset(space))); | 1860 __ ldr(R0, Address(R3, Heap::TopOffset(space))); |
| 1863 | 1861 |
| 1864 // length_reg: allocation size. | 1862 // length_reg: allocation size. |
| 1865 __ adds(R1, R0, Operand(length_reg)); | 1863 __ adds(R1, R0, Operand(length_reg)); |
| 1866 __ b(&fail, CS); // Fail on unsigned overflow. | 1864 __ b(&fail, CS); // Fail on unsigned overflow. |
| 1867 | 1865 |
| 1868 // Check if the allocation fits into the remaining space. | 1866 // Check if the allocation fits into the remaining space. |
| 1869 // R0: potential new object start. | 1867 // R0: potential new object start. |
| 1870 // R1: potential next object start. | 1868 // R1: potential next object start. |
| 1871 // R2: allocation size. | 1869 // R2: allocation size. |
| 1872 // R3: heap. | 1870 // R3: heap. |
| 1873 __ ldr(NOTFP, Address(R3, Heap::EndOffset(space))); | 1871 __ ldr(NOTFP, Address(R3, Heap::EndOffset(space))); |
| 1874 __ cmp(R1, Operand(NOTFP)); | 1872 __ cmp(R1, Operand(NOTFP)); |
| 1875 __ b(&fail, CS); | 1873 __ b(&fail, CS); |
| 1876 | 1874 |
| 1877 // Successfully allocated the object(s), now update top to point to | 1875 // Successfully allocated the object(s), now update top to point to |
| 1878 // next object start and initialize the object. | 1876 // next object start and initialize the object. |
| 1879 __ LoadAllocationStatsAddress(R4, cid, /* inline_isolate = */ false); | 1877 __ LoadAllocationStatsAddress(R4, cid); |
| 1880 __ str(R1, Address(R3, Heap::TopOffset(space))); | 1878 __ str(R1, Address(R3, Heap::TopOffset(space))); |
| 1881 __ AddImmediate(R0, kHeapObjectTag); | 1879 __ AddImmediate(R0, kHeapObjectTag); |
| 1882 | 1880 |
| 1883 // Initialize the tags. | 1881 // Initialize the tags. |
| 1884 // R0: new object start as a tagged pointer. | 1882 // R0: new object start as a tagged pointer. |
| 1885 // R1: new object end address. | 1883 // R1: new object end address. |
| 1886 // R2: allocation size. | 1884 // R2: allocation size. |
| 1887 // R4: allocation stats address. | 1885 // R4: allocation stats address. |
| 1888 { | 1886 { |
| 1889 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; | 1887 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2134 | 2132 |
| 2135 void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) { | 2133 void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) { |
| 2136 __ LoadIsolate(R0); | 2134 __ LoadIsolate(R0); |
| 2137 __ ldr(R0, Address(R0, Isolate::current_tag_offset())); | 2135 __ ldr(R0, Address(R0, Isolate::current_tag_offset())); |
| 2138 __ Ret(); | 2136 __ Ret(); |
| 2139 } | 2137 } |
| 2140 | 2138 |
| 2141 } // namespace dart | 2139 } // namespace dart |
| 2142 | 2140 |
| 2143 #endif // defined TARGET_ARCH_ARM | 2141 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |