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

Side by Side Diff: runtime/vm/intrinsifier_arm64.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64.
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 /* Check for maximum allowed length. */ \ 194 /* Check for maximum allowed length. */ \
195 /* R2: untagged array length. */ \ 195 /* R2: untagged array length. */ \
196 __ CompareImmediate(R2, max_len); \ 196 __ CompareImmediate(R2, max_len); \
197 __ b(&fall_through, GT); \ 197 __ b(&fall_through, GT); \
198 __ LslImmediate(R2, R2, scale_shift); \ 198 __ LslImmediate(R2, R2, scale_shift); \
199 const intptr_t fixed_size_plus_alignment_padding = \ 199 const intptr_t fixed_size_plus_alignment_padding = \
200 sizeof(Raw##type_name) + kObjectAlignment - 1; \ 200 sizeof(Raw##type_name) + kObjectAlignment - 1; \
201 __ AddImmediate(R2, fixed_size_plus_alignment_padding); \ 201 __ AddImmediate(R2, fixed_size_plus_alignment_padding); \
202 __ andi(R2, R2, Immediate(~(kObjectAlignment - 1))); \ 202 __ andi(R2, R2, Immediate(~(kObjectAlignment - 1))); \
203 Heap::Space space = Heap::kNew; \ 203 Heap::Space space = Heap::kNew; \
204 __ ldr(R3, Address(THR, Thread::heap_offset())); \ 204 __ ldr(R0, Address(THR, Thread::top_offset())); \
205 __ ldr(R0, Address(R3, Heap::TopOffset(space))); \
206 \ 205 \
207 /* R2: allocation size. */ \ 206 /* R2: allocation size. */ \
208 __ adds(R1, R0, Operand(R2)); \ 207 __ adds(R1, R0, Operand(R2)); \
209 __ b(&fall_through, CS); /* Fail on unsigned overflow. */ \ 208 __ b(&fall_through, CS); /* Fail on unsigned overflow. */ \
210 \ 209 \
211 /* Check if the allocation fits into the remaining space. */ \ 210 /* Check if the allocation fits into the remaining space. */ \
212 /* R0: potential new object start. */ \ 211 /* R0: potential new object start. */ \
213 /* R1: potential next object start. */ \ 212 /* R1: potential next object start. */ \
214 /* R2: allocation size. */ \ 213 /* R2: allocation size. */ \
215 /* R3: heap. */ \ 214 /* R3: heap. */ \
216 __ ldr(R6, Address(R3, Heap::EndOffset(space))); \ 215 __ ldr(R6, Address(THR, Thread::end_offset())); \
217 __ cmp(R1, Operand(R6)); \ 216 __ cmp(R1, Operand(R6)); \
218 __ b(&fall_through, CS); \ 217 __ b(&fall_through, CS); \
219 \ 218 \
220 /* Successfully allocated the object(s), now update top to point to */ \ 219 /* Successfully allocated the object(s), now update top to point to */ \
221 /* next object start and initialize the object. */ \ 220 /* next object start and initialize the object. */ \
222 __ str(R1, Address(R3, Heap::TopOffset(space))); \ 221 __ str(R1, Address(THR, Thread::top_offset())); \
223 __ AddImmediate(R0, kHeapObjectTag); \ 222 __ AddImmediate(R0, kHeapObjectTag); \
224 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, R2, space)); \ 223 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, R2, space)); \
225 /* Initialize the tags. */ \ 224 /* Initialize the tags. */ \
226 /* R0: new object start as a tagged pointer. */ \ 225 /* R0: new object start as a tagged pointer. */ \
227 /* R1: new object end address. */ \ 226 /* R1: new object end address. */ \
228 /* R2: allocation size. */ \ 227 /* R2: allocation size. */ \
229 { \ 228 { \
230 __ CompareImmediate(R2, RawObject::SizeTag::kMaxSizeTag); \ 229 __ CompareImmediate(R2, RawObject::SizeTag::kMaxSizeTag); \
231 __ LslImmediate(R2, R2, RawObject::kSizeTagPos - kObjectAlignmentLog2); \ 230 __ LslImmediate(R2, R2, RawObject::kSizeTagPos - kObjectAlignmentLog2); \
232 __ csel(R2, ZR, R2, HI); \ 231 __ csel(R2, ZR, R2, HI); \
(...skipping 1839 matching lines...) Expand 10 before | Expand all | Expand 10 after
2072 // return a static zero length string here instead. 2071 // return a static zero length string here instead.
2073 // length <- (length != 0) ? length : (ZR + 1). 2072 // length <- (length != 0) ? length : (ZR + 1).
2074 __ csinc(length_reg, length_reg, ZR, NE); 2073 __ csinc(length_reg, length_reg, ZR, NE);
2075 const intptr_t fixed_size_plus_alignment_padding = 2074 const intptr_t fixed_size_plus_alignment_padding =
2076 sizeof(RawString) + kObjectAlignment - 1; 2075 sizeof(RawString) + kObjectAlignment - 1;
2077 __ AddImmediate(length_reg, fixed_size_plus_alignment_padding); 2076 __ AddImmediate(length_reg, fixed_size_plus_alignment_padding);
2078 __ andi(length_reg, length_reg, Immediate(~(kObjectAlignment - 1))); 2077 __ andi(length_reg, length_reg, Immediate(~(kObjectAlignment - 1)));
2079 2078
2080 const intptr_t cid = kOneByteStringCid; 2079 const intptr_t cid = kOneByteStringCid;
2081 Heap::Space space = Heap::kNew; 2080 Heap::Space space = Heap::kNew;
2082 __ ldr(R3, Address(THR, Thread::heap_offset())); 2081 __ ldr(R0, Address(THR, Thread::top_offset()));
2083 __ ldr(R0, Address(R3, Heap::TopOffset(space)));
2084 2082
2085 // length_reg: allocation size. 2083 // length_reg: allocation size.
2086 __ adds(R1, R0, Operand(length_reg)); 2084 __ adds(R1, R0, Operand(length_reg));
2087 __ b(&fail, CS); // Fail on unsigned overflow. 2085 __ b(&fail, CS); // Fail on unsigned overflow.
2088 2086
2089 // Check if the allocation fits into the remaining space. 2087 // Check if the allocation fits into the remaining space.
2090 // R0: potential new object start. 2088 // R0: potential new object start.
2091 // R1: potential next object start. 2089 // R1: potential next object start.
2092 // R2: allocation size. 2090 // R2: allocation size.
2093 // R3: heap. 2091 // R3: heap.
2094 __ ldr(R7, Address(R3, Heap::EndOffset(space))); 2092 __ ldr(R7, Address(THR, Thread::end_offset()));
2095 __ cmp(R1, Operand(R7)); 2093 __ cmp(R1, Operand(R7));
2096 __ b(&fail, CS); 2094 __ b(&fail, CS);
2097 2095
2098 // Successfully allocated the object(s), now update top to point to 2096 // Successfully allocated the object(s), now update top to point to
2099 // next object start and initialize the object. 2097 // next object start and initialize the object.
2100 __ str(R1, Address(R3, Heap::TopOffset(space))); 2098 __ str(R1, Address(THR, Thread::top_offset()));
2101 __ AddImmediate(R0, kHeapObjectTag); 2099 __ AddImmediate(R0, kHeapObjectTag);
2102 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, R2, space)); 2100 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, R2, space));
2103 2101
2104 // Initialize the tags. 2102 // Initialize the tags.
2105 // R0: new object start as a tagged pointer. 2103 // R0: new object start as a tagged pointer.
2106 // R1: new object end address. 2104 // R1: new object end address.
2107 // R2: allocation size. 2105 // R2: allocation size.
2108 { 2106 {
2109 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; 2107 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2;
2110 2108
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
2383 2381
2384 void Intrinsifier::SetAsyncThreadStackTrace(Assembler* assembler) { 2382 void Intrinsifier::SetAsyncThreadStackTrace(Assembler* assembler) {
2385 __ ldr(R0, Address(THR, Thread::async_stack_trace_offset())); 2383 __ ldr(R0, Address(THR, Thread::async_stack_trace_offset()));
2386 __ LoadObject(R0, Object::null_object()); 2384 __ LoadObject(R0, Object::null_object());
2387 __ ret(); 2385 __ ret();
2388 } 2386 }
2389 2387
2390 } // namespace dart 2388 } // namespace dart
2391 2389
2392 #endif // defined TARGET_ARCH_ARM64 2390 #endif // defined TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698