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

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

Issue 2951333002: Moves the top_ and end_ words of the Scavenger into mutator thread. (Closed)
Patch Set: Full removal of heap's top/end offsets. Changed allocs in other archs. 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 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/intrinsifier.h" 8 #include "vm/intrinsifier.h"
9 9
10 #include "vm/assembler.h" 10 #include "vm/assembler.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 /* double length of array. */ \ 168 /* double length of array. */ \
169 __ addq(RDI, RDI); \ 169 __ addq(RDI, RDI); \
170 /* only scale by 8. */ \ 170 /* only scale by 8. */ \
171 scale_factor = TIMES_8; \ 171 scale_factor = TIMES_8; \
172 } \ 172 } \
173 const intptr_t fixed_size_plus_alignment_padding = \ 173 const intptr_t fixed_size_plus_alignment_padding = \
174 sizeof(Raw##type_name) + kObjectAlignment - 1; \ 174 sizeof(Raw##type_name) + kObjectAlignment - 1; \
175 __ leaq(RDI, Address(RDI, scale_factor, fixed_size_plus_alignment_padding)); \ 175 __ leaq(RDI, Address(RDI, scale_factor, fixed_size_plus_alignment_padding)); \
176 __ andq(RDI, Immediate(-kObjectAlignment)); \ 176 __ andq(RDI, Immediate(-kObjectAlignment)); \
177 Heap::Space space = Heap::kNew; \ 177 Heap::Space space = Heap::kNew; \
178 __ movq(R13, Address(THR, Thread::heap_offset())); \ 178 __ movq(RAX, Address(THR, Thread::top_offset())); \
179 __ movq(RAX, Address(R13, Heap::TopOffset(space))); \
180 __ movq(RCX, RAX); \ 179 __ movq(RCX, RAX); \
181 \ 180 \
182 /* RDI: allocation size. */ \ 181 /* RDI: allocation size. */ \
183 __ addq(RCX, RDI); \ 182 __ addq(RCX, RDI); \
184 __ j(CARRY, &fall_through); \ 183 __ j(CARRY, &fall_through); \
185 \ 184 \
186 /* Check if the allocation fits into the remaining space. */ \ 185 /* Check if the allocation fits into the remaining space. */ \
187 /* RAX: potential new object start. */ \ 186 /* RAX: potential new object start. */ \
188 /* RCX: potential next object start. */ \ 187 /* RCX: potential next object start. */ \
189 /* RDI: allocation size. */ \ 188 /* RDI: allocation size. */ \
190 /* R13: heap. */ \ 189 /* R13: heap. */ \
191 __ cmpq(RCX, Address(R13, Heap::EndOffset(space))); \ 190 __ cmpq(RCX, Address(THR, Thread::end_offset())); \
192 __ j(ABOVE_EQUAL, &fall_through); \ 191 __ j(ABOVE_EQUAL, &fall_through); \
193 \ 192 \
194 /* Successfully allocated the object(s), now update top to point to */ \ 193 /* Successfully allocated the object(s), now update top to point to */ \
195 /* next object start and initialize the object. */ \ 194 /* next object start and initialize the object. */ \
196 __ movq(Address(R13, Heap::TopOffset(space)), RCX); \ 195 __ movq(Address(THR, Thread::top_offset()), RCX); \
197 __ addq(RAX, Immediate(kHeapObjectTag)); \ 196 __ addq(RAX, Immediate(kHeapObjectTag)); \
198 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, RDI, space)); \ 197 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, RDI, space)); \
199 /* Initialize the tags. */ \ 198 /* Initialize the tags. */ \
200 /* RAX: new object start as a tagged pointer. */ \ 199 /* RAX: new object start as a tagged pointer. */ \
201 /* RCX: new object end address. */ \ 200 /* RCX: new object end address. */ \
202 /* RDI: allocation size. */ \ 201 /* RDI: allocation size. */ \
203 /* R13: scratch register. */ \ 202 /* R13: scratch register. */ \
204 { \ 203 { \
205 Label size_tag_overflow, done; \ 204 Label size_tag_overflow, done; \
206 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); \ 205 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); \
(...skipping 1795 matching lines...) Expand 10 before | Expand all | Expand 10 after
2002 __ j(NOT_ZERO, &not_zero_length); 2001 __ j(NOT_ZERO, &not_zero_length);
2003 __ addq(RDI, Immediate(1)); 2002 __ addq(RDI, Immediate(1));
2004 __ Bind(&not_zero_length); 2003 __ Bind(&not_zero_length);
2005 const intptr_t fixed_size_plus_alignment_padding = 2004 const intptr_t fixed_size_plus_alignment_padding =
2006 sizeof(RawString) + kObjectAlignment - 1; 2005 sizeof(RawString) + kObjectAlignment - 1;
2007 __ addq(RDI, Immediate(fixed_size_plus_alignment_padding)); 2006 __ addq(RDI, Immediate(fixed_size_plus_alignment_padding));
2008 __ andq(RDI, Immediate(-kObjectAlignment)); 2007 __ andq(RDI, Immediate(-kObjectAlignment));
2009 2008
2010 const intptr_t cid = kOneByteStringCid; 2009 const intptr_t cid = kOneByteStringCid;
2011 Heap::Space space = Heap::kNew; 2010 Heap::Space space = Heap::kNew;
2012 __ movq(R13, Address(THR, Thread::heap_offset())); 2011 __ movq(RAX, Address(THR, Thread::top_offset()));
2013 __ movq(RAX, Address(R13, Heap::TopOffset(space)));
2014 2012
2015 // RDI: allocation size. 2013 // RDI: allocation size.
2016 __ movq(RCX, RAX); 2014 __ movq(RCX, RAX);
2017 __ addq(RCX, RDI); 2015 __ addq(RCX, RDI);
2018 __ j(CARRY, &pop_and_fail); 2016 __ j(CARRY, &pop_and_fail);
2019 2017
2020 // Check if the allocation fits into the remaining space. 2018 // Check if the allocation fits into the remaining space.
2021 // RAX: potential new object start. 2019 // RAX: potential new object start.
2022 // RCX: potential next object start. 2020 // RCX: potential next object start.
2023 // RDI: allocation size. 2021 // RDI: allocation size.
2024 // R13: heap. 2022 __ cmpq(RCX, Address(THR, Thread::end_offset()));
2025 __ cmpq(RCX, Address(R13, Heap::EndOffset(space)));
2026 __ j(ABOVE_EQUAL, &pop_and_fail); 2023 __ j(ABOVE_EQUAL, &pop_and_fail);
2027 2024
2028 // Successfully allocated the object(s), now update top to point to 2025 // Successfully allocated the object(s), now update top to point to
2029 // next object start and initialize the object. 2026 // next object start and initialize the object.
2030 __ movq(Address(R13, Heap::TopOffset(space)), RCX); 2027 __ movq(Address(THR, Thread::top_offset()), RCX);
2031 __ addq(RAX, Immediate(kHeapObjectTag)); 2028 __ addq(RAX, Immediate(kHeapObjectTag));
2032 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, RDI, space)); 2029 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, RDI, space));
2033 2030
2034 // Initialize the tags. 2031 // Initialize the tags.
2035 // RAX: new object start as a tagged pointer. 2032 // RAX: new object start as a tagged pointer.
2036 // RDI: allocation size. 2033 // RDI: allocation size.
2037 { 2034 {
2038 Label size_tag_overflow, done; 2035 Label size_tag_overflow, done;
2039 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); 2036 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag));
2040 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); 2037 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump);
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
2302 __ movq(Address(THR, Thread::async_stack_trace_offset()), RAX); 2299 __ movq(Address(THR, Thread::async_stack_trace_offset()), RAX);
2303 __ LoadObject(RAX, Object::null_object()); 2300 __ LoadObject(RAX, Object::null_object());
2304 __ ret(); 2301 __ ret();
2305 } 2302 }
2306 2303
2307 #undef __ 2304 #undef __
2308 2305
2309 } // namespace dart 2306 } // namespace dart
2310 2307
2311 #endif // defined TARGET_ARCH_X64 2308 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698