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

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

Issue 2980033002: Moves the top_ and end_ words of the Scavenger into mutator thread. (Closed)
Patch Set: 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
« no previous file with comments | « runtime/vm/intrinsifier_ia32.cc ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 if (scale_factor == TIMES_16) { \ 159 if (scale_factor == TIMES_16) { \
160 /* double length of array. */ \ 160 /* double length of array. */ \
161 __ addq(RDI, RDI); \ 161 __ addq(RDI, RDI); \
162 /* only scale by 8. */ \ 162 /* only scale by 8. */ \
163 scale_factor = TIMES_8; \ 163 scale_factor = TIMES_8; \
164 } \ 164 } \
165 const intptr_t fixed_size_plus_alignment_padding = \ 165 const intptr_t fixed_size_plus_alignment_padding = \
166 sizeof(Raw##type_name) + kObjectAlignment - 1; \ 166 sizeof(Raw##type_name) + kObjectAlignment - 1; \
167 __ leaq(RDI, Address(RDI, scale_factor, fixed_size_plus_alignment_padding)); \ 167 __ leaq(RDI, Address(RDI, scale_factor, fixed_size_plus_alignment_padding)); \
168 __ andq(RDI, Immediate(-kObjectAlignment)); \ 168 __ andq(RDI, Immediate(-kObjectAlignment)); \
169 Heap::Space space = Heap::kNew; \ 169 NOT_IN_PRODUCT(Heap::Space space = Heap::kNew); \
170 __ movq(R13, Address(THR, Thread::heap_offset())); \ 170 __ movq(RAX, Address(THR, Thread::top_offset())); \
171 __ movq(RAX, Address(R13, Heap::TopOffset(space))); \
172 __ movq(RCX, RAX); \ 171 __ movq(RCX, RAX); \
173 \ 172 \
174 /* RDI: allocation size. */ \ 173 /* RDI: allocation size. */ \
175 __ addq(RCX, RDI); \ 174 __ addq(RCX, RDI); \
176 __ j(CARRY, &fall_through); \ 175 __ j(CARRY, &fall_through); \
177 \ 176 \
178 /* Check if the allocation fits into the remaining space. */ \ 177 /* Check if the allocation fits into the remaining space. */ \
179 /* RAX: potential new object start. */ \ 178 /* RAX: potential new object start. */ \
180 /* RCX: potential next object start. */ \ 179 /* RCX: potential next object start. */ \
181 /* RDI: allocation size. */ \ 180 /* RDI: allocation size. */ \
182 /* R13: heap. */ \ 181 __ cmpq(RCX, Address(THR, Thread::end_offset())); \
183 __ cmpq(RCX, Address(R13, Heap::EndOffset(space))); \
184 __ j(ABOVE_EQUAL, &fall_through); \ 182 __ j(ABOVE_EQUAL, &fall_through); \
185 \ 183 \
186 /* Successfully allocated the object(s), now update top to point to */ \ 184 /* Successfully allocated the object(s), now update top to point to */ \
187 /* next object start and initialize the object. */ \ 185 /* next object start and initialize the object. */ \
188 __ movq(Address(R13, Heap::TopOffset(space)), RCX); \ 186 __ movq(Address(THR, Thread::top_offset()), RCX); \
189 __ addq(RAX, Immediate(kHeapObjectTag)); \ 187 __ addq(RAX, Immediate(kHeapObjectTag)); \
190 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, RDI, space)); \ 188 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, RDI, space)); \
191 /* Initialize the tags. */ \ 189 /* Initialize the tags. */ \
192 /* RAX: new object start as a tagged pointer. */ \ 190 /* RAX: new object start as a tagged pointer. */ \
193 /* RCX: new object end address. */ \ 191 /* RCX: new object end address. */ \
194 /* RDI: allocation size. */ \ 192 /* RDI: allocation size. */ \
195 /* R13: scratch register. */ \ 193 /* R13: scratch register. */ \
196 { \ 194 { \
197 Label size_tag_overflow, done; \ 195 Label size_tag_overflow, done; \
198 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); \ 196 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); \
(...skipping 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after
1934 // return a static zero length string here instead. 1932 // return a static zero length string here instead.
1935 __ j(NOT_ZERO, &not_zero_length); 1933 __ j(NOT_ZERO, &not_zero_length);
1936 __ addq(RDI, Immediate(1)); 1934 __ addq(RDI, Immediate(1));
1937 __ Bind(&not_zero_length); 1935 __ Bind(&not_zero_length);
1938 const intptr_t fixed_size_plus_alignment_padding = 1936 const intptr_t fixed_size_plus_alignment_padding =
1939 sizeof(RawString) + kObjectAlignment - 1; 1937 sizeof(RawString) + kObjectAlignment - 1;
1940 __ addq(RDI, Immediate(fixed_size_plus_alignment_padding)); 1938 __ addq(RDI, Immediate(fixed_size_plus_alignment_padding));
1941 __ andq(RDI, Immediate(-kObjectAlignment)); 1939 __ andq(RDI, Immediate(-kObjectAlignment));
1942 1940
1943 const intptr_t cid = kOneByteStringCid; 1941 const intptr_t cid = kOneByteStringCid;
1944 Heap::Space space = Heap::kNew; 1942 NOT_IN_PRODUCT(Heap::Space space = Heap::kNew);
1945 __ movq(R13, Address(THR, Thread::heap_offset())); 1943 __ movq(RAX, Address(THR, Thread::top_offset()));
1946 __ movq(RAX, Address(R13, Heap::TopOffset(space)));
1947 1944
1948 // RDI: allocation size. 1945 // RDI: allocation size.
1949 __ movq(RCX, RAX); 1946 __ movq(RCX, RAX);
1950 __ addq(RCX, RDI); 1947 __ addq(RCX, RDI);
1951 __ j(CARRY, &pop_and_fail); 1948 __ j(CARRY, &pop_and_fail);
1952 1949
1953 // Check if the allocation fits into the remaining space. 1950 // Check if the allocation fits into the remaining space.
1954 // RAX: potential new object start. 1951 // RAX: potential new object start.
1955 // RCX: potential next object start. 1952 // RCX: potential next object start.
1956 // RDI: allocation size. 1953 // RDI: allocation size.
1957 // R13: heap. 1954 __ cmpq(RCX, Address(THR, Thread::end_offset()));
1958 __ cmpq(RCX, Address(R13, Heap::EndOffset(space)));
1959 __ j(ABOVE_EQUAL, &pop_and_fail); 1955 __ j(ABOVE_EQUAL, &pop_and_fail);
1960 1956
1961 // Successfully allocated the object(s), now update top to point to 1957 // Successfully allocated the object(s), now update top to point to
1962 // next object start and initialize the object. 1958 // next object start and initialize the object.
1963 __ movq(Address(R13, Heap::TopOffset(space)), RCX); 1959 __ movq(Address(THR, Thread::top_offset()), RCX);
1964 __ addq(RAX, Immediate(kHeapObjectTag)); 1960 __ addq(RAX, Immediate(kHeapObjectTag));
1965 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, RDI, space)); 1961 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, RDI, space));
1966 1962
1967 // Initialize the tags. 1963 // Initialize the tags.
1968 // RAX: new object start as a tagged pointer. 1964 // RAX: new object start as a tagged pointer.
1969 // RDI: allocation size. 1965 // RDI: allocation size.
1970 { 1966 {
1971 Label size_tag_overflow, done; 1967 Label size_tag_overflow, done;
1972 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); 1968 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag));
1973 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); 1969 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump);
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
2223 __ movq(Address(THR, Thread::async_stack_trace_offset()), RAX); 2219 __ movq(Address(THR, Thread::async_stack_trace_offset()), RAX);
2224 __ LoadObject(RAX, Object::null_object()); 2220 __ LoadObject(RAX, Object::null_object());
2225 __ ret(); 2221 __ ret();
2226 } 2222 }
2227 2223
2228 #undef __ 2224 #undef __
2229 2225
2230 } // namespace dart 2226 } // namespace dart
2231 2227
2232 #endif // defined TARGET_ARCH_X64 2228 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier_ia32.cc ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698