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

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

Issue 578443003: Support old-space allocation in generated code (bump block only for now). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 __ SmiUntag(R2); \ 290 __ SmiUntag(R2); \
291 /* Check for maximum allowed length. */ \ 291 /* Check for maximum allowed length. */ \
292 /* R2: untagged array length. */ \ 292 /* R2: untagged array length. */ \
293 __ CompareImmediate(R2, max_len, kNoPP); \ 293 __ CompareImmediate(R2, max_len, kNoPP); \
294 __ b(&fall_through, GT); \ 294 __ b(&fall_through, GT); \
295 __ Lsl(R2, R2, scale_shift); \ 295 __ Lsl(R2, R2, scale_shift); \
296 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \ 296 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \
297 __ AddImmediate(R2, R2, fixed_size, kNoPP); \ 297 __ AddImmediate(R2, R2, fixed_size, kNoPP); \
298 __ andi(R2, R2, ~(kObjectAlignment - 1)); \ 298 __ andi(R2, R2, ~(kObjectAlignment - 1)); \
299 Heap* heap = Isolate::Current()->heap(); \ 299 Heap* heap = Isolate::Current()->heap(); \
300 \ 300 Heap::Space space = heap->SpaceForAllocation(cid); \
301 __ LoadImmediate(R0, heap->TopAddress(), kNoPP); \ 301 __ LoadImmediate(R0, heap->TopAddress(space), kNoPP); \
302 __ ldr(R0, Address(R0, 0)); \ 302 __ ldr(R0, Address(R0, 0)); \
303 \ 303 \
304 /* R2: allocation size. */ \ 304 /* R2: allocation size. */ \
305 __ add(R1, R0, Operand(R2)); \ 305 __ add(R1, R0, Operand(R2)); \
306 __ b(&fall_through, VS); \ 306 __ b(&fall_through, VS); \
307 \ 307 \
308 /* Check if the allocation fits into the remaining space. */ \ 308 /* Check if the allocation fits into the remaining space. */ \
309 /* R0: potential new object start. */ \ 309 /* R0: potential new object start. */ \
310 /* R1: potential next object start. */ \ 310 /* R1: potential next object start. */ \
311 /* R2: allocation size. */ \ 311 /* R2: allocation size. */ \
312 __ LoadImmediate(R3, heap->EndAddress(), kNoPP); \ 312 __ LoadImmediate(R3, heap->EndAddress(space), kNoPP); \
313 __ ldr(R3, Address(R3, 0)); \ 313 __ ldr(R3, Address(R3, 0)); \
314 __ cmp(R1, Operand(R3)); \ 314 __ cmp(R1, Operand(R3)); \
315 __ b(&fall_through, CS); \ 315 __ b(&fall_through, CS); \
316 \ 316 \
317 /* Successfully allocated the object(s), now update top to point to */ \ 317 /* Successfully allocated the object(s), now update top to point to */ \
318 /* next object start and initialize the object. */ \ 318 /* next object start and initialize the object. */ \
319 __ LoadImmediate(R3, heap->TopAddress(), kNoPP); \ 319 __ LoadImmediate(R3, heap->TopAddress(space), kNoPP); \
320 __ str(R1, Address(R3, 0)); \ 320 __ str(R1, Address(R3, 0)); \
321 __ AddImmediate(R0, R0, kHeapObjectTag, kNoPP); \ 321 __ AddImmediate(R0, R0, kHeapObjectTag, kNoPP); \
322 __ UpdateAllocationStatsWithSize(cid, R2, kNoPP); \ 322 __ UpdateAllocationStatsWithSize(cid, R2, kNoPP, space); \
323 /* Initialize the tags. */ \ 323 /* Initialize the tags. */ \
324 /* R0: new object start as a tagged pointer. */ \ 324 /* R0: new object start as a tagged pointer. */ \
325 /* R1: new object end address. */ \ 325 /* R1: new object end address. */ \
326 /* R2: allocation size. */ \ 326 /* R2: allocation size. */ \
327 { \ 327 { \
328 __ CompareImmediate(R2, RawObject::SizeTag::kMaxSizeTag, kNoPP); \ 328 __ CompareImmediate(R2, RawObject::SizeTag::kMaxSizeTag, kNoPP); \
329 __ Lsl(R2, R2, RawObject::kSizeTagPos - kObjectAlignmentLog2); \ 329 __ Lsl(R2, R2, RawObject::kSizeTagPos - kObjectAlignmentLog2); \
330 __ csel(R2, ZR, R2, HI); \ 330 __ csel(R2, ZR, R2, HI); \
331 \ 331 \
332 /* Get the class index and insert it into the tags. */ \ 332 /* Get the class index and insert it into the tags. */ \
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 Label fail; 1264 Label fail;
1265 1265
1266 __ mov(R6, length_reg); // Save the length register. 1266 __ mov(R6, length_reg); // Save the length register.
1267 __ SmiUntag(length_reg); 1267 __ SmiUntag(length_reg);
1268 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; 1268 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1;
1269 __ AddImmediate(length_reg, length_reg, fixed_size, kNoPP); 1269 __ AddImmediate(length_reg, length_reg, fixed_size, kNoPP);
1270 __ andi(length_reg, length_reg, ~(kObjectAlignment - 1)); 1270 __ andi(length_reg, length_reg, ~(kObjectAlignment - 1));
1271 1271
1272 Isolate* isolate = Isolate::Current(); 1272 Isolate* isolate = Isolate::Current();
1273 Heap* heap = isolate->heap(); 1273 Heap* heap = isolate->heap();
1274 1274 Heap::Space space = heap->SpaceForAllocation(kOneByteStringCid);
1275 __ LoadImmediate(R3, heap->TopAddress(), kNoPP); 1275 __ LoadImmediate(R3, heap->TopAddress(space), kNoPP);
1276 __ ldr(R0, Address(R3)); 1276 __ ldr(R0, Address(R3));
1277 1277
1278 // length_reg: allocation size. 1278 // length_reg: allocation size.
1279 __ adds(R1, R0, Operand(length_reg)); 1279 __ adds(R1, R0, Operand(length_reg));
1280 __ b(&fail, VS); // Fail on overflow. 1280 __ b(&fail, VS); // Fail on overflow.
1281 1281
1282 // Check if the allocation fits into the remaining space. 1282 // Check if the allocation fits into the remaining space.
1283 // R0: potential new object start. 1283 // R0: potential new object start.
1284 // R1: potential next object start. 1284 // R1: potential next object start.
1285 // R2: allocation size. 1285 // R2: allocation size.
1286 // R3: heap->Top->Address(). 1286 // R3: heap->TopAddress(space).
1287 __ LoadImmediate(R7, heap->EndAddress(), kNoPP); 1287 __ LoadImmediate(R7, heap->EndAddress(space), kNoPP);
1288 __ ldr(R7, Address(R7)); 1288 __ ldr(R7, Address(R7));
1289 __ cmp(R1, Operand(R7)); 1289 __ cmp(R1, Operand(R7));
1290 __ b(&fail, CS); 1290 __ b(&fail, CS);
1291 1291
1292 // Successfully allocated the object(s), now update top to point to 1292 // Successfully allocated the object(s), now update top to point to
1293 // next object start and initialize the object. 1293 // next object start and initialize the object.
1294 __ str(R1, Address(R3)); 1294 __ str(R1, Address(R3));
1295 __ AddImmediate(R0, R0, kHeapObjectTag, kNoPP); 1295 __ AddImmediate(R0, R0, kHeapObjectTag, kNoPP);
1296 __ UpdateAllocationStatsWithSize(kOneByteStringCid, R2, kNoPP); 1296 __ UpdateAllocationStatsWithSize(kOneByteStringCid, R2, kNoPP, space);
1297 1297
1298 // Initialize the tags. 1298 // Initialize the tags.
1299 // R0: new object start as a tagged pointer. 1299 // R0: new object start as a tagged pointer.
1300 // R1: new object end address. 1300 // R1: new object end address.
1301 // R2: allocation size. 1301 // R2: allocation size.
1302 { 1302 {
1303 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; 1303 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2;
1304 const Class& cls = 1304 const Class& cls =
1305 Class::Handle(isolate->object_store()->one_byte_string_class()); 1305 Class::Handle(isolate->object_store()->one_byte_string_class());
1306 1306
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1523 Isolate* isolate = Isolate::Current(); 1523 Isolate* isolate = Isolate::Current();
1524 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP); 1524 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP);
1525 // Set return value to Isolate::current_tag_. 1525 // Set return value to Isolate::current_tag_.
1526 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); 1526 __ ldr(R0, Address(R1, Isolate::current_tag_offset()));
1527 __ ret(); 1527 __ ret();
1528 } 1528 }
1529 1529
1530 } // namespace dart 1530 } // namespace dart
1531 1531
1532 #endif // defined TARGET_ARCH_ARM64 1532 #endif // defined TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698