Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: runtime/vm/intrinsifier_ia32.cc

Issue 2951333002: Moves the top_ and end_ words of the Scavenger into mutator thread. (Closed)
Patch Set: Address comments from CL Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after
2039 __ pushl(EDI); // Preserve length. 2038 __ pushl(EDI); // Preserve length.
2040 __ SmiUntag(EDI); 2039 __ SmiUntag(EDI);
2041 const intptr_t fixed_size_plus_alignment_padding = 2040 const intptr_t fixed_size_plus_alignment_padding =
2042 sizeof(RawString) + kObjectAlignment - 1; 2041 sizeof(RawString) + kObjectAlignment - 1;
2043 __ leal(EDI, Address(EDI, TIMES_1, 2042 __ leal(EDI, Address(EDI, TIMES_1,
2044 fixed_size_plus_alignment_padding)); // EDI is untagged. 2043 fixed_size_plus_alignment_padding)); // EDI is untagged.
2045 __ andl(EDI, Immediate(-kObjectAlignment)); 2044 __ andl(EDI, Immediate(-kObjectAlignment));
2046 2045
2047 const intptr_t cid = kOneByteStringCid; 2046 const intptr_t cid = kOneByteStringCid;
2048 Heap::Space space = Heap::kNew; 2047 Heap::Space space = Heap::kNew;
2049 __ movl(ECX, Address(THR, Thread::heap_offset())); 2048 __ movl(EAX, Address(THR, Thread::top_offset()));
2050 __ movl(EAX, Address(ECX, Heap::TopOffset(space)));
2051 __ movl(EBX, EAX); 2049 __ movl(EBX, EAX);
2052 2050
2053 // EDI: allocation size. 2051 // EDI: allocation size.
2054 __ addl(EBX, EDI); 2052 __ addl(EBX, EDI);
2055 __ j(CARRY, &pop_and_fail); 2053 __ j(CARRY, &pop_and_fail);
2056 2054
2057 // Check if the allocation fits into the remaining space. 2055 // Check if the allocation fits into the remaining space.
2058 // EAX: potential new object start. 2056 // EAX: potential new object start.
2059 // EBX: potential next object start. 2057 // EBX: potential next object start.
2060 // EDI: allocation size. 2058 // EDI: allocation size.
2061 // ECX: heap. 2059 // ECX: heap.
2062 __ cmpl(EBX, Address(ECX, Heap::EndOffset(space))); 2060 __ cmpl(EBX, Address(THR, Thread::end_offset()));
2063 __ j(ABOVE_EQUAL, &pop_and_fail); 2061 __ j(ABOVE_EQUAL, &pop_and_fail);
2064 2062
2065 // Successfully allocated the object(s), now update top to point to 2063 // Successfully allocated the object(s), now update top to point to
2066 // next object start and initialize the object. 2064 // next object start and initialize the object.
2067 __ movl(Address(ECX, Heap::TopOffset(space)), EBX); 2065 __ movl(Address(THR, Thread::top_offset()), EBX);
2068 __ addl(EAX, Immediate(kHeapObjectTag)); 2066 __ addl(EAX, Immediate(kHeapObjectTag));
2069 2067
2070 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, EDI, ECX, space)); 2068 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, EDI, ECX, space));
2071 2069
2072 // Initialize the tags. 2070 // Initialize the tags.
2073 // EAX: new object start as a tagged pointer. 2071 // EAX: new object start as a tagged pointer.
2074 // EBX: new object end address. 2072 // EBX: new object end address.
2075 // EDI: allocation size. 2073 // EDI: allocation size.
2076 { 2074 {
2077 Label size_tag_overflow, done; 2075 Label size_tag_overflow, done;
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
2341 __ movl(Address(THR, Thread::async_stack_trace_offset()), EAX); 2339 __ movl(Address(THR, Thread::async_stack_trace_offset()), EAX);
2342 __ LoadObject(EAX, Object::null_object()); 2340 __ LoadObject(EAX, Object::null_object());
2343 __ ret(); 2341 __ ret();
2344 } 2342 }
2345 2343
2346 #undef __ 2344 #undef __
2347 2345
2348 } // namespace dart 2346 } // namespace dart
2349 2347
2350 #endif // defined TARGET_ARCH_IA32 2348 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698