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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 __ SmiUntag(R2); \ | 165 __ SmiUntag(R2); \ |
166 /* Check for maximum allowed length. */ \ | 166 /* Check for maximum allowed length. */ \ |
167 /* R2: untagged array length. */ \ | 167 /* R2: untagged array length. */ \ |
168 __ CompareImmediate(R2, max_len); \ | 168 __ CompareImmediate(R2, max_len); \ |
169 __ b(&fall_through, GT); \ | 169 __ b(&fall_through, GT); \ |
170 __ mov(R2, Operand(R2, LSL, scale_shift)); \ | 170 __ mov(R2, Operand(R2, LSL, scale_shift)); \ |
171 const intptr_t fixed_size_plus_alignment_padding = \ | 171 const intptr_t fixed_size_plus_alignment_padding = \ |
172 sizeof(Raw##type_name) + kObjectAlignment - 1; \ | 172 sizeof(Raw##type_name) + kObjectAlignment - 1; \ |
173 __ AddImmediate(R2, fixed_size_plus_alignment_padding); \ | 173 __ AddImmediate(R2, fixed_size_plus_alignment_padding); \ |
174 __ bic(R2, R2, Operand(kObjectAlignment - 1)); \ | 174 __ bic(R2, R2, Operand(kObjectAlignment - 1)); \ |
175 Heap::Space space = Heap::kNew; \ | 175 NOT_IN_PRODUCT(Heap::Space space = Heap::kNew); \ |
176 __ ldr(R3, Address(THR, Thread::heap_offset())); \ | 176 __ ldr(R0, Address(THR, Thread::top_offset())); \ |
177 __ ldr(R0, Address(R3, Heap::TopOffset(space))); \ | |
178 \ | 177 \ |
179 /* R2: allocation size. */ \ | 178 /* R2: allocation size. */ \ |
180 __ adds(R1, R0, Operand(R2)); \ | 179 __ adds(R1, R0, Operand(R2)); \ |
181 __ b(&fall_through, CS); /* Fail on unsigned overflow. */ \ | 180 __ b(&fall_through, CS); /* Fail on unsigned overflow. */ \ |
182 \ | 181 \ |
183 /* Check if the allocation fits into the remaining space. */ \ | 182 /* Check if the allocation fits into the remaining space. */ \ |
184 /* R0: potential new object start. */ \ | 183 /* R0: potential new object start. */ \ |
185 /* R1: potential next object start. */ \ | 184 /* R1: potential next object start. */ \ |
186 /* R2: allocation size. */ \ | 185 /* R2: allocation size. */ \ |
187 /* R3: heap. */ \ | 186 __ ldr(IP, Address(THR, Thread::end_offset())); \ |
188 __ ldr(IP, Address(R3, Heap::EndOffset(space))); \ | |
189 __ cmp(R1, Operand(IP)); \ | 187 __ cmp(R1, Operand(IP)); \ |
190 __ b(&fall_through, CS); \ | 188 __ b(&fall_through, CS); \ |
191 \ | 189 \ |
192 /* Successfully allocated the object(s), now update top to point to */ \ | 190 /* Successfully allocated the object(s), now update top to point to */ \ |
193 /* next object start and initialize the object. */ \ | 191 /* next object start and initialize the object. */ \ |
194 NOT_IN_PRODUCT(__ LoadAllocationStatsAddress(R4, cid)); \ | 192 NOT_IN_PRODUCT(__ LoadAllocationStatsAddress(R4, cid)); \ |
195 __ str(R1, Address(R3, Heap::TopOffset(space))); \ | 193 __ str(R1, Address(THR, Thread::top_offset())); \ |
196 __ AddImmediate(R0, kHeapObjectTag); \ | 194 __ AddImmediate(R0, kHeapObjectTag); \ |
197 /* Initialize the tags. */ \ | 195 /* Initialize the tags. */ \ |
198 /* R0: new object start as a tagged pointer. */ \ | 196 /* R0: new object start as a tagged pointer. */ \ |
199 /* R1: new object end address. */ \ | 197 /* R1: new object end address. */ \ |
200 /* R2: allocation size. */ \ | 198 /* R2: allocation size. */ \ |
201 /* R4: allocation stats address */ \ | 199 /* R4: allocation stats address */ \ |
202 { \ | 200 { \ |
203 __ CompareImmediate(R2, RawObject::SizeTag::kMaxSizeTag); \ | 201 __ CompareImmediate(R2, RawObject::SizeTag::kMaxSizeTag); \ |
204 __ mov(R3, \ | 202 __ mov(R3, \ |
205 Operand(R2, LSL, RawObject::kSizeTagPos - kObjectAlignmentLog2), \ | 203 Operand(R2, LSL, RawObject::kSizeTagPos - kObjectAlignmentLog2), \ |
(...skipping 1714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1920 NOT_IN_PRODUCT(__ MaybeTraceAllocation(kOneByteStringCid, R0, failure)); | 1918 NOT_IN_PRODUCT(__ MaybeTraceAllocation(kOneByteStringCid, R0, failure)); |
1921 __ mov(R8, Operand(length_reg)); // Save the length register. | 1919 __ mov(R8, Operand(length_reg)); // Save the length register. |
1922 // TODO(koda): Protect against negative length and overflow here. | 1920 // TODO(koda): Protect against negative length and overflow here. |
1923 __ SmiUntag(length_reg); | 1921 __ SmiUntag(length_reg); |
1924 const intptr_t fixed_size_plus_alignment_padding = | 1922 const intptr_t fixed_size_plus_alignment_padding = |
1925 sizeof(RawString) + kObjectAlignment - 1; | 1923 sizeof(RawString) + kObjectAlignment - 1; |
1926 __ AddImmediate(length_reg, fixed_size_plus_alignment_padding); | 1924 __ AddImmediate(length_reg, fixed_size_plus_alignment_padding); |
1927 __ bic(length_reg, length_reg, Operand(kObjectAlignment - 1)); | 1925 __ bic(length_reg, length_reg, Operand(kObjectAlignment - 1)); |
1928 | 1926 |
1929 const intptr_t cid = kOneByteStringCid; | 1927 const intptr_t cid = kOneByteStringCid; |
1930 Heap::Space space = Heap::kNew; | 1928 NOT_IN_PRODUCT(Heap::Space space = Heap::kNew); |
1931 __ ldr(R3, Address(THR, Thread::heap_offset())); | 1929 __ ldr(R0, Address(THR, Thread::top_offset())); |
1932 __ ldr(R0, Address(R3, Heap::TopOffset(space))); | |
1933 | 1930 |
1934 // length_reg: allocation size. | 1931 // length_reg: allocation size. |
1935 __ adds(R1, R0, Operand(length_reg)); | 1932 __ adds(R1, R0, Operand(length_reg)); |
1936 __ b(&fail, CS); // Fail on unsigned overflow. | 1933 __ b(&fail, CS); // Fail on unsigned overflow. |
1937 | 1934 |
1938 // Check if the allocation fits into the remaining space. | 1935 // Check if the allocation fits into the remaining space. |
1939 // R0: potential new object start. | 1936 // R0: potential new object start. |
1940 // R1: potential next object start. | 1937 // R1: potential next object start. |
1941 // R2: allocation size. | 1938 // R2: allocation size. |
1942 // R3: heap. | 1939 __ ldr(NOTFP, Address(THR, Thread::end_offset())); |
1943 __ ldr(NOTFP, Address(R3, Heap::EndOffset(space))); | |
1944 __ cmp(R1, Operand(NOTFP)); | 1940 __ cmp(R1, Operand(NOTFP)); |
1945 __ b(&fail, CS); | 1941 __ b(&fail, CS); |
1946 | 1942 |
1947 // Successfully allocated the object(s), now update top to point to | 1943 // Successfully allocated the object(s), now update top to point to |
1948 // next object start and initialize the object. | 1944 // next object start and initialize the object. |
1949 NOT_IN_PRODUCT(__ LoadAllocationStatsAddress(R4, cid)); | 1945 NOT_IN_PRODUCT(__ LoadAllocationStatsAddress(R4, cid)); |
1950 __ str(R1, Address(R3, Heap::TopOffset(space))); | 1946 __ str(R1, Address(THR, Thread::top_offset())); |
1951 __ AddImmediate(R0, kHeapObjectTag); | 1947 __ AddImmediate(R0, kHeapObjectTag); |
1952 | 1948 |
1953 // Initialize the tags. | 1949 // Initialize the tags. |
1954 // R0: new object start as a tagged pointer. | 1950 // R0: new object start as a tagged pointer. |
1955 // R1: new object end address. | 1951 // R1: new object end address. |
1956 // R2: allocation size. | 1952 // R2: allocation size. |
1957 // R4: allocation stats address. | 1953 // R4: allocation stats address. |
1958 { | 1954 { |
1959 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; | 1955 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; |
1960 | 1956 |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2222 | 2218 |
2223 void Intrinsifier::SetAsyncThreadStackTrace(Assembler* assembler) { | 2219 void Intrinsifier::SetAsyncThreadStackTrace(Assembler* assembler) { |
2224 __ ldr(R0, Address(THR, Thread::async_stack_trace_offset())); | 2220 __ ldr(R0, Address(THR, Thread::async_stack_trace_offset())); |
2225 __ LoadObject(R0, Object::null_object()); | 2221 __ LoadObject(R0, Object::null_object()); |
2226 __ Ret(); | 2222 __ Ret(); |
2227 } | 2223 } |
2228 | 2224 |
2229 } // namespace dart | 2225 } // namespace dart |
2230 | 2226 |
2231 #endif // defined TARGET_ARCH_ARM | 2227 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |