| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 __ movq(Address(R13, 0), RCX); | 79 __ movq(Address(R13, 0), RCX); |
| 80 __ addq(RAX, Immediate(kHeapObjectTag)); | 80 __ addq(RAX, Immediate(kHeapObjectTag)); |
| 81 __ UpdateAllocationStatsWithSize(kArrayCid, RDI); | 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::kSizeTagPos - kObjectAlignmentLog2)); |
| 90 __ jmp(&done, Assembler::kNearJump); | 90 __ jmp(&done, Assembler::kNearJump); |
| 91 | 91 |
| 92 __ Bind(&size_tag_overflow); | 92 __ Bind(&size_tag_overflow); |
| 93 __ movq(RDI, Immediate(0)); | 93 __ movq(RDI, Immediate(0)); |
| 94 __ Bind(&done); | 94 __ Bind(&done); |
| 95 | 95 |
| 96 // Get the class index and insert it into the tags. | 96 // Get the class index and insert it into the tags. |
| 97 const Class& cls = Class::Handle(isolate->object_store()->array_class()); | 97 const Class& cls = Class::Handle(isolate->object_store()->array_class()); |
| 98 __ orq(RDI, Immediate(RawObject::ClassIdTag::encode(cls.id()))); | 98 __ orq(RDI, Immediate(RawObject::ClassIdTag::encode(cls.id()))); |
| 99 __ movq(FieldAddress(RAX, Array::tags_offset()), RDI); // Tags. | 99 __ movq(FieldAddress(RAX, Array::tags_offset()), RDI); // Tags. |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 __ UpdateAllocationStatsWithSize(cid, RDI); \ | 450 __ UpdateAllocationStatsWithSize(cid, RDI); \ |
| 451 /* Initialize the tags. */ \ | 451 /* Initialize the tags. */ \ |
| 452 /* RAX: new object start as a tagged pointer. */ \ | 452 /* RAX: new object start as a tagged pointer. */ \ |
| 453 /* RCX: new object end address. */ \ | 453 /* RCX: new object end address. */ \ |
| 454 /* RDI: allocation size. */ \ | 454 /* RDI: allocation size. */ \ |
| 455 /* R13: scratch register. */ \ | 455 /* R13: scratch register. */ \ |
| 456 { \ | 456 { \ |
| 457 Label size_tag_overflow, done; \ | 457 Label size_tag_overflow, done; \ |
| 458 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); \ | 458 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); \ |
| 459 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); \ | 459 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); \ |
| 460 __ shlq(RDI, Immediate(RawObject::kSizeTagBit - kObjectAlignmentLog2)); \ | 460 __ shlq(RDI, Immediate(RawObject::kSizeTagPos - kObjectAlignmentLog2)); \ |
| 461 __ jmp(&done, Assembler::kNearJump); \ | 461 __ jmp(&done, Assembler::kNearJump); \ |
| 462 \ | 462 \ |
| 463 __ Bind(&size_tag_overflow); \ | 463 __ Bind(&size_tag_overflow); \ |
| 464 __ movq(RDI, Immediate(0)); \ | 464 __ movq(RDI, Immediate(0)); \ |
| 465 __ Bind(&done); \ | 465 __ Bind(&done); \ |
| 466 \ | 466 \ |
| 467 /* Get the class index and insert it into the tags. */ \ | 467 /* Get the class index and insert it into the tags. */ \ |
| 468 __ orq(RDI, Immediate(RawObject::ClassIdTag::encode(cid))); \ | 468 __ orq(RDI, Immediate(RawObject::ClassIdTag::encode(cid))); \ |
| 469 __ movq(FieldAddress(RAX, type_name::tags_offset()), RDI); /* Tags. */ \ | 469 __ movq(FieldAddress(RAX, type_name::tags_offset()), RDI); /* Tags. */ \ |
| 470 } \ | 470 } \ |
| (...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1472 __ addq(RAX, Immediate(kHeapObjectTag)); | 1472 __ addq(RAX, Immediate(kHeapObjectTag)); |
| 1473 __ UpdateAllocationStatsWithSize(kOneByteStringCid, RDI); | 1473 __ UpdateAllocationStatsWithSize(kOneByteStringCid, RDI); |
| 1474 | 1474 |
| 1475 // Initialize the tags. | 1475 // Initialize the tags. |
| 1476 // RAX: new object start as a tagged pointer. | 1476 // RAX: new object start as a tagged pointer. |
| 1477 // RDI: allocation size. | 1477 // RDI: allocation size. |
| 1478 { | 1478 { |
| 1479 Label size_tag_overflow, done; | 1479 Label size_tag_overflow, done; |
| 1480 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); | 1480 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); |
| 1481 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); | 1481 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); |
| 1482 __ shlq(RDI, Immediate(RawObject::kSizeTagBit - kObjectAlignmentLog2)); | 1482 __ shlq(RDI, Immediate(RawObject::kSizeTagPos - kObjectAlignmentLog2)); |
| 1483 __ jmp(&done, Assembler::kNearJump); | 1483 __ jmp(&done, Assembler::kNearJump); |
| 1484 | 1484 |
| 1485 __ Bind(&size_tag_overflow); | 1485 __ Bind(&size_tag_overflow); |
| 1486 __ xorq(RDI, RDI); | 1486 __ xorq(RDI, RDI); |
| 1487 __ Bind(&done); | 1487 __ Bind(&done); |
| 1488 | 1488 |
| 1489 // Get the class index and insert it into the tags. | 1489 // Get the class index and insert it into the tags. |
| 1490 const Class& cls = | 1490 const Class& cls = |
| 1491 Class::Handle(isolate->object_store()->one_byte_string_class()); | 1491 Class::Handle(isolate->object_store()->one_byte_string_class()); |
| 1492 __ orq(RDI, Immediate(RawObject::ClassIdTag::encode(cls.id()))); | 1492 __ orq(RDI, Immediate(RawObject::ClassIdTag::encode(cls.id()))); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1695 // Clear Isolate::user_tag_. | 1695 // Clear Isolate::user_tag_. |
| 1696 __ movq(Address(RBX, Isolate::user_tag_offset()), Immediate(0)); | 1696 __ movq(Address(RBX, Isolate::user_tag_offset()), Immediate(0)); |
| 1697 __ ret(); | 1697 __ ret(); |
| 1698 } | 1698 } |
| 1699 | 1699 |
| 1700 #undef __ | 1700 #undef __ |
| 1701 | 1701 |
| 1702 } // namespace dart | 1702 } // namespace dart |
| 1703 | 1703 |
| 1704 #endif // defined TARGET_ARCH_X64 | 1704 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |