| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 Immediate(reinterpret_cast<int32_t>(Object::null())); | 192 Immediate(reinterpret_cast<int32_t>(Object::null())); |
| 193 __ movl(EAX, raw_null); | 193 __ movl(EAX, raw_null); |
| 194 __ ret(); | 194 __ ret(); |
| 195 __ Bind(&fall_through); | 195 __ Bind(&fall_through); |
| 196 } | 196 } |
| 197 | 197 |
| 198 | 198 |
| 199 #define TYPED_ARRAY_ALLOCATION(type_name, cid, max_len, scale_factor) \ | 199 #define TYPED_ARRAY_ALLOCATION(type_name, cid, max_len, scale_factor) \ |
| 200 Label fall_through; \ | 200 Label fall_through; \ |
| 201 const intptr_t kArrayLengthStackOffset = 1 * kWordSize; \ | 201 const intptr_t kArrayLengthStackOffset = 1 * kWordSize; \ |
| 202 __ MaybeTraceAllocation(cid, EDI, &fall_through, false, \ | 202 __ MaybeTraceAllocation(cid, EDI, &fall_through, false); \ |
| 203 /* inline_isolate = */ false); \ | |
| 204 __ movl(EDI, Address(ESP, kArrayLengthStackOffset)); /* Array length. */ \ | 203 __ movl(EDI, Address(ESP, kArrayLengthStackOffset)); /* Array length. */ \ |
| 205 /* Check that length is a positive Smi. */ \ | 204 /* Check that length is a positive Smi. */ \ |
| 206 /* EDI: requested array length argument. */ \ | 205 /* EDI: requested array length argument. */ \ |
| 207 __ testl(EDI, Immediate(kSmiTagMask)); \ | 206 __ testl(EDI, Immediate(kSmiTagMask)); \ |
| 208 __ j(NOT_ZERO, &fall_through); \ | 207 __ j(NOT_ZERO, &fall_through); \ |
| 209 __ cmpl(EDI, Immediate(0)); \ | 208 __ cmpl(EDI, Immediate(0)); \ |
| 210 __ j(LESS, &fall_through); \ | 209 __ j(LESS, &fall_through); \ |
| 211 __ SmiUntag(EDI); \ | 210 __ SmiUntag(EDI); \ |
| 212 /* Check for maximum allowed length. */ \ | 211 /* Check for maximum allowed length. */ \ |
| 213 /* EDI: untagged array length. */ \ | 212 /* EDI: untagged array length. */ \ |
| (...skipping 23 matching lines...) Expand all Loading... |
| 237 /* EBX: potential next object start. */ \ | 236 /* EBX: potential next object start. */ \ |
| 238 /* EDI: allocation size. */ \ | 237 /* EDI: allocation size. */ \ |
| 239 /* ECX: heap. */ \ | 238 /* ECX: heap. */ \ |
| 240 __ cmpl(EBX, Address(ECX, Heap::EndOffset(space))); \ | 239 __ cmpl(EBX, Address(ECX, Heap::EndOffset(space))); \ |
| 241 __ j(ABOVE_EQUAL, &fall_through); \ | 240 __ j(ABOVE_EQUAL, &fall_through); \ |
| 242 \ | 241 \ |
| 243 /* Successfully allocated the object(s), now update top to point to */ \ | 242 /* Successfully allocated the object(s), now update top to point to */ \ |
| 244 /* next object start and initialize the object. */ \ | 243 /* next object start and initialize the object. */ \ |
| 245 __ movl(Address(ECX, Heap::TopOffset(space)), EBX); \ | 244 __ movl(Address(ECX, Heap::TopOffset(space)), EBX); \ |
| 246 __ addl(EAX, Immediate(kHeapObjectTag)); \ | 245 __ addl(EAX, Immediate(kHeapObjectTag)); \ |
| 247 __ UpdateAllocationStatsWithSize(cid, EDI, ECX, space, \ | 246 __ UpdateAllocationStatsWithSize(cid, EDI, ECX, space); \ |
| 248 /* inline_isolate = */ false); \ | |
| 249 \ | 247 \ |
| 250 /* Initialize the tags. */ \ | 248 /* Initialize the tags. */ \ |
| 251 /* EAX: new object start as a tagged pointer. */ \ | 249 /* EAX: new object start as a tagged pointer. */ \ |
| 252 /* EBX: new object end address. */ \ | 250 /* EBX: new object end address. */ \ |
| 253 /* EDI: allocation size. */ \ | 251 /* EDI: allocation size. */ \ |
| 254 { \ | 252 { \ |
| 255 Label size_tag_overflow, done; \ | 253 Label size_tag_overflow, done; \ |
| 256 __ cmpl(EDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); \ | 254 __ cmpl(EDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); \ |
| 257 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); \ | 255 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); \ |
| 258 __ shll(EDI, Immediate(RawObject::kSizeTagPos - kObjectAlignmentLog2)); \ | 256 __ shll(EDI, Immediate(RawObject::kSizeTagPos - kObjectAlignmentLog2)); \ |
| (...skipping 1623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1882 } | 1880 } |
| 1883 | 1881 |
| 1884 | 1882 |
| 1885 // Allocates one-byte string of length 'end - start'. The content is not | 1883 // Allocates one-byte string of length 'end - start'. The content is not |
| 1886 // initialized. 'length-reg' contains tagged length. | 1884 // initialized. 'length-reg' contains tagged length. |
| 1887 // Returns new string as tagged pointer in EAX. | 1885 // Returns new string as tagged pointer in EAX. |
| 1888 static void TryAllocateOnebyteString(Assembler* assembler, | 1886 static void TryAllocateOnebyteString(Assembler* assembler, |
| 1889 Label* ok, | 1887 Label* ok, |
| 1890 Label* failure, | 1888 Label* failure, |
| 1891 Register length_reg) { | 1889 Register length_reg) { |
| 1892 __ MaybeTraceAllocation(kOneByteStringCid, EAX, failure, false, | 1890 __ MaybeTraceAllocation(kOneByteStringCid, EAX, failure, false); |
| 1893 /* inline_isolate = */ false); | |
| 1894 if (length_reg != EDI) { | 1891 if (length_reg != EDI) { |
| 1895 __ movl(EDI, length_reg); | 1892 __ movl(EDI, length_reg); |
| 1896 } | 1893 } |
| 1897 Label pop_and_fail; | 1894 Label pop_and_fail; |
| 1898 __ pushl(EDI); // Preserve length. | 1895 __ pushl(EDI); // Preserve length. |
| 1899 __ SmiUntag(EDI); | 1896 __ SmiUntag(EDI); |
| 1900 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; | 1897 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; |
| 1901 __ leal(EDI, Address(EDI, TIMES_1, fixed_size)); // EDI is untagged. | 1898 __ leal(EDI, Address(EDI, TIMES_1, fixed_size)); // EDI is untagged. |
| 1902 __ andl(EDI, Immediate(-kObjectAlignment)); | 1899 __ andl(EDI, Immediate(-kObjectAlignment)); |
| 1903 | 1900 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1917 // EDI: allocation size. | 1914 // EDI: allocation size. |
| 1918 // ECX: heap. | 1915 // ECX: heap. |
| 1919 __ cmpl(EBX, Address(ECX, Heap::EndOffset(space))); | 1916 __ cmpl(EBX, Address(ECX, Heap::EndOffset(space))); |
| 1920 __ j(ABOVE_EQUAL, &pop_and_fail); | 1917 __ j(ABOVE_EQUAL, &pop_and_fail); |
| 1921 | 1918 |
| 1922 // Successfully allocated the object(s), now update top to point to | 1919 // Successfully allocated the object(s), now update top to point to |
| 1923 // next object start and initialize the object. | 1920 // next object start and initialize the object. |
| 1924 __ movl(Address(ECX, Heap::TopOffset(space)), EBX); | 1921 __ movl(Address(ECX, Heap::TopOffset(space)), EBX); |
| 1925 __ addl(EAX, Immediate(kHeapObjectTag)); | 1922 __ addl(EAX, Immediate(kHeapObjectTag)); |
| 1926 | 1923 |
| 1927 __ UpdateAllocationStatsWithSize(cid, EDI, ECX, space, | 1924 __ UpdateAllocationStatsWithSize(cid, EDI, ECX, space); |
| 1928 /* inline_isolate = */ false); | |
| 1929 | 1925 |
| 1930 // Initialize the tags. | 1926 // Initialize the tags. |
| 1931 // EAX: new object start as a tagged pointer. | 1927 // EAX: new object start as a tagged pointer. |
| 1932 // EBX: new object end address. | 1928 // EBX: new object end address. |
| 1933 // EDI: allocation size. | 1929 // EDI: allocation size. |
| 1934 { | 1930 { |
| 1935 Label size_tag_overflow, done; | 1931 Label size_tag_overflow, done; |
| 1936 __ cmpl(EDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); | 1932 __ cmpl(EDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); |
| 1937 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); | 1933 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); |
| 1938 __ shll(EDI, Immediate(RawObject::kSizeTagPos - kObjectAlignmentLog2)); | 1934 __ shll(EDI, Immediate(RawObject::kSizeTagPos - kObjectAlignmentLog2)); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2161 void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) { | 2157 void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) { |
| 2162 __ LoadIsolate(EAX); | 2158 __ LoadIsolate(EAX); |
| 2163 __ movl(EAX, Address(EAX, Isolate::current_tag_offset())); | 2159 __ movl(EAX, Address(EAX, Isolate::current_tag_offset())); |
| 2164 __ ret(); | 2160 __ ret(); |
| 2165 } | 2161 } |
| 2166 | 2162 |
| 2167 #undef __ | 2163 #undef __ |
| 2168 } // namespace dart | 2164 } // namespace dart |
| 2169 | 2165 |
| 2170 #endif // defined TARGET_ARCH_IA32 | 2166 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |