| 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 __ BumpAllocationCount(Heap::kNew, 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 __ BumpAllocationCount(Heap::kNew, 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 __ BumpAllocationCount(Heap::kNew, 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 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1517 // RDI: allocation size. | 1518 // RDI: allocation size. |
| 1518 __ movq(R13, Immediate(heap->EndAddress())); | 1519 __ movq(R13, Immediate(heap->EndAddress())); |
| 1519 __ cmpq(RCX, Address(R13, 0)); | 1520 __ cmpq(RCX, Address(R13, 0)); |
| 1520 __ j(ABOVE_EQUAL, &pop_and_fail); | 1521 __ j(ABOVE_EQUAL, &pop_and_fail); |
| 1521 | 1522 |
| 1522 // Successfully allocated the object(s), now update top to point to | 1523 // Successfully allocated the object(s), now update top to point to |
| 1523 // next object start and initialize the object. | 1524 // next object start and initialize the object. |
| 1524 __ movq(R13, Immediate(heap->TopAddress())); | 1525 __ movq(R13, Immediate(heap->TopAddress())); |
| 1525 __ movq(Address(R13, 0), RCX); | 1526 __ movq(Address(R13, 0), RCX); |
| 1526 __ addq(RAX, Immediate(kHeapObjectTag)); | 1527 __ addq(RAX, Immediate(kHeapObjectTag)); |
| 1528 __ BumpAllocationCount(Heap::kNew, kOneByteStringCid, RDI); |
| 1527 | 1529 |
| 1528 // Initialize the tags. | 1530 // Initialize the tags. |
| 1529 // RAX: new object start as a tagged pointer. | 1531 // RAX: new object start as a tagged pointer. |
| 1530 // RDI: allocation size. | 1532 // RDI: allocation size. |
| 1531 { | 1533 { |
| 1532 Label size_tag_overflow, done; | 1534 Label size_tag_overflow, done; |
| 1533 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); | 1535 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); |
| 1534 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); | 1536 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); |
| 1535 __ shlq(RDI, Immediate(RawObject::kSizeTagBit - kObjectAlignmentLog2)); | 1537 __ shlq(RDI, Immediate(RawObject::kSizeTagBit - kObjectAlignmentLog2)); |
| 1536 __ jmp(&done, Assembler::kNearJump); | 1538 __ jmp(&done, Assembler::kNearJump); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1698 | 1700 |
| 1699 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { | 1701 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { |
| 1700 StringEquality(assembler, kTwoByteStringCid); | 1702 StringEquality(assembler, kTwoByteStringCid); |
| 1701 } | 1703 } |
| 1702 | 1704 |
| 1703 #undef __ | 1705 #undef __ |
| 1704 | 1706 |
| 1705 } // namespace dart | 1707 } // namespace dart |
| 1706 | 1708 |
| 1707 #endif // defined TARGET_ARCH_X64 | 1709 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |