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 __ cmpl(EBX, Address(THR, Thread::end_offset())); \ |
233 __ cmpl(EBX, Address(ECX, Heap::EndOffset(space))); \ | |
234 __ j(ABOVE_EQUAL, &fall_through); \ | 232 __ j(ABOVE_EQUAL, &fall_through); \ |
235 \ | 233 \ |
236 /* Successfully allocated the object(s), now update top to point to */ \ | 234 /* Successfully allocated the object(s), now update top to point to */ \ |
237 /* next object start and initialize the object. */ \ | 235 /* next object start and initialize the object. */ \ |
238 __ movl(Address(ECX, Heap::TopOffset(space)), EBX); \ | 236 __ movl(Address(THR, Thread::top_offset()), EBX); \ |
239 __ addl(EAX, Immediate(kHeapObjectTag)); \ | 237 __ addl(EAX, Immediate(kHeapObjectTag)); \ |
240 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, EDI, ECX, space)); \ | 238 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, EDI, ECX, space)); \ |
241 \ | 239 \ |
242 /* Initialize the tags. */ \ | 240 /* Initialize the tags. */ \ |
243 /* EAX: new object start as a tagged pointer. */ \ | 241 /* EAX: new object start as a tagged pointer. */ \ |
244 /* EBX: new object end address. */ \ | 242 /* EBX: new object end address. */ \ |
245 /* EDI: allocation size. */ \ | 243 /* EDI: allocation size. */ \ |
246 { \ | 244 { \ |
247 Label size_tag_overflow, done; \ | 245 Label size_tag_overflow, done; \ |
248 __ cmpl(EDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); \ | 246 __ cmpl(EDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); \ |
(...skipping 1789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2038 Label pop_and_fail; | 2036 Label pop_and_fail; |
2039 __ pushl(EDI); // Preserve length. | 2037 __ pushl(EDI); // Preserve length. |
2040 __ SmiUntag(EDI); | 2038 __ SmiUntag(EDI); |
2041 const intptr_t fixed_size_plus_alignment_padding = | 2039 const intptr_t fixed_size_plus_alignment_padding = |
2042 sizeof(RawString) + kObjectAlignment - 1; | 2040 sizeof(RawString) + kObjectAlignment - 1; |
2043 __ leal(EDI, Address(EDI, TIMES_1, | 2041 __ leal(EDI, Address(EDI, TIMES_1, |
2044 fixed_size_plus_alignment_padding)); // EDI is untagged. | 2042 fixed_size_plus_alignment_padding)); // EDI is untagged. |
2045 __ andl(EDI, Immediate(-kObjectAlignment)); | 2043 __ andl(EDI, Immediate(-kObjectAlignment)); |
2046 | 2044 |
2047 const intptr_t cid = kOneByteStringCid; | 2045 const intptr_t cid = kOneByteStringCid; |
2048 Heap::Space space = Heap::kNew; | 2046 NOT_IN_PRODUCT(Heap::Space space = Heap::kNew); |
2049 __ movl(ECX, Address(THR, Thread::heap_offset())); | 2047 __ movl(EAX, Address(THR, Thread::top_offset())); |
2050 __ movl(EAX, Address(ECX, Heap::TopOffset(space))); | |
2051 __ movl(EBX, EAX); | 2048 __ movl(EBX, EAX); |
2052 | 2049 |
2053 // EDI: allocation size. | 2050 // EDI: allocation size. |
2054 __ addl(EBX, EDI); | 2051 __ addl(EBX, EDI); |
2055 __ j(CARRY, &pop_and_fail); | 2052 __ j(CARRY, &pop_and_fail); |
2056 | 2053 |
2057 // Check if the allocation fits into the remaining space. | 2054 // Check if the allocation fits into the remaining space. |
2058 // EAX: potential new object start. | 2055 // EAX: potential new object start. |
2059 // EBX: potential next object start. | 2056 // EBX: potential next object start. |
2060 // EDI: allocation size. | 2057 // EDI: allocation size. |
2061 // ECX: heap. | 2058 __ cmpl(EBX, Address(THR, Thread::end_offset())); |
2062 __ cmpl(EBX, Address(ECX, Heap::EndOffset(space))); | |
2063 __ j(ABOVE_EQUAL, &pop_and_fail); | 2059 __ j(ABOVE_EQUAL, &pop_and_fail); |
2064 | 2060 |
2065 // Successfully allocated the object(s), now update top to point to | 2061 // Successfully allocated the object(s), now update top to point to |
2066 // next object start and initialize the object. | 2062 // next object start and initialize the object. |
2067 __ movl(Address(ECX, Heap::TopOffset(space)), EBX); | 2063 __ movl(Address(THR, Thread::top_offset()), EBX); |
2068 __ addl(EAX, Immediate(kHeapObjectTag)); | 2064 __ addl(EAX, Immediate(kHeapObjectTag)); |
2069 | 2065 |
2070 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, EDI, ECX, space)); | 2066 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, EDI, ECX, space)); |
2071 | 2067 |
2072 // Initialize the tags. | 2068 // Initialize the tags. |
2073 // EAX: new object start as a tagged pointer. | 2069 // EAX: new object start as a tagged pointer. |
2074 // EBX: new object end address. | 2070 // EBX: new object end address. |
2075 // EDI: allocation size. | 2071 // EDI: allocation size. |
2076 { | 2072 { |
2077 Label size_tag_overflow, done; | 2073 Label size_tag_overflow, done; |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2341 __ movl(Address(THR, Thread::async_stack_trace_offset()), EAX); | 2337 __ movl(Address(THR, Thread::async_stack_trace_offset()), EAX); |
2342 __ LoadObject(EAX, Object::null_object()); | 2338 __ LoadObject(EAX, Object::null_object()); |
2343 __ ret(); | 2339 __ ret(); |
2344 } | 2340 } |
2345 | 2341 |
2346 #undef __ | 2342 #undef __ |
2347 | 2343 |
2348 } // namespace dart | 2344 } // namespace dart |
2349 | 2345 |
2350 #endif // defined TARGET_ARCH_IA32 | 2346 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |