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" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 __ pushq(RAX); | 1027 __ pushq(RAX); |
1028 __ pushq(RCX); | 1028 __ pushq(RCX); |
1029 | 1029 |
1030 Label add_to_buffer; | 1030 Label add_to_buffer; |
1031 // Check whether this object has already been remembered. Skip adding to the | 1031 // Check whether this object has already been remembered. Skip adding to the |
1032 // store buffer if the object is in the store buffer already. | 1032 // store buffer if the object is in the store buffer already. |
1033 // Spilled: RAX, RCX | 1033 // Spilled: RAX, RCX |
1034 // RDX: Address being stored | 1034 // RDX: Address being stored |
1035 Label reload; | 1035 Label reload; |
1036 __ Bind(&reload); | 1036 __ Bind(&reload); |
1037 __ movl(RAX, FieldAddress(RDX, Object::tags_offset())); | 1037 __ movq(RAX, FieldAddress(RDX, Object::tags_offset())); |
1038 __ testl(RAX, Immediate(1 << RawObject::kRememberedBit)); | 1038 __ testq(RAX, Immediate(1 << RawObject::kRememberedBit)); |
1039 __ j(EQUAL, &add_to_buffer, Assembler::kNearJump); | 1039 __ j(EQUAL, &add_to_buffer, Assembler::kNearJump); |
1040 __ popq(RCX); | 1040 __ popq(RCX); |
1041 __ popq(RAX); | 1041 __ popq(RAX); |
1042 __ ret(); | 1042 __ ret(); |
1043 | 1043 |
1044 // Update the tags that this object has been remembered. | 1044 // Update the tags that this object has been remembered. |
1045 // Note that we use 32 bit operations here to match the size of the | |
1046 // background sweeper which is also manipulating this 32 bit word. | |
1047 // RDX: Address being stored | 1045 // RDX: Address being stored |
1048 // RAX: Current tag value | 1046 // RAX: Current tag value |
1049 __ Bind(&add_to_buffer); | 1047 __ Bind(&add_to_buffer); |
1050 __ movl(RCX, RAX); | 1048 __ movq(RCX, RAX); |
1051 __ orl(RCX, Immediate(1 << RawObject::kRememberedBit)); | 1049 __ orq(RCX, Immediate(1 << RawObject::kRememberedBit)); |
1052 // Compare the tag word with RAX, update to RCX if unchanged. | 1050 // Compare the tag word with RAX, update to RCX if unchanged. |
1053 __ LockCmpxchgl(FieldAddress(RDX, Object::tags_offset()), RCX); | 1051 __ LockCmpxchgq(FieldAddress(RDX, Object::tags_offset()), RCX); |
1054 __ j(NOT_EQUAL, &reload); | 1052 __ j(NOT_EQUAL, &reload); |
1055 | 1053 |
1056 // Load the StoreBuffer block out of the thread. Then load top_ out of the | 1054 // Load the StoreBuffer block out of the thread. Then load top_ out of the |
1057 // StoreBufferBlock and add the address to the pointers_. | 1055 // StoreBufferBlock and add the address to the pointers_. |
1058 // RDX: Address being stored | 1056 // RDX: Address being stored |
1059 __ movq(RAX, Address(THR, Thread::store_buffer_block_offset())); | 1057 __ movq(RAX, Address(THR, Thread::store_buffer_block_offset())); |
1060 __ movl(RCX, Address(RAX, StoreBufferBlock::top_offset())); | 1058 __ movl(RCX, Address(RAX, StoreBufferBlock::top_offset())); |
1061 __ movq(Address(RAX, RCX, TIMES_8, StoreBufferBlock::pointers_offset()), RDX); | 1059 __ movq(Address(RAX, RCX, TIMES_8, StoreBufferBlock::pointers_offset()), RDX); |
1062 | 1060 |
1063 // Increment top_ and check for overflow. | 1061 // Increment top_ and check for overflow. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 } else { | 1125 } else { |
1128 __ j(ABOVE_EQUAL, &slow_case); | 1126 __ j(ABOVE_EQUAL, &slow_case); |
1129 } | 1127 } |
1130 __ movq(Address(RCX, Heap::TopOffset(space)), RBX); | 1128 __ movq(Address(RCX, Heap::TopOffset(space)), RBX); |
1131 NOT_IN_PRODUCT(__ UpdateAllocationStats(cls.id(), space)); | 1129 NOT_IN_PRODUCT(__ UpdateAllocationStats(cls.id(), space)); |
1132 | 1130 |
1133 // RAX: new object start (untagged). | 1131 // RAX: new object start (untagged). |
1134 // RBX: next object start. | 1132 // RBX: next object start. |
1135 // RDX: new object type arguments (if is_cls_parameterized). | 1133 // RDX: new object type arguments (if is_cls_parameterized). |
1136 // Set the tags. | 1134 // Set the tags. |
1137 uint32_t tags = 0; | 1135 uword tags = 0; |
1138 tags = RawObject::SizeTag::update(instance_size, tags); | 1136 tags = RawObject::SizeTag::update(instance_size, tags); |
1139 ASSERT(cls.id() != kIllegalCid); | 1137 ASSERT(cls.id() != kIllegalCid); |
1140 tags = RawObject::ClassIdTag::update(cls.id(), tags); | 1138 tags = RawObject::ClassIdTag::update(cls.id(), tags); |
1141 // 64 bit store also zeros the identity hash field. | |
1142 __ movq(Address(RAX, Instance::tags_offset()), Immediate(tags)); | 1139 __ movq(Address(RAX, Instance::tags_offset()), Immediate(tags)); |
1143 __ addq(RAX, Immediate(kHeapObjectTag)); | 1140 __ addq(RAX, Immediate(kHeapObjectTag)); |
1144 | 1141 |
1145 // Initialize the remaining words of the object. | 1142 // Initialize the remaining words of the object. |
1146 // RAX: new object (tagged). | 1143 // RAX: new object (tagged). |
1147 // RBX: next object start. | 1144 // RBX: next object start. |
1148 // RDX: new object type arguments (if is_cls_parameterized). | 1145 // RDX: new object type arguments (if is_cls_parameterized). |
1149 // R9: raw null. | 1146 // R9: raw null. |
1150 // First try inlining the initialization without a loop. | 1147 // First try inlining the initialization without a loop. |
1151 if (instance_size < (kInlineInstanceSize * kWordSize)) { | 1148 if (instance_size < (kInlineInstanceSize * kWordSize)) { |
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2323 } | 2320 } |
2324 | 2321 |
2325 | 2322 |
2326 void StubCode::GenerateAsynchronousGapMarkerStub(Assembler* assembler) { | 2323 void StubCode::GenerateAsynchronousGapMarkerStub(Assembler* assembler) { |
2327 __ int3(); | 2324 __ int3(); |
2328 } | 2325 } |
2329 | 2326 |
2330 } // namespace dart | 2327 } // namespace dart |
2331 | 2328 |
2332 #endif // defined TARGET_ARCH_X64 | 2329 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |