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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 if (scale_factor == TIMES_16) { \ | 209 if (scale_factor == TIMES_16) { \ |
210 /* double length of array. */ \ | 210 /* double length of array. */ \ |
211 __ addl(EDI, EDI); \ | 211 __ addl(EDI, EDI); \ |
212 /* only scale by 8. */ \ | 212 /* only scale by 8. */ \ |
213 scale_factor = TIMES_8; \ | 213 scale_factor = TIMES_8; \ |
214 } \ | 214 } \ |
215 const intptr_t fixed_size_plus_alignment_padding = \ | 215 const intptr_t fixed_size_plus_alignment_padding = \ |
216 sizeof(Raw##type_name) + kObjectAlignment - 1; \ | 216 sizeof(Raw##type_name) + kObjectAlignment - 1; \ |
217 __ leal(EDI, Address(EDI, scale_factor, fixed_size_plus_alignment_padding)); \ | 217 __ leal(EDI, Address(EDI, scale_factor, fixed_size_plus_alignment_padding)); \ |
218 __ andl(EDI, Immediate(-kObjectAlignment)); \ | 218 __ andl(EDI, Immediate(-kObjectAlignment)); \ |
219 Heap::Space space = Heap::kNew; \ | 219 NOT_IN_PRODUCT(Heap::Space space = Heap::kNew); \ |
220 __ movl(ECX, Address(THR, Thread::heap_offset())); \ | 220 __ movl(EAX, Address(THR, Thread::top_offset())); \ |
221 __ movl(EAX, Address(ECX, Heap::TopOffset(space))); \ | |
222 __ movl(EBX, EAX); \ | 221 __ movl(EBX, EAX); \ |
223 \ | 222 \ |
224 /* EDI: allocation size. */ \ | 223 /* EDI: allocation size. */ \ |
225 __ addl(EBX, EDI); \ | 224 __ addl(EBX, EDI); \ |
226 __ j(CARRY, &fall_through); \ | 225 __ j(CARRY, &fall_through); \ |
227 \ | 226 \ |
228 /* Check if the allocation fits into the remaining space. */ \ | 227 /* Check if the allocation fits into the remaining space. */ \ |
229 /* EAX: potential new object start. */ \ | 228 /* EAX: potential new object start. */ \ |
230 /* EBX: potential next object start. */ \ | 229 /* EBX: potential next object start. */ \ |
231 /* EDI: allocation size. */ \ | 230 /* EDI: allocation size. */ \ |
232 /* ECX: heap. */ \ | 231 /* ECX: heap. */ \ |
233 __ cmpl(EBX, Address(ECX, Heap::EndOffset(space))); \ | 232 __ cmpl(EBX, Address(THR, Thread::end_offset())); \ |
234 __ j(ABOVE_EQUAL, &fall_through); \ | 233 __ j(ABOVE_EQUAL, &fall_through); \ |
235 \ | 234 \ |
236 /* Successfully allocated the object(s), now update top to point to */ \ | 235 /* Successfully allocated the object(s), now update top to point to */ \ |
237 /* next object start and initialize the object. */ \ | 236 /* next object start and initialize the object. */ \ |
238 __ movl(Address(ECX, Heap::TopOffset(space)), EBX); \ | 237 __ movl(Address(THR, Thread::top_offset()), EBX); \ |
239 __ addl(EAX, Immediate(kHeapObjectTag)); \ | 238 __ addl(EAX, Immediate(kHeapObjectTag)); \ |
240 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, EDI, ECX, space)); \ | 239 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, EDI, ECX, space)); \ |
241 \ | 240 \ |
242 /* Initialize the tags. */ \ | 241 /* Initialize the tags. */ \ |
243 /* EAX: new object start as a tagged pointer. */ \ | 242 /* EAX: new object start as a tagged pointer. */ \ |
244 /* EBX: new object end address. */ \ | 243 /* EBX: new object end address. */ \ |
245 /* EDI: allocation size. */ \ | 244 /* EDI: allocation size. */ \ |
246 { \ | 245 { \ |
247 Label size_tag_overflow, done; \ | 246 Label size_tag_overflow, done; \ |
248 __ cmpl(EDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); \ | 247 __ cmpl(EDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); \ |
(...skipping 1780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2029 __ pushl(EDI); // Preserve length. | 2028 __ pushl(EDI); // Preserve length. |
2030 __ SmiUntag(EDI); | 2029 __ SmiUntag(EDI); |
2031 const intptr_t fixed_size_plus_alignment_padding = | 2030 const intptr_t fixed_size_plus_alignment_padding = |
2032 sizeof(RawString) + kObjectAlignment - 1; | 2031 sizeof(RawString) + kObjectAlignment - 1; |
2033 __ leal(EDI, Address(EDI, TIMES_1, | 2032 __ leal(EDI, Address(EDI, TIMES_1, |
2034 fixed_size_plus_alignment_padding)); // EDI is untagged. | 2033 fixed_size_plus_alignment_padding)); // EDI is untagged. |
2035 __ andl(EDI, Immediate(-kObjectAlignment)); | 2034 __ andl(EDI, Immediate(-kObjectAlignment)); |
2036 | 2035 |
2037 const intptr_t cid = kOneByteStringCid; | 2036 const intptr_t cid = kOneByteStringCid; |
2038 Heap::Space space = Heap::kNew; | 2037 Heap::Space space = Heap::kNew; |
2039 __ movl(ECX, Address(THR, Thread::heap_offset())); | 2038 __ movl(EAX, Address(THR, Thread::top_offset())); |
2040 __ movl(EAX, Address(ECX, Heap::TopOffset(space))); | |
2041 __ movl(EBX, EAX); | 2039 __ movl(EBX, EAX); |
2042 | 2040 |
2043 // EDI: allocation size. | 2041 // EDI: allocation size. |
2044 __ addl(EBX, EDI); | 2042 __ addl(EBX, EDI); |
2045 __ j(CARRY, &pop_and_fail); | 2043 __ j(CARRY, &pop_and_fail); |
2046 | 2044 |
2047 // Check if the allocation fits into the remaining space. | 2045 // Check if the allocation fits into the remaining space. |
2048 // EAX: potential new object start. | 2046 // EAX: potential new object start. |
2049 // EBX: potential next object start. | 2047 // EBX: potential next object start. |
2050 // EDI: allocation size. | 2048 // EDI: allocation size. |
2051 // ECX: heap. | 2049 // ECX: heap. |
2052 __ cmpl(EBX, Address(ECX, Heap::EndOffset(space))); | 2050 __ cmpl(EBX, Address(THR, Thread::end_offset())); |
2053 __ j(ABOVE_EQUAL, &pop_and_fail); | 2051 __ j(ABOVE_EQUAL, &pop_and_fail); |
2054 | 2052 |
2055 // Successfully allocated the object(s), now update top to point to | 2053 // Successfully allocated the object(s), now update top to point to |
2056 // next object start and initialize the object. | 2054 // next object start and initialize the object. |
2057 __ movl(Address(ECX, Heap::TopOffset(space)), EBX); | 2055 __ movl(Address(THR, Thread::top_offset()), EBX); |
2058 __ addl(EAX, Immediate(kHeapObjectTag)); | 2056 __ addl(EAX, Immediate(kHeapObjectTag)); |
2059 | 2057 |
2060 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, EDI, ECX, space)); | 2058 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, EDI, ECX, space)); |
2061 | 2059 |
2062 // Initialize the tags. | 2060 // Initialize the tags. |
2063 // EAX: new object start as a tagged pointer. | 2061 // EAX: new object start as a tagged pointer. |
2064 // EBX: new object end address. | 2062 // EBX: new object end address. |
2065 // EDI: allocation size. | 2063 // EDI: allocation size. |
2066 { | 2064 { |
2067 Label size_tag_overflow, done; | 2065 Label size_tag_overflow, done; |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2331 __ movl(Address(THR, Thread::async_stack_trace_offset()), EAX); | 2329 __ movl(Address(THR, Thread::async_stack_trace_offset()), EAX); |
2332 __ LoadObject(EAX, Object::null_object()); | 2330 __ LoadObject(EAX, Object::null_object()); |
2333 __ ret(); | 2331 __ ret(); |
2334 } | 2332 } |
2335 | 2333 |
2336 #undef __ | 2334 #undef __ |
2337 | 2335 |
2338 } // namespace dart | 2336 } // namespace dart |
2339 | 2337 |
2340 #endif // defined TARGET_ARCH_IA32 | 2338 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |