Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Side by Side Diff: runtime/vm/intrinsifier_arm.cc

Issue 2105383003: VM: Don't generate allocation stats code in product mode. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/class_table.cc ('k') | runtime/vm/intrinsifier_arm64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 __ StoreIntoObject(R2, FieldAddress(R1, Array::data_offset()), R0); 159 __ StoreIntoObject(R2, FieldAddress(R1, Array::data_offset()), R0);
160 __ LoadObject(R0, Object::null_object()); 160 __ LoadObject(R0, Object::null_object());
161 __ Ret(); 161 __ Ret();
162 __ Bind(&fall_through); 162 __ Bind(&fall_through);
163 } 163 }
164 164
165 165
166 #define TYPED_ARRAY_ALLOCATION(type_name, cid, max_len, scale_shift) \ 166 #define TYPED_ARRAY_ALLOCATION(type_name, cid, max_len, scale_shift) \
167 Label fall_through; \ 167 Label fall_through; \
168 const intptr_t kArrayLengthStackOffset = 0 * kWordSize; \ 168 const intptr_t kArrayLengthStackOffset = 0 * kWordSize; \
169 __ MaybeTraceAllocation(cid, R2, &fall_through); \ 169 NOT_IN_PRODUCT(__ MaybeTraceAllocation(cid, R2, &fall_through)); \
170 __ ldr(R2, Address(SP, kArrayLengthStackOffset)); /* Array length. */ \ 170 __ ldr(R2, Address(SP, kArrayLengthStackOffset)); /* Array length. */ \
171 /* Check that length is a positive Smi. */ \ 171 /* Check that length is a positive Smi. */ \
172 /* R2: requested array length argument. */ \ 172 /* R2: requested array length argument. */ \
173 __ tst(R2, Operand(kSmiTagMask)); \ 173 __ tst(R2, Operand(kSmiTagMask)); \
174 __ b(&fall_through, NE); \ 174 __ b(&fall_through, NE); \
175 __ CompareImmediate(R2, 0); \ 175 __ CompareImmediate(R2, 0); \
176 __ b(&fall_through, LT); \ 176 __ b(&fall_through, LT); \
177 __ SmiUntag(R2); \ 177 __ SmiUntag(R2); \
178 /* Check for maximum allowed length. */ \ 178 /* Check for maximum allowed length. */ \
179 /* R2: untagged array length. */ \ 179 /* R2: untagged array length. */ \
(...skipping 15 matching lines...) Expand all
195 /* R0: potential new object start. */ \ 195 /* R0: potential new object start. */ \
196 /* R1: potential next object start. */ \ 196 /* R1: potential next object start. */ \
197 /* R2: allocation size. */ \ 197 /* R2: allocation size. */ \
198 /* R3: heap. */ \ 198 /* R3: heap. */ \
199 __ ldr(IP, Address(R3, Heap::EndOffset(space))); \ 199 __ ldr(IP, Address(R3, Heap::EndOffset(space))); \
200 __ cmp(R1, Operand(IP)); \ 200 __ cmp(R1, Operand(IP)); \
201 __ b(&fall_through, CS); \ 201 __ b(&fall_through, CS); \
202 \ 202 \
203 /* Successfully allocated the object(s), now update top to point to */ \ 203 /* Successfully allocated the object(s), now update top to point to */ \
204 /* next object start and initialize the object. */ \ 204 /* next object start and initialize the object. */ \
205 __ LoadAllocationStatsAddress(R4, cid); \ 205 NOT_IN_PRODUCT(__ LoadAllocationStatsAddress(R4, cid)); \
206 __ str(R1, Address(R3, Heap::TopOffset(space))); \ 206 __ str(R1, Address(R3, Heap::TopOffset(space))); \
207 __ AddImmediate(R0, kHeapObjectTag); \ 207 __ AddImmediate(R0, kHeapObjectTag); \
208 /* Initialize the tags. */ \ 208 /* Initialize the tags. */ \
209 /* R0: new object start as a tagged pointer. */ \ 209 /* R0: new object start as a tagged pointer. */ \
210 /* R1: new object end address. */ \ 210 /* R1: new object end address. */ \
211 /* R2: allocation size. */ \ 211 /* R2: allocation size. */ \
212 /* R4: allocation stats address */ \ 212 /* R4: allocation stats address */ \
213 { \ 213 { \
214 __ CompareImmediate(R2, RawObject::SizeTag::kMaxSizeTag); \ 214 __ CompareImmediate(R2, RawObject::SizeTag::kMaxSizeTag); \
215 __ mov(R3, Operand(R2, LSL, \ 215 __ mov(R3, Operand(R2, LSL, \
(...skipping 26 matching lines...) Expand all
242 __ mov(R9, Operand(R8)); \ 242 __ mov(R9, Operand(R8)); \
243 __ AddImmediate(R3, R0, sizeof(Raw##type_name) - 1); \ 243 __ AddImmediate(R3, R0, sizeof(Raw##type_name) - 1); \
244 Label init_loop; \ 244 Label init_loop; \
245 __ Bind(&init_loop); \ 245 __ Bind(&init_loop); \
246 __ AddImmediate(R3, 2 * kWordSize); \ 246 __ AddImmediate(R3, 2 * kWordSize); \
247 __ cmp(R3, Operand(R1)); \ 247 __ cmp(R3, Operand(R1)); \
248 __ strd(R8, R9, R3, -2 * kWordSize, LS); \ 248 __ strd(R8, R9, R3, -2 * kWordSize, LS); \
249 __ b(&init_loop, CC); \ 249 __ b(&init_loop, CC); \
250 __ str(R8, Address(R3, -2 * kWordSize), HI); \ 250 __ str(R8, Address(R3, -2 * kWordSize), HI); \
251 \ 251 \
252 __ IncrementAllocationStatsWithSize(R4, R2, space); \ 252 NOT_IN_PRODUCT(__ IncrementAllocationStatsWithSize(R4, R2, space)); \
253 __ Ret(); \ 253 __ Ret(); \
254 __ Bind(&fall_through); \ 254 __ Bind(&fall_through); \
255 255
256 256
257 static int GetScaleFactor(intptr_t size) { 257 static int GetScaleFactor(intptr_t size) {
258 switch (size) { 258 switch (size) {
259 case 1: return 0; 259 case 1: return 0;
260 case 2: return 1; 260 case 2: return 1;
261 case 4: return 2; 261 case 4: return 2;
262 case 8: return 3; 262 case 8: return 3;
(...skipping 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after
1817 1817
1818 // Allocates one-byte string of length 'end - start'. The content is not 1818 // Allocates one-byte string of length 'end - start'. The content is not
1819 // initialized. 1819 // initialized.
1820 // 'length-reg' (R2) contains tagged length. 1820 // 'length-reg' (R2) contains tagged length.
1821 // Returns new string as tagged pointer in R0. 1821 // Returns new string as tagged pointer in R0.
1822 static void TryAllocateOnebyteString(Assembler* assembler, 1822 static void TryAllocateOnebyteString(Assembler* assembler,
1823 Label* ok, 1823 Label* ok,
1824 Label* failure) { 1824 Label* failure) {
1825 const Register length_reg = R2; 1825 const Register length_reg = R2;
1826 Label fail; 1826 Label fail;
1827 __ MaybeTraceAllocation(kOneByteStringCid, R0, failure); 1827 NOT_IN_PRODUCT(__ MaybeTraceAllocation(kOneByteStringCid, R0, failure));
1828 __ mov(R8, Operand(length_reg)); // Save the length register. 1828 __ mov(R8, Operand(length_reg)); // Save the length register.
1829 // TODO(koda): Protect against negative length and overflow here. 1829 // TODO(koda): Protect against negative length and overflow here.
1830 __ SmiUntag(length_reg); 1830 __ SmiUntag(length_reg);
1831 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; 1831 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1;
1832 __ AddImmediate(length_reg, fixed_size); 1832 __ AddImmediate(length_reg, fixed_size);
1833 __ bic(length_reg, length_reg, Operand(kObjectAlignment - 1)); 1833 __ bic(length_reg, length_reg, Operand(kObjectAlignment - 1));
1834 1834
1835 const intptr_t cid = kOneByteStringCid; 1835 const intptr_t cid = kOneByteStringCid;
1836 Heap::Space space = Heap::SpaceForAllocation(cid); 1836 Heap::Space space = Heap::SpaceForAllocation(cid);
1837 __ ldr(R3, Address(THR, Thread::heap_offset())); 1837 __ ldr(R3, Address(THR, Thread::heap_offset()));
1838 __ ldr(R0, Address(R3, Heap::TopOffset(space))); 1838 __ ldr(R0, Address(R3, Heap::TopOffset(space)));
1839 1839
1840 // length_reg: allocation size. 1840 // length_reg: allocation size.
1841 __ adds(R1, R0, Operand(length_reg)); 1841 __ adds(R1, R0, Operand(length_reg));
1842 __ b(&fail, CS); // Fail on unsigned overflow. 1842 __ b(&fail, CS); // Fail on unsigned overflow.
1843 1843
1844 // Check if the allocation fits into the remaining space. 1844 // Check if the allocation fits into the remaining space.
1845 // R0: potential new object start. 1845 // R0: potential new object start.
1846 // R1: potential next object start. 1846 // R1: potential next object start.
1847 // R2: allocation size. 1847 // R2: allocation size.
1848 // R3: heap. 1848 // R3: heap.
1849 __ ldr(NOTFP, Address(R3, Heap::EndOffset(space))); 1849 __ ldr(NOTFP, Address(R3, Heap::EndOffset(space)));
1850 __ cmp(R1, Operand(NOTFP)); 1850 __ cmp(R1, Operand(NOTFP));
1851 __ b(&fail, CS); 1851 __ b(&fail, CS);
1852 1852
1853 // Successfully allocated the object(s), now update top to point to 1853 // Successfully allocated the object(s), now update top to point to
1854 // next object start and initialize the object. 1854 // next object start and initialize the object.
1855 __ LoadAllocationStatsAddress(R4, cid); 1855 NOT_IN_PRODUCT(__ LoadAllocationStatsAddress(R4, cid));
1856 __ str(R1, Address(R3, Heap::TopOffset(space))); 1856 __ str(R1, Address(R3, Heap::TopOffset(space)));
1857 __ AddImmediate(R0, kHeapObjectTag); 1857 __ AddImmediate(R0, kHeapObjectTag);
1858 1858
1859 // Initialize the tags. 1859 // Initialize the tags.
1860 // R0: new object start as a tagged pointer. 1860 // R0: new object start as a tagged pointer.
1861 // R1: new object end address. 1861 // R1: new object end address.
1862 // R2: allocation size. 1862 // R2: allocation size.
1863 // R4: allocation stats address. 1863 // R4: allocation stats address.
1864 { 1864 {
1865 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; 1865 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2;
(...skipping 12 matching lines...) Expand all
1878 // Set the length field using the saved length (R8). 1878 // Set the length field using the saved length (R8).
1879 __ InitializeFieldNoBarrier(R0, 1879 __ InitializeFieldNoBarrier(R0,
1880 FieldAddress(R0, String::length_offset()), 1880 FieldAddress(R0, String::length_offset()),
1881 R8); 1881 R8);
1882 // Clear hash. 1882 // Clear hash.
1883 __ LoadImmediate(TMP, 0); 1883 __ LoadImmediate(TMP, 0);
1884 __ InitializeFieldNoBarrier(R0, 1884 __ InitializeFieldNoBarrier(R0,
1885 FieldAddress(R0, String::hash_offset()), 1885 FieldAddress(R0, String::hash_offset()),
1886 TMP); 1886 TMP);
1887 1887
1888 __ IncrementAllocationStatsWithSize(R4, R2, space); 1888 NOT_IN_PRODUCT(__ IncrementAllocationStatsWithSize(R4, R2, space));
1889 __ b(ok); 1889 __ b(ok);
1890 1890
1891 __ Bind(&fail); 1891 __ Bind(&fail);
1892 __ b(failure); 1892 __ b(failure);
1893 } 1893 }
1894 1894
1895 1895
1896 // Arg0: OneByteString (receiver). 1896 // Arg0: OneByteString (receiver).
1897 // Arg1: Start index as Smi. 1897 // Arg1: Start index as Smi.
1898 // Arg2: End index as Smi. 1898 // Arg2: End index as Smi.
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
2127 __ ldr(R0, Address(R0, TimelineStream::enabled_offset())); 2127 __ ldr(R0, Address(R0, TimelineStream::enabled_offset()));
2128 __ cmp(R0, Operand(0)); 2128 __ cmp(R0, Operand(0));
2129 __ LoadObject(R0, Bool::True(), NE); 2129 __ LoadObject(R0, Bool::True(), NE);
2130 __ LoadObject(R0, Bool::False(), EQ); 2130 __ LoadObject(R0, Bool::False(), EQ);
2131 __ Ret(); 2131 __ Ret();
2132 } 2132 }
2133 2133
2134 } // namespace dart 2134 } // namespace dart
2135 2135
2136 #endif // defined TARGET_ARCH_ARM 2136 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/class_table.cc ('k') | runtime/vm/intrinsifier_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698