| 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 // The intrinsic code below is executed before a method has built its frame. | 5 // The intrinsic code below is executed before a method has built its frame. |
| 6 // The return address is on the stack and the arguments below it. | 6 // The return address is on the stack and the arguments below it. |
| 7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. | 7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. |
| 8 // Each intrinsification method returns true if the corresponding | 8 // Each intrinsification method returns true if the corresponding |
| 9 // Dart method was intrinsified. | 9 // Dart method was intrinsified. |
| 10 | 10 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 Immediate(reinterpret_cast<int32_t>(Object::null())); | 193 Immediate(reinterpret_cast<int32_t>(Object::null())); |
| 194 __ movl(EAX, raw_null); | 194 __ movl(EAX, raw_null); |
| 195 __ ret(); | 195 __ ret(); |
| 196 __ Bind(&fall_through); | 196 __ Bind(&fall_through); |
| 197 } | 197 } |
| 198 | 198 |
| 199 | 199 |
| 200 #define TYPED_ARRAY_ALLOCATION(type_name, cid, max_len, scale_factor) \ | 200 #define TYPED_ARRAY_ALLOCATION(type_name, cid, max_len, scale_factor) \ |
| 201 Label fall_through; \ | 201 Label fall_through; \ |
| 202 const intptr_t kArrayLengthStackOffset = 1 * kWordSize; \ | 202 const intptr_t kArrayLengthStackOffset = 1 * kWordSize; \ |
| 203 __ MaybeTraceAllocation(cid, EDI, &fall_through, false); \ | 203 NOT_IN_PRODUCT(__ MaybeTraceAllocation(cid, EDI, &fall_through, false)); \ |
| 204 __ movl(EDI, Address(ESP, kArrayLengthStackOffset)); /* Array length. */ \ | 204 __ movl(EDI, Address(ESP, kArrayLengthStackOffset)); /* Array length. */ \ |
| 205 /* Check that length is a positive Smi. */ \ | 205 /* Check that length is a positive Smi. */ \ |
| 206 /* EDI: requested array length argument. */ \ | 206 /* EDI: requested array length argument. */ \ |
| 207 __ testl(EDI, Immediate(kSmiTagMask)); \ | 207 __ testl(EDI, Immediate(kSmiTagMask)); \ |
| 208 __ j(NOT_ZERO, &fall_through); \ | 208 __ j(NOT_ZERO, &fall_through); \ |
| 209 __ cmpl(EDI, Immediate(0)); \ | 209 __ cmpl(EDI, Immediate(0)); \ |
| 210 __ j(LESS, &fall_through); \ | 210 __ j(LESS, &fall_through); \ |
| 211 __ SmiUntag(EDI); \ | 211 __ SmiUntag(EDI); \ |
| 212 /* Check for maximum allowed length. */ \ | 212 /* Check for maximum allowed length. */ \ |
| 213 /* EDI: untagged array length. */ \ | 213 /* EDI: untagged array length. */ \ |
| (...skipping 23 matching lines...) Expand all Loading... |
| 237 /* EBX: potential next object start. */ \ | 237 /* EBX: potential next object start. */ \ |
| 238 /* EDI: allocation size. */ \ | 238 /* EDI: allocation size. */ \ |
| 239 /* ECX: heap. */ \ | 239 /* ECX: heap. */ \ |
| 240 __ cmpl(EBX, Address(ECX, Heap::EndOffset(space))); \ | 240 __ cmpl(EBX, Address(ECX, Heap::EndOffset(space))); \ |
| 241 __ j(ABOVE_EQUAL, &fall_through); \ | 241 __ j(ABOVE_EQUAL, &fall_through); \ |
| 242 \ | 242 \ |
| 243 /* Successfully allocated the object(s), now update top to point to */ \ | 243 /* Successfully allocated the object(s), now update top to point to */ \ |
| 244 /* next object start and initialize the object. */ \ | 244 /* next object start and initialize the object. */ \ |
| 245 __ movl(Address(ECX, Heap::TopOffset(space)), EBX); \ | 245 __ movl(Address(ECX, Heap::TopOffset(space)), EBX); \ |
| 246 __ addl(EAX, Immediate(kHeapObjectTag)); \ | 246 __ addl(EAX, Immediate(kHeapObjectTag)); \ |
| 247 __ UpdateAllocationStatsWithSize(cid, EDI, ECX, space); \ | 247 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, EDI, ECX, space)); \ |
| 248 \ | 248 \ |
| 249 /* Initialize the tags. */ \ | 249 /* Initialize the tags. */ \ |
| 250 /* EAX: new object start as a tagged pointer. */ \ | 250 /* EAX: new object start as a tagged pointer. */ \ |
| 251 /* EBX: new object end address. */ \ | 251 /* EBX: new object end address. */ \ |
| 252 /* EDI: allocation size. */ \ | 252 /* EDI: allocation size. */ \ |
| 253 { \ | 253 { \ |
| 254 Label size_tag_overflow, done; \ | 254 Label size_tag_overflow, done; \ |
| 255 __ cmpl(EDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); \ | 255 __ cmpl(EDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); \ |
| 256 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); \ | 256 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); \ |
| 257 __ shll(EDI, Immediate(RawObject::kSizeTagPos - kObjectAlignmentLog2)); \ | 257 __ shll(EDI, Immediate(RawObject::kSizeTagPos - kObjectAlignmentLog2)); \ |
| (...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1852 } | 1852 } |
| 1853 | 1853 |
| 1854 | 1854 |
| 1855 // Allocates one-byte string of length 'end - start'. The content is not | 1855 // Allocates one-byte string of length 'end - start'. The content is not |
| 1856 // initialized. 'length-reg' contains tagged length. | 1856 // initialized. 'length-reg' contains tagged length. |
| 1857 // Returns new string as tagged pointer in EAX. | 1857 // Returns new string as tagged pointer in EAX. |
| 1858 static void TryAllocateOnebyteString(Assembler* assembler, | 1858 static void TryAllocateOnebyteString(Assembler* assembler, |
| 1859 Label* ok, | 1859 Label* ok, |
| 1860 Label* failure, | 1860 Label* failure, |
| 1861 Register length_reg) { | 1861 Register length_reg) { |
| 1862 __ MaybeTraceAllocation(kOneByteStringCid, EAX, failure, false); | 1862 NOT_IN_PRODUCT( |
| 1863 __ MaybeTraceAllocation(kOneByteStringCid, EAX, failure, false)); |
| 1863 if (length_reg != EDI) { | 1864 if (length_reg != EDI) { |
| 1864 __ movl(EDI, length_reg); | 1865 __ movl(EDI, length_reg); |
| 1865 } | 1866 } |
| 1866 Label pop_and_fail; | 1867 Label pop_and_fail; |
| 1867 __ pushl(EDI); // Preserve length. | 1868 __ pushl(EDI); // Preserve length. |
| 1868 __ SmiUntag(EDI); | 1869 __ SmiUntag(EDI); |
| 1869 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; | 1870 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; |
| 1870 __ leal(EDI, Address(EDI, TIMES_1, fixed_size)); // EDI is untagged. | 1871 __ leal(EDI, Address(EDI, TIMES_1, fixed_size)); // EDI is untagged. |
| 1871 __ andl(EDI, Immediate(-kObjectAlignment)); | 1872 __ andl(EDI, Immediate(-kObjectAlignment)); |
| 1872 | 1873 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1886 // EDI: allocation size. | 1887 // EDI: allocation size. |
| 1887 // ECX: heap. | 1888 // ECX: heap. |
| 1888 __ cmpl(EBX, Address(ECX, Heap::EndOffset(space))); | 1889 __ cmpl(EBX, Address(ECX, Heap::EndOffset(space))); |
| 1889 __ j(ABOVE_EQUAL, &pop_and_fail); | 1890 __ j(ABOVE_EQUAL, &pop_and_fail); |
| 1890 | 1891 |
| 1891 // Successfully allocated the object(s), now update top to point to | 1892 // Successfully allocated the object(s), now update top to point to |
| 1892 // next object start and initialize the object. | 1893 // next object start and initialize the object. |
| 1893 __ movl(Address(ECX, Heap::TopOffset(space)), EBX); | 1894 __ movl(Address(ECX, Heap::TopOffset(space)), EBX); |
| 1894 __ addl(EAX, Immediate(kHeapObjectTag)); | 1895 __ addl(EAX, Immediate(kHeapObjectTag)); |
| 1895 | 1896 |
| 1896 __ UpdateAllocationStatsWithSize(cid, EDI, ECX, space); | 1897 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, EDI, ECX, space)); |
| 1897 | 1898 |
| 1898 // Initialize the tags. | 1899 // Initialize the tags. |
| 1899 // EAX: new object start as a tagged pointer. | 1900 // EAX: new object start as a tagged pointer. |
| 1900 // EBX: new object end address. | 1901 // EBX: new object end address. |
| 1901 // EDI: allocation size. | 1902 // EDI: allocation size. |
| 1902 { | 1903 { |
| 1903 Label size_tag_overflow, done; | 1904 Label size_tag_overflow, done; |
| 1904 __ cmpl(EDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); | 1905 __ cmpl(EDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); |
| 1905 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); | 1906 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); |
| 1906 __ shll(EDI, Immediate(RawObject::kSizeTagPos - kObjectAlignmentLog2)); | 1907 __ shll(EDI, Immediate(RawObject::kSizeTagPos - kObjectAlignmentLog2)); |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2153 __ Bind(&true_label); | 2154 __ Bind(&true_label); |
| 2154 __ LoadObject(EAX, Bool::True()); | 2155 __ LoadObject(EAX, Bool::True()); |
| 2155 __ ret(); | 2156 __ ret(); |
| 2156 } | 2157 } |
| 2157 | 2158 |
| 2158 #undef __ | 2159 #undef __ |
| 2159 | 2160 |
| 2160 } // namespace dart | 2161 } // namespace dart |
| 2161 | 2162 |
| 2162 #endif // defined TARGET_ARCH_IA32 | 2163 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |