OLD | NEW |
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // RDI: allocation size. | 71 // RDI: allocation size. |
72 __ movq(R13, Immediate(heap->EndAddress())); | 72 __ movq(R13, Immediate(heap->EndAddress())); |
73 __ cmpq(RCX, Address(R13, 0)); | 73 __ cmpq(RCX, Address(R13, 0)); |
74 __ j(ABOVE_EQUAL, &fall_through); | 74 __ j(ABOVE_EQUAL, &fall_through); |
75 | 75 |
76 // Successfully allocated the object(s), now update top to point to | 76 // Successfully allocated the object(s), now update top to point to |
77 // next object start and initialize the object. | 77 // next object start and initialize the object. |
78 __ movq(R13, Immediate(heap->TopAddress())); | 78 __ movq(R13, Immediate(heap->TopAddress())); |
79 __ movq(Address(R13, 0), RCX); | 79 __ movq(Address(R13, 0), RCX); |
80 __ addq(RAX, Immediate(kHeapObjectTag)); | 80 __ addq(RAX, Immediate(kHeapObjectTag)); |
81 | 81 __ UpdateAllocationStatsWithSize(kArrayCid, RDI); |
82 // Initialize the tags. | 82 // Initialize the tags. |
83 // RAX: new object start as a tagged pointer. | 83 // RAX: new object start as a tagged pointer. |
84 // RDI: allocation size. | 84 // RDI: allocation size. |
85 { | 85 { |
86 Label size_tag_overflow, done; | 86 Label size_tag_overflow, done; |
87 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); | 87 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); |
88 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); | 88 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); |
89 __ shlq(RDI, Immediate(RawObject::kSizeTagBit - kObjectAlignmentLog2)); | 89 __ shlq(RDI, Immediate(RawObject::kSizeTagBit - kObjectAlignmentLog2)); |
90 __ jmp(&done, Assembler::kNearJump); | 90 __ jmp(&done, Assembler::kNearJump); |
91 | 91 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 // Store the type argument field in the growable array object. | 252 // Store the type argument field in the growable array object. |
253 __ movq(RCX, Address(RSP, kTypeArgumentsOffset)); // type argument. | 253 __ movq(RCX, Address(RSP, kTypeArgumentsOffset)); // type argument. |
254 __ StoreIntoObjectNoBarrier( | 254 __ StoreIntoObjectNoBarrier( |
255 RAX, | 255 RAX, |
256 FieldAddress(RAX, GrowableObjectArray::type_arguments_offset()), | 256 FieldAddress(RAX, GrowableObjectArray::type_arguments_offset()), |
257 RCX); | 257 RCX); |
258 | 258 |
259 // Set the length field in the growable array object to 0. | 259 // Set the length field in the growable array object to 0. |
260 __ movq(FieldAddress(RAX, GrowableObjectArray::length_offset()), | 260 __ movq(FieldAddress(RAX, GrowableObjectArray::length_offset()), |
261 Immediate(0)); | 261 Immediate(0)); |
| 262 __ UpdateAllocationStats(kGrowableObjectArrayCid); |
262 __ ret(); // returns the newly allocated object in RAX. | 263 __ ret(); // returns the newly allocated object in RAX. |
263 | 264 |
264 __ Bind(&fall_through); | 265 __ Bind(&fall_through); |
265 } | 266 } |
266 | 267 |
267 | 268 |
268 // Get length of growable object array. | 269 // Get length of growable object array. |
269 // On stack: growable array (+1), return-address (+0). | 270 // On stack: growable array (+1), return-address (+0). |
270 void Intrinsifier::GrowableList_getLength(Assembler* assembler) { | 271 void Intrinsifier::GrowableList_getLength(Assembler* assembler) { |
271 __ movq(RAX, Address(RSP, + 1 * kWordSize)); | 272 __ movq(RAX, Address(RSP, + 1 * kWordSize)); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 /* R13: scratch register. */ \ | 440 /* R13: scratch register. */ \ |
440 __ movq(R13, Immediate(heap->EndAddress())); \ | 441 __ movq(R13, Immediate(heap->EndAddress())); \ |
441 __ cmpq(RCX, Address(R13, 0)); \ | 442 __ cmpq(RCX, Address(R13, 0)); \ |
442 __ j(ABOVE_EQUAL, &fall_through); \ | 443 __ j(ABOVE_EQUAL, &fall_through); \ |
443 \ | 444 \ |
444 /* Successfully allocated the object(s), now update top to point to */ \ | 445 /* Successfully allocated the object(s), now update top to point to */ \ |
445 /* next object start and initialize the object. */ \ | 446 /* next object start and initialize the object. */ \ |
446 __ movq(R13, Immediate(heap->TopAddress())); \ | 447 __ movq(R13, Immediate(heap->TopAddress())); \ |
447 __ movq(Address(R13, 0), RCX); \ | 448 __ movq(Address(R13, 0), RCX); \ |
448 __ addq(RAX, Immediate(kHeapObjectTag)); \ | 449 __ addq(RAX, Immediate(kHeapObjectTag)); \ |
449 \ | 450 __ UpdateAllocationStatsWithSize(cid, RDI); \ |
450 /* Initialize the tags. */ \ | 451 /* Initialize the tags. */ \ |
451 /* RAX: new object start as a tagged pointer. */ \ | 452 /* RAX: new object start as a tagged pointer. */ \ |
452 /* RCX: new object end address. */ \ | 453 /* RCX: new object end address. */ \ |
453 /* RDI: allocation size. */ \ | 454 /* RDI: allocation size. */ \ |
454 /* R13: scratch register. */ \ | 455 /* R13: scratch register. */ \ |
455 { \ | 456 { \ |
456 Label size_tag_overflow, done; \ | 457 Label size_tag_overflow, done; \ |
457 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); \ | 458 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); \ |
458 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); \ | 459 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); \ |
459 __ shlq(RDI, Immediate(RawObject::kSizeTagBit - kObjectAlignmentLog2)); \ | 460 __ shlq(RDI, Immediate(RawObject::kSizeTagBit - kObjectAlignmentLog2)); \ |
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1462 // RDI: allocation size. | 1463 // RDI: allocation size. |
1463 __ movq(R13, Immediate(heap->EndAddress())); | 1464 __ movq(R13, Immediate(heap->EndAddress())); |
1464 __ cmpq(RCX, Address(R13, 0)); | 1465 __ cmpq(RCX, Address(R13, 0)); |
1465 __ j(ABOVE_EQUAL, &pop_and_fail); | 1466 __ j(ABOVE_EQUAL, &pop_and_fail); |
1466 | 1467 |
1467 // Successfully allocated the object(s), now update top to point to | 1468 // Successfully allocated the object(s), now update top to point to |
1468 // next object start and initialize the object. | 1469 // next object start and initialize the object. |
1469 __ movq(R13, Immediate(heap->TopAddress())); | 1470 __ movq(R13, Immediate(heap->TopAddress())); |
1470 __ movq(Address(R13, 0), RCX); | 1471 __ movq(Address(R13, 0), RCX); |
1471 __ addq(RAX, Immediate(kHeapObjectTag)); | 1472 __ addq(RAX, Immediate(kHeapObjectTag)); |
| 1473 __ UpdateAllocationStatsWithSize(kOneByteStringCid, RDI); |
1472 | 1474 |
1473 // Initialize the tags. | 1475 // Initialize the tags. |
1474 // RAX: new object start as a tagged pointer. | 1476 // RAX: new object start as a tagged pointer. |
1475 // RDI: allocation size. | 1477 // RDI: allocation size. |
1476 { | 1478 { |
1477 Label size_tag_overflow, done; | 1479 Label size_tag_overflow, done; |
1478 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); | 1480 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); |
1479 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); | 1481 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); |
1480 __ shlq(RDI, Immediate(RawObject::kSizeTagBit - kObjectAlignmentLog2)); | 1482 __ shlq(RDI, Immediate(RawObject::kSizeTagBit - kObjectAlignmentLog2)); |
1481 __ jmp(&done, Assembler::kNearJump); | 1483 __ jmp(&done, Assembler::kNearJump); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1643 | 1645 |
1644 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { | 1646 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { |
1645 StringEquality(assembler, kTwoByteStringCid); | 1647 StringEquality(assembler, kTwoByteStringCid); |
1646 } | 1648 } |
1647 | 1649 |
1648 #undef __ | 1650 #undef __ |
1649 | 1651 |
1650 } // namespace dart | 1652 } // namespace dart |
1651 | 1653 |
1652 #endif // defined TARGET_ARCH_X64 | 1654 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |