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

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

Issue 619723007: Splits up dependent load in update of allocation stats. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 2 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
« no previous file with comments | « runtime/vm/assembler_arm.cc ('k') | runtime/vm/stub_code_arm.cc » ('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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 /* R0: potential new object start. */ \ 289 /* R0: potential new object start. */ \
290 /* R1: potential next object start. */ \ 290 /* R1: potential next object start. */ \
291 /* R2: allocation size. */ \ 291 /* R2: allocation size. */ \
292 __ LoadImmediate(R3, heap->EndAddress(space)); \ 292 __ LoadImmediate(R3, heap->EndAddress(space)); \
293 __ ldr(R3, Address(R3, 0)); \ 293 __ ldr(R3, Address(R3, 0)); \
294 __ cmp(R1, Operand(R3)); \ 294 __ cmp(R1, Operand(R3)); \
295 __ b(&fall_through, CS); \ 295 __ b(&fall_through, CS); \
296 \ 296 \
297 /* Successfully allocated the object(s), now update top to point to */ \ 297 /* Successfully allocated the object(s), now update top to point to */ \
298 /* next object start and initialize the object. */ \ 298 /* next object start and initialize the object. */ \
299 __ LoadAllocationStatsAddress(R4, cid, space); \
299 __ LoadImmediate(R3, heap->TopAddress(space)); \ 300 __ LoadImmediate(R3, heap->TopAddress(space)); \
300 __ str(R1, Address(R3, 0)); \ 301 __ str(R1, Address(R3, 0)); \
301 __ AddImmediate(R0, kHeapObjectTag); \ 302 __ AddImmediate(R0, kHeapObjectTag); \
302 __ UpdateAllocationStatsWithSize(cid, R2, R4, space); \
303 /* Initialize the tags. */ \ 303 /* Initialize the tags. */ \
304 /* R0: new object start as a tagged pointer. */ \ 304 /* R0: new object start as a tagged pointer. */ \
305 /* R1: new object end address. */ \ 305 /* R1: new object end address. */ \
306 /* R2: allocation size. */ \ 306 /* R2: allocation size. */ \
307 /* R4: allocation stats address */ \
307 { \ 308 { \
308 __ CompareImmediate(R2, RawObject::SizeTag::kMaxSizeTag); \ 309 __ CompareImmediate(R2, RawObject::SizeTag::kMaxSizeTag); \
309 __ mov(R2, Operand(R2, LSL, \ 310 __ mov(R3, Operand(R2, LSL, \
310 RawObject::kSizeTagPos - kObjectAlignmentLog2), LS); \ 311 RawObject::kSizeTagPos - kObjectAlignmentLog2), LS); \
311 __ mov(R2, Operand(0), HI); \ 312 __ mov(R3, Operand(0), HI); \
312 \ 313 \
313 /* Get the class index and insert it into the tags. */ \ 314 /* Get the class index and insert it into the tags. */ \
314 __ LoadImmediate(TMP, RawObject::ClassIdTag::encode(cid)); \ 315 __ LoadImmediate(TMP, RawObject::ClassIdTag::encode(cid)); \
315 __ orr(R2, R2, Operand(TMP)); \ 316 __ orr(R3, R3, Operand(TMP)); \
316 __ str(R2, FieldAddress(R0, type_name::tags_offset())); /* Tags. */ \ 317 __ str(R3, FieldAddress(R0, type_name::tags_offset())); /* Tags. */ \
317 } \ 318 } \
318 /* Set the length field. */ \ 319 /* Set the length field. */ \
319 /* R0: new object start as a tagged pointer. */ \ 320 /* R0: new object start as a tagged pointer. */ \
320 /* R1: new object end address. */ \ 321 /* R1: new object end address. */ \
321 __ ldr(R2, Address(SP, kArrayLengthStackOffset)); /* Array length. */ \ 322 /* R2: allocation size. */ \
323 /* R4: allocation stats address. */ \
324 __ ldr(R3, Address(SP, kArrayLengthStackOffset)); /* Array length. */ \
322 __ StoreIntoObjectNoBarrier(R0, \ 325 __ StoreIntoObjectNoBarrier(R0, \
323 FieldAddress(R0, type_name::length_offset()), \ 326 FieldAddress(R0, type_name::length_offset()), \
324 R2); \ 327 R3); \
325 /* Initialize all array elements to 0. */ \ 328 /* Initialize all array elements to 0. */ \
326 /* R0: new object start as a tagged pointer. */ \ 329 /* R0: new object start as a tagged pointer. */ \
327 /* R1: new object end address. */ \ 330 /* R1: new object end address. */ \
328 /* R2: iterator which initially points to the start of the variable */ \ 331 /* R2: allocation size. */ \
329 /* R3: scratch register. */ \ 332 /* R3: iterator which initially points to the start of the variable */ \
333 /* R4: allocation stats address */ \
334 /* R6, R7: zero. */ \
330 /* data area to be initialized. */ \ 335 /* data area to be initialized. */ \
331 __ LoadImmediate(R3, 0); \ 336 __ LoadImmediate(R6, 0); \
332 __ AddImmediate(R2, R0, sizeof(Raw##type_name) - 1); \ 337 __ mov(R7, Operand(R6)); \
338 __ AddImmediate(R3, R0, sizeof(Raw##type_name) - 1); \
333 Label init_loop; \ 339 Label init_loop; \
334 __ Bind(&init_loop); \ 340 __ Bind(&init_loop); \
335 __ cmp(R2, Operand(R1)); \ 341 __ AddImmediate(R3, 2 * kWordSize); \
336 __ str(R3, Address(R2, 0), CC); \ 342 __ cmp(R3, Operand(R1)); \
337 __ add(R2, R2, Operand(kWordSize), CC); \ 343 __ strd(R6, Address(R3, -2 * kWordSize), LS); \
338 __ b(&init_loop, CC); \ 344 __ b(&init_loop, CC); \
345 __ str(R6, Address(R3, -2 * kWordSize), HI); \
339 \ 346 \
347 __ IncrementAllocationStatsWithSize(R4, R2, cid, space); \
340 __ Ret(); \ 348 __ Ret(); \
341 __ Bind(&fall_through); \ 349 __ Bind(&fall_through); \
342 350
343 351
344 static int GetScaleFactor(intptr_t size) { 352 static int GetScaleFactor(intptr_t size) {
345 switch (size) { 353 switch (size) {
346 case 1: return 0; 354 case 1: return 0;
347 case 2: return 1; 355 case 2: return 1;
348 case 4: return 2; 356 case 4: return 2;
349 case 8: return 3; 357 case 8: return 3;
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 // R1: potential next object start. 1431 // R1: potential next object start.
1424 // R2: allocation size. 1432 // R2: allocation size.
1425 // R3: heap->TopAddress(space). 1433 // R3: heap->TopAddress(space).
1426 __ LoadImmediate(R7, heap->EndAddress(space)); 1434 __ LoadImmediate(R7, heap->EndAddress(space));
1427 __ ldr(R7, Address(R7, 0)); 1435 __ ldr(R7, Address(R7, 0));
1428 __ cmp(R1, Operand(R7)); 1436 __ cmp(R1, Operand(R7));
1429 __ b(&fail, CS); 1437 __ b(&fail, CS);
1430 1438
1431 // Successfully allocated the object(s), now update top to point to 1439 // Successfully allocated the object(s), now update top to point to
1432 // next object start and initialize the object. 1440 // next object start and initialize the object.
1441 __ LoadAllocationStatsAddress(R4, cid, space);
1433 __ str(R1, Address(R3, 0)); 1442 __ str(R1, Address(R3, 0));
1434 __ AddImmediate(R0, kHeapObjectTag); 1443 __ AddImmediate(R0, kHeapObjectTag);
1435 __ UpdateAllocationStatsWithSize(cid, R2, R3, space);
1436 1444
1437 // Initialize the tags. 1445 // Initialize the tags.
1438 // R0: new object start as a tagged pointer. 1446 // R0: new object start as a tagged pointer.
1439 // R1: new object end address. 1447 // R1: new object end address.
1440 // R2: allocation size. 1448 // R2: allocation size.
1449 // R4: allocation stats address.
1441 { 1450 {
1442 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; 1451 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2;
1443 1452
1444 __ CompareImmediate(R2, RawObject::SizeTag::kMaxSizeTag); 1453 __ CompareImmediate(R2, RawObject::SizeTag::kMaxSizeTag);
1445 __ mov(R2, Operand(R2, LSL, shift), LS); 1454 __ mov(R3, Operand(R2, LSL, shift), LS);
1446 __ mov(R2, Operand(0), HI); 1455 __ mov(R3, Operand(0), HI);
1447 1456
1448 // Get the class index and insert it into the tags. 1457 // Get the class index and insert it into the tags.
1449 // R2: size and bit tags. 1458 // R3: size and bit tags.
1450 __ LoadImmediate(TMP, RawObject::ClassIdTag::encode(cid)); 1459 __ LoadImmediate(TMP, RawObject::ClassIdTag::encode(cid));
1451 __ orr(R2, R2, Operand(TMP)); 1460 __ orr(R3, R3, Operand(TMP));
1452 __ str(R2, FieldAddress(R0, String::tags_offset())); // Store tags. 1461 __ str(R3, FieldAddress(R0, String::tags_offset())); // Store tags.
1453 } 1462 }
1454 1463
1455 // Set the length field using the saved length (R6). 1464 // Set the length field using the saved length (R6).
1456 __ StoreIntoObjectNoBarrier(R0, 1465 __ StoreIntoObjectNoBarrier(R0,
1457 FieldAddress(R0, String::length_offset()), 1466 FieldAddress(R0, String::length_offset()),
1458 R6); 1467 R6);
1459 // Clear hash. 1468 // Clear hash.
1460 __ LoadImmediate(TMP, 0); 1469 __ LoadImmediate(TMP, 0);
1461 __ str(TMP, FieldAddress(R0, String::hash_offset())); 1470 __ str(TMP, FieldAddress(R0, String::hash_offset()));
1471
1472 __ IncrementAllocationStatsWithSize(R4, R2, cid, space);
1462 __ b(ok); 1473 __ b(ok);
1463 1474
1464 __ Bind(&fail); 1475 __ Bind(&fail);
1465 __ b(failure); 1476 __ b(failure);
1466 } 1477 }
1467 1478
1468 1479
1469 // Arg0: OneByteString (receiver). 1480 // Arg0: OneByteString (receiver).
1470 // Arg1: Start index as Smi. 1481 // Arg1: Start index as Smi.
1471 // Arg2: End index as Smi. 1482 // Arg2: End index as Smi.
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1658 Isolate* isolate = Isolate::Current(); 1669 Isolate* isolate = Isolate::Current();
1659 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); 1670 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate));
1660 // Set return value to Isolate::current_tag_. 1671 // Set return value to Isolate::current_tag_.
1661 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); 1672 __ ldr(R0, Address(R1, Isolate::current_tag_offset()));
1662 __ Ret(); 1673 __ Ret();
1663 } 1674 }
1664 1675
1665 } // namespace dart 1676 } // namespace dart
1666 1677
1667 #endif // defined TARGET_ARCH_ARM 1678 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/assembler_arm.cc ('k') | runtime/vm/stub_code_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698