| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 __ j(ABOVE_EQUAL, &fall_through); | 66 __ j(ABOVE_EQUAL, &fall_through); |
| 67 | 67 |
| 68 // Successfully allocated the object(s), now update top to point to | 68 // Successfully allocated the object(s), now update top to point to |
| 69 // next object start and initialize the object. | 69 // next object start and initialize the object. |
| 70 __ movq(R13, Immediate(heap->TopAddress())); | 70 __ movq(R13, Immediate(heap->TopAddress())); |
| 71 __ movq(Address(R13, 0), RCX); | 71 __ movq(Address(R13, 0), RCX); |
| 72 __ addq(RAX, Immediate(kHeapObjectTag)); | 72 __ addq(RAX, Immediate(kHeapObjectTag)); |
| 73 | 73 |
| 74 // Initialize the tags. | 74 // Initialize the tags. |
| 75 // RAX: new object start as a tagged pointer. | 75 // RAX: new object start as a tagged pointer. |
| 76 // RCX: new object end address. | |
| 77 // RDI: allocation size. | 76 // RDI: allocation size. |
| 78 { | 77 { |
| 79 Label size_tag_overflow, done; | 78 Label size_tag_overflow, done; |
| 80 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); | 79 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); |
| 81 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); | 80 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); |
| 82 __ shlq(RDI, Immediate(RawObject::kSizeTagBit - kObjectAlignmentLog2)); | 81 __ shlq(RDI, Immediate(RawObject::kSizeTagBit - kObjectAlignmentLog2)); |
| 83 __ jmp(&done, Assembler::kNearJump); | 82 __ jmp(&done, Assembler::kNearJump); |
| 84 | 83 |
| 85 __ Bind(&size_tag_overflow); | 84 __ Bind(&size_tag_overflow); |
| 86 __ movq(RDI, Immediate(0)); | 85 __ movq(RDI, Immediate(0)); |
| 87 __ Bind(&done); | 86 __ Bind(&done); |
| 88 | 87 |
| 89 // Get the class index and insert it into the tags. | 88 // Get the class index and insert it into the tags. |
| 90 const Class& cls = Class::Handle(isolate->object_store()->array_class()); | 89 const Class& cls = Class::Handle(isolate->object_store()->array_class()); |
| 91 __ orq(RDI, Immediate(RawObject::ClassIdTag::encode(cls.id()))); | 90 __ orq(RDI, Immediate(RawObject::ClassIdTag::encode(cls.id()))); |
| 92 __ movq(FieldAddress(RAX, Array::tags_offset()), RDI); // Tags. | 91 __ movq(FieldAddress(RAX, Array::tags_offset()), RDI); // Tags. |
| 93 } | 92 } |
| 94 | 93 |
| 95 // RAX: new object start as a tagged pointer. | 94 // RAX: new object start as a tagged pointer. |
| 96 // RCX: new object end address. | |
| 97 // Store the type argument field. | 95 // Store the type argument field. |
| 98 __ movq(RDI, Address(RSP, kTypeArgumentsOffset)); // type argument. | 96 __ movq(RDI, Address(RSP, kTypeArgumentsOffset)); // type argument. |
| 99 __ StoreIntoObjectNoBarrier(RAX, | 97 __ StoreIntoObjectNoBarrier(RAX, |
| 100 FieldAddress(RAX, Array::type_arguments_offset()), | 98 FieldAddress(RAX, Array::type_arguments_offset()), |
| 101 RDI); | 99 RDI); |
| 102 | 100 |
| 103 // Set the length field. | 101 // Set the length field. |
| 104 __ movq(RDI, Address(RSP, kArrayLengthOffset)); // Array Length. | 102 __ movq(RDI, Address(RSP, kArrayLengthOffset)); // Array Length. |
| 105 __ StoreIntoObjectNoBarrier(RAX, | 103 __ StoreIntoObjectNoBarrier(RAX, |
| 106 FieldAddress(RAX, Array::length_offset()), | 104 FieldAddress(RAX, Array::length_offset()), |
| (...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1322 __ LoadObject(RAX, bool_true); | 1320 __ LoadObject(RAX, bool_true); |
| 1323 __ ret(); | 1321 __ ret(); |
| 1324 return true; | 1322 return true; |
| 1325 } | 1323 } |
| 1326 | 1324 |
| 1327 #undef __ | 1325 #undef __ |
| 1328 | 1326 |
| 1329 } // namespace dart | 1327 } // namespace dart |
| 1330 | 1328 |
| 1331 #endif // defined TARGET_ARCH_X64 | 1329 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |