| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 // This snippet of inlined code uses the following registers: | 94 // This snippet of inlined code uses the following registers: |
| 95 // RAX, RCX, R13 | 95 // RAX, RCX, R13 |
| 96 // and the newly allocated object is returned in RAX. | 96 // and the newly allocated object is returned in RAX. |
| 97 const intptr_t kTypeArgumentsOffset = 2 * kWordSize; | 97 const intptr_t kTypeArgumentsOffset = 2 * kWordSize; |
| 98 const intptr_t kArrayOffset = 1 * kWordSize; | 98 const intptr_t kArrayOffset = 1 * kWordSize; |
| 99 Label fall_through; | 99 Label fall_through; |
| 100 | 100 |
| 101 // Try allocating in new space. | 101 // Try allocating in new space. |
| 102 const Class& cls = Class::Handle( | 102 const Class& cls = Class::Handle( |
| 103 Isolate::Current()->object_store()->growable_object_array_class()); | 103 Isolate::Current()->object_store()->growable_object_array_class()); |
| 104 __ TryAllocate(cls, &fall_through, Assembler::kNearJump, RAX, PP); | 104 __ TryAllocate(cls, &fall_through, Assembler::kFarJump, RAX, kNoRegister); |
| 105 | 105 |
| 106 // Store backing array object in growable array object. | 106 // Store backing array object in growable array object. |
| 107 __ movq(RCX, Address(RSP, kArrayOffset)); // data argument. | 107 __ movq(RCX, Address(RSP, kArrayOffset)); // data argument. |
| 108 // RAX is new, no barrier needed. | 108 // RAX is new, no barrier needed. |
| 109 __ StoreIntoObjectNoBarrier( | 109 __ StoreIntoObjectNoBarrier( |
| 110 RAX, | 110 RAX, |
| 111 FieldAddress(RAX, GrowableObjectArray::data_offset()), | 111 FieldAddress(RAX, GrowableObjectArray::data_offset()), |
| 112 RCX); | 112 RCX); |
| 113 | 113 |
| 114 // RAX: new growable array object start as a tagged pointer. | 114 // RAX: new growable array object start as a tagged pointer. |
| 115 // Store the type argument field in the growable array object. | 115 // Store the type argument field in the growable array object. |
| 116 __ movq(RCX, Address(RSP, kTypeArgumentsOffset)); // type argument. | 116 __ movq(RCX, Address(RSP, kTypeArgumentsOffset)); // type argument. |
| 117 __ StoreIntoObjectNoBarrier( | 117 __ StoreIntoObjectNoBarrier( |
| 118 RAX, | 118 RAX, |
| 119 FieldAddress(RAX, GrowableObjectArray::type_arguments_offset()), | 119 FieldAddress(RAX, GrowableObjectArray::type_arguments_offset()), |
| 120 RCX); | 120 RCX); |
| 121 | 121 |
| 122 // Set the length field in the growable array object to 0. | 122 // Set the length field in the growable array object to 0. |
| 123 __ movq(FieldAddress(RAX, GrowableObjectArray::length_offset()), | 123 __ movq(FieldAddress(RAX, GrowableObjectArray::length_offset()), |
| 124 Immediate(0)); | 124 Immediate(0)); |
| 125 __ UpdateAllocationStats(kGrowableObjectArrayCid); | |
| 126 __ ret(); // returns the newly allocated object in RAX. | 125 __ ret(); // returns the newly allocated object in RAX. |
| 127 | 126 |
| 128 __ Bind(&fall_through); | 127 __ Bind(&fall_through); |
| 129 } | 128 } |
| 130 | 129 |
| 131 | 130 |
| 132 // Get length of growable object array. | 131 // Get length of growable object array. |
| 133 // On stack: growable array (+1), return-address (+0). | 132 // On stack: growable array (+1), return-address (+0). |
| 134 void Intrinsifier::GrowableList_getLength(Assembler* assembler) { | 133 void Intrinsifier::GrowableList_getLength(Assembler* assembler) { |
| 135 __ movq(RAX, Address(RSP, + 1 * kWordSize)); | 134 __ movq(RAX, Address(RSP, + 1 * kWordSize)); |
| (...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1652 // Set return value to Isolate::current_tag_. | 1651 // Set return value to Isolate::current_tag_. |
| 1653 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); | 1652 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); |
| 1654 __ ret(); | 1653 __ ret(); |
| 1655 } | 1654 } |
| 1656 | 1655 |
| 1657 #undef __ | 1656 #undef __ |
| 1658 | 1657 |
| 1659 } // namespace dart | 1658 } // namespace dart |
| 1660 | 1659 |
| 1661 #endif // defined TARGET_ARCH_X64 | 1660 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |