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

Side by Side Diff: runtime/vm/intrinsifier_x64.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/intrinsifier_mips.cc ('k') | runtime/vm/stub_code_arm.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_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 RAX); 146 RAX);
147 __ LoadObject(RAX, Object::null_object()); 147 __ LoadObject(RAX, Object::null_object());
148 __ ret(); 148 __ ret();
149 __ Bind(&fall_through); 149 __ Bind(&fall_through);
150 } 150 }
151 151
152 152
153 #define TYPED_ARRAY_ALLOCATION(type_name, cid, max_len, scale_factor) \ 153 #define TYPED_ARRAY_ALLOCATION(type_name, cid, max_len, scale_factor) \
154 Label fall_through; \ 154 Label fall_through; \
155 const intptr_t kArrayLengthStackOffset = 1 * kWordSize; \ 155 const intptr_t kArrayLengthStackOffset = 1 * kWordSize; \
156 __ MaybeTraceAllocation(cid, &fall_through, false); \ 156 NOT_IN_PRODUCT(__ MaybeTraceAllocation(cid, &fall_through, false)); \
157 __ movq(RDI, Address(RSP, kArrayLengthStackOffset)); /* Array length. */ \ 157 __ movq(RDI, Address(RSP, kArrayLengthStackOffset)); /* Array length. */ \
158 /* Check that length is a positive Smi. */ \ 158 /* Check that length is a positive Smi. */ \
159 /* RDI: requested array length argument. */ \ 159 /* RDI: requested array length argument. */ \
160 __ testq(RDI, Immediate(kSmiTagMask)); \ 160 __ testq(RDI, Immediate(kSmiTagMask)); \
161 __ j(NOT_ZERO, &fall_through); \ 161 __ j(NOT_ZERO, &fall_through); \
162 __ cmpq(RDI, Immediate(0)); \ 162 __ cmpq(RDI, Immediate(0)); \
163 __ j(LESS, &fall_through); \ 163 __ j(LESS, &fall_through); \
164 __ SmiUntag(RDI); \ 164 __ SmiUntag(RDI); \
165 /* Check for maximum allowed length. */ \ 165 /* Check for maximum allowed length. */ \
166 /* RDI: untagged array length. */ \ 166 /* RDI: untagged array length. */ \
(...skipping 23 matching lines...) Expand all
190 /* RCX: potential next object start. */ \ 190 /* RCX: potential next object start. */ \
191 /* RDI: allocation size. */ \ 191 /* RDI: allocation size. */ \
192 /* R13: heap. */ \ 192 /* R13: heap. */ \
193 __ cmpq(RCX, Address(R13, Heap::EndOffset(space))); \ 193 __ cmpq(RCX, Address(R13, Heap::EndOffset(space))); \
194 __ j(ABOVE_EQUAL, &fall_through); \ 194 __ j(ABOVE_EQUAL, &fall_through); \
195 \ 195 \
196 /* Successfully allocated the object(s), now update top to point to */ \ 196 /* Successfully allocated the object(s), now update top to point to */ \
197 /* next object start and initialize the object. */ \ 197 /* next object start and initialize the object. */ \
198 __ movq(Address(R13, Heap::TopOffset(space)), RCX); \ 198 __ movq(Address(R13, Heap::TopOffset(space)), RCX); \
199 __ addq(RAX, Immediate(kHeapObjectTag)); \ 199 __ addq(RAX, Immediate(kHeapObjectTag)); \
200 __ UpdateAllocationStatsWithSize(cid, RDI, space); \ 200 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, RDI, space)); \
201 /* Initialize the tags. */ \ 201 /* Initialize the tags. */ \
202 /* RAX: new object start as a tagged pointer. */ \ 202 /* RAX: new object start as a tagged pointer. */ \
203 /* RCX: new object end address. */ \ 203 /* RCX: new object end address. */ \
204 /* RDI: allocation size. */ \ 204 /* RDI: allocation size. */ \
205 /* R13: scratch register. */ \ 205 /* R13: scratch register. */ \
206 { \ 206 { \
207 Label size_tag_overflow, done; \ 207 Label size_tag_overflow, done; \
208 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); \ 208 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); \
209 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); \ 209 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); \
210 __ shlq(RDI, Immediate(RawObject::kSizeTagPos - kObjectAlignmentLog2)); \ 210 __ shlq(RDI, Immediate(RawObject::kSizeTagPos - kObjectAlignmentLog2)); \
(...skipping 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after
1819 } 1819 }
1820 1820
1821 1821
1822 // Allocates one-byte string of length 'end - start'. The content is not 1822 // Allocates one-byte string of length 'end - start'. The content is not
1823 // initialized. 'length-reg' contains tagged length. 1823 // initialized. 'length-reg' contains tagged length.
1824 // Returns new string as tagged pointer in RAX. 1824 // Returns new string as tagged pointer in RAX.
1825 static void TryAllocateOnebyteString(Assembler* assembler, 1825 static void TryAllocateOnebyteString(Assembler* assembler,
1826 Label* ok, 1826 Label* ok,
1827 Label* failure, 1827 Label* failure,
1828 Register length_reg) { 1828 Register length_reg) {
1829 __ MaybeTraceAllocation(kOneByteStringCid, failure, false); 1829 NOT_IN_PRODUCT(__ MaybeTraceAllocation(kOneByteStringCid, failure, false));
1830 if (length_reg != RDI) { 1830 if (length_reg != RDI) {
1831 __ movq(RDI, length_reg); 1831 __ movq(RDI, length_reg);
1832 } 1832 }
1833 Label pop_and_fail; 1833 Label pop_and_fail;
1834 __ pushq(RDI); // Preserve length. 1834 __ pushq(RDI); // Preserve length.
1835 __ SmiUntag(RDI); 1835 __ SmiUntag(RDI);
1836 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; 1836 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1;
1837 __ leaq(RDI, Address(RDI, TIMES_1, fixed_size)); // RDI is a Smi. 1837 __ leaq(RDI, Address(RDI, TIMES_1, fixed_size)); // RDI is a Smi.
1838 __ andq(RDI, Immediate(-kObjectAlignment)); 1838 __ andq(RDI, Immediate(-kObjectAlignment));
1839 1839
(...skipping 12 matching lines...) Expand all
1852 // RCX: potential next object start. 1852 // RCX: potential next object start.
1853 // RDI: allocation size. 1853 // RDI: allocation size.
1854 // R13: heap. 1854 // R13: heap.
1855 __ cmpq(RCX, Address(R13, Heap::EndOffset(space))); 1855 __ cmpq(RCX, Address(R13, Heap::EndOffset(space)));
1856 __ j(ABOVE_EQUAL, &pop_and_fail); 1856 __ j(ABOVE_EQUAL, &pop_and_fail);
1857 1857
1858 // Successfully allocated the object(s), now update top to point to 1858 // Successfully allocated the object(s), now update top to point to
1859 // next object start and initialize the object. 1859 // next object start and initialize the object.
1860 __ movq(Address(R13, Heap::TopOffset(space)), RCX); 1860 __ movq(Address(R13, Heap::TopOffset(space)), RCX);
1861 __ addq(RAX, Immediate(kHeapObjectTag)); 1861 __ addq(RAX, Immediate(kHeapObjectTag));
1862 __ UpdateAllocationStatsWithSize(cid, RDI, space); 1862 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, RDI, space));
1863 1863
1864 // Initialize the tags. 1864 // Initialize the tags.
1865 // RAX: new object start as a tagged pointer. 1865 // RAX: new object start as a tagged pointer.
1866 // RDI: allocation size. 1866 // RDI: allocation size.
1867 { 1867 {
1868 Label size_tag_overflow, done; 1868 Label size_tag_overflow, done;
1869 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); 1869 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag));
1870 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); 1870 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump);
1871 __ shlq(RDI, Immediate(RawObject::kSizeTagPos - kObjectAlignmentLog2)); 1871 __ shlq(RDI, Immediate(RawObject::kSizeTagPos - kObjectAlignmentLog2));
1872 __ jmp(&done, Assembler::kNearJump); 1872 __ jmp(&done, Assembler::kNearJump);
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
2119 __ Bind(&true_label); 2119 __ Bind(&true_label);
2120 __ LoadObject(RAX, Bool::True()); 2120 __ LoadObject(RAX, Bool::True());
2121 __ ret(); 2121 __ ret();
2122 } 2122 }
2123 2123
2124 #undef __ 2124 #undef __
2125 2125
2126 } // namespace dart 2126 } // namespace dart
2127 2127
2128 #endif // defined TARGET_ARCH_X64 2128 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier_mips.cc ('k') | runtime/vm/stub_code_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698