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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 if (scale_factor == TIMES_16) { \ | 201 if (scale_factor == TIMES_16) { \ |
202 /* double length of array. */ \ | 202 /* double length of array. */ \ |
203 __ addl(EDI, EDI); \ | 203 __ addl(EDI, EDI); \ |
204 /* only scale by 8. */ \ | 204 /* only scale by 8. */ \ |
205 scale_factor = TIMES_8; \ | 205 scale_factor = TIMES_8; \ |
206 } \ | 206 } \ |
207 const intptr_t fixed_size_plus_alignment_padding = \ | 207 const intptr_t fixed_size_plus_alignment_padding = \ |
208 sizeof(Raw##type_name) + kObjectAlignment - 1; \ | 208 sizeof(Raw##type_name) + kObjectAlignment - 1; \ |
209 __ leal(EDI, Address(EDI, scale_factor, fixed_size_plus_alignment_padding)); \ | 209 __ leal(EDI, Address(EDI, scale_factor, fixed_size_plus_alignment_padding)); \ |
210 __ andl(EDI, Immediate(-kObjectAlignment)); \ | 210 __ andl(EDI, Immediate(-kObjectAlignment)); \ |
211 Heap::Space space = Heap::kNew; \ | 211 NOT_IN_PRODUCT(Heap::Space space = Heap::kNew); \ |
212 __ movl(ECX, Address(THR, Thread::heap_offset())); \ | 212 __ movl(EAX, Address(THR, Thread::top_offset())); \ |
213 __ movl(EAX, Address(ECX, Heap::TopOffset(space))); \ | |
214 __ movl(EBX, EAX); \ | 213 __ movl(EBX, EAX); \ |
215 \ | 214 \ |
216 /* EDI: allocation size. */ \ | 215 /* EDI: allocation size. */ \ |
217 __ addl(EBX, EDI); \ | 216 __ addl(EBX, EDI); \ |
218 __ j(CARRY, &fall_through); \ | 217 __ j(CARRY, &fall_through); \ |
219 \ | 218 \ |
220 /* Check if the allocation fits into the remaining space. */ \ | 219 /* Check if the allocation fits into the remaining space. */ \ |
221 /* EAX: potential new object start. */ \ | 220 /* EAX: potential new object start. */ \ |
222 /* EBX: potential next object start. */ \ | 221 /* EBX: potential next object start. */ \ |
223 /* EDI: allocation size. */ \ | 222 /* EDI: allocation size. */ \ |
224 /* ECX: heap. */ \ | 223 __ cmpl(EBX, Address(THR, Thread::end_offset())); \ |
225 __ cmpl(EBX, Address(ECX, Heap::EndOffset(space))); \ | |
226 __ j(ABOVE_EQUAL, &fall_through); \ | 224 __ j(ABOVE_EQUAL, &fall_through); \ |
227 \ | 225 \ |
228 /* Successfully allocated the object(s), now update top to point to */ \ | 226 /* Successfully allocated the object(s), now update top to point to */ \ |
229 /* next object start and initialize the object. */ \ | 227 /* next object start and initialize the object. */ \ |
230 __ movl(Address(ECX, Heap::TopOffset(space)), EBX); \ | 228 __ movl(Address(THR, Thread::top_offset()), EBX); \ |
231 __ addl(EAX, Immediate(kHeapObjectTag)); \ | 229 __ addl(EAX, Immediate(kHeapObjectTag)); \ |
232 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, EDI, ECX, space)); \ | 230 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, EDI, ECX, space)); \ |
233 \ | 231 \ |
234 /* Initialize the tags. */ \ | 232 /* Initialize the tags. */ \ |
235 /* EAX: new object start as a tagged pointer. */ \ | 233 /* EAX: new object start as a tagged pointer. */ \ |
236 /* EBX: new object end address. */ \ | 234 /* EBX: new object end address. */ \ |
237 /* EDI: allocation size. */ \ | 235 /* EDI: allocation size. */ \ |
238 { \ | 236 { \ |
239 Label size_tag_overflow, done; \ | 237 Label size_tag_overflow, done; \ |
240 __ cmpl(EDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); \ | 238 __ cmpl(EDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); \ |
(...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1952 Label pop_and_fail; | 1950 Label pop_and_fail; |
1953 __ pushl(EDI); // Preserve length. | 1951 __ pushl(EDI); // Preserve length. |
1954 __ SmiUntag(EDI); | 1952 __ SmiUntag(EDI); |
1955 const intptr_t fixed_size_plus_alignment_padding = | 1953 const intptr_t fixed_size_plus_alignment_padding = |
1956 sizeof(RawString) + kObjectAlignment - 1; | 1954 sizeof(RawString) + kObjectAlignment - 1; |
1957 __ leal(EDI, Address(EDI, TIMES_1, | 1955 __ leal(EDI, Address(EDI, TIMES_1, |
1958 fixed_size_plus_alignment_padding)); // EDI is untagged. | 1956 fixed_size_plus_alignment_padding)); // EDI is untagged. |
1959 __ andl(EDI, Immediate(-kObjectAlignment)); | 1957 __ andl(EDI, Immediate(-kObjectAlignment)); |
1960 | 1958 |
1961 const intptr_t cid = kOneByteStringCid; | 1959 const intptr_t cid = kOneByteStringCid; |
1962 Heap::Space space = Heap::kNew; | 1960 NOT_IN_PRODUCT(Heap::Space space = Heap::kNew); |
1963 __ movl(ECX, Address(THR, Thread::heap_offset())); | 1961 __ movl(EAX, Address(THR, Thread::top_offset())); |
1964 __ movl(EAX, Address(ECX, Heap::TopOffset(space))); | |
1965 __ movl(EBX, EAX); | 1962 __ movl(EBX, EAX); |
1966 | 1963 |
1967 // EDI: allocation size. | 1964 // EDI: allocation size. |
1968 __ addl(EBX, EDI); | 1965 __ addl(EBX, EDI); |
1969 __ j(CARRY, &pop_and_fail); | 1966 __ j(CARRY, &pop_and_fail); |
1970 | 1967 |
1971 // Check if the allocation fits into the remaining space. | 1968 // Check if the allocation fits into the remaining space. |
1972 // EAX: potential new object start. | 1969 // EAX: potential new object start. |
1973 // EBX: potential next object start. | 1970 // EBX: potential next object start. |
1974 // EDI: allocation size. | 1971 // EDI: allocation size. |
1975 // ECX: heap. | 1972 __ cmpl(EBX, Address(THR, Thread::end_offset())); |
1976 __ cmpl(EBX, Address(ECX, Heap::EndOffset(space))); | |
1977 __ j(ABOVE_EQUAL, &pop_and_fail); | 1973 __ j(ABOVE_EQUAL, &pop_and_fail); |
1978 | 1974 |
1979 // Successfully allocated the object(s), now update top to point to | 1975 // Successfully allocated the object(s), now update top to point to |
1980 // next object start and initialize the object. | 1976 // next object start and initialize the object. |
1981 __ movl(Address(ECX, Heap::TopOffset(space)), EBX); | 1977 __ movl(Address(THR, Thread::top_offset()), EBX); |
1982 __ addl(EAX, Immediate(kHeapObjectTag)); | 1978 __ addl(EAX, Immediate(kHeapObjectTag)); |
1983 | 1979 |
1984 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, EDI, ECX, space)); | 1980 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, EDI, ECX, space)); |
1985 | 1981 |
1986 // Initialize the tags. | 1982 // Initialize the tags. |
1987 // EAX: new object start as a tagged pointer. | 1983 // EAX: new object start as a tagged pointer. |
1988 // EBX: new object end address. | 1984 // EBX: new object end address. |
1989 // EDI: allocation size. | 1985 // EDI: allocation size. |
1990 { | 1986 { |
1991 Label size_tag_overflow, done; | 1987 Label size_tag_overflow, done; |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2243 __ movl(Address(THR, Thread::async_stack_trace_offset()), EAX); | 2239 __ movl(Address(THR, Thread::async_stack_trace_offset()), EAX); |
2244 __ LoadObject(EAX, Object::null_object()); | 2240 __ LoadObject(EAX, Object::null_object()); |
2245 __ ret(); | 2241 __ ret(); |
2246 } | 2242 } |
2247 | 2243 |
2248 #undef __ | 2244 #undef __ |
2249 | 2245 |
2250 } // namespace dart | 2246 } // namespace dart |
2251 | 2247 |
2252 #endif // defined TARGET_ARCH_IA32 | 2248 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |