Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: runtime/vm/stub_code_x64.cc

Issue 2965723002: VM: Reland Inline instance object hash code into object header on 64bit. (Closed)
Patch Set: Fix snapshot incompatibility that sank Flutter Gallery Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« runtime/vm/intrinsifier.cc ('K') | « runtime/vm/stub_code_ia32.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 __ movq(RAX, FieldAddress(RDX, Object::tags_offset())); 1037 __ movl(RAX, FieldAddress(RDX, Object::tags_offset()));
1038 __ testq(RAX, Immediate(1 << RawObject::kRememberedBit)); 1038 __ testl(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.
1045 // RDX: Address being stored 1047 // RDX: Address being stored
1046 // RAX: Current tag value 1048 // RAX: Current tag value
1047 __ Bind(&add_to_buffer); 1049 __ Bind(&add_to_buffer);
1048 __ movq(RCX, RAX); 1050 __ movl(RCX, RAX);
1049 __ orq(RCX, Immediate(1 << RawObject::kRememberedBit)); 1051 __ orl(RCX, Immediate(1 << RawObject::kRememberedBit));
1050 // Compare the tag word with RAX, update to RCX if unchanged. 1052 // Compare the tag word with RAX, update to RCX if unchanged.
1051 __ LockCmpxchgq(FieldAddress(RDX, Object::tags_offset()), RCX); 1053 __ LockCmpxchgl(FieldAddress(RDX, Object::tags_offset()), RCX);
1052 __ j(NOT_EQUAL, &reload); 1054 __ j(NOT_EQUAL, &reload);
1053 1055
1054 // Load the StoreBuffer block out of the thread. Then load top_ out of the 1056 // Load the StoreBuffer block out of the thread. Then load top_ out of the
1055 // StoreBufferBlock and add the address to the pointers_. 1057 // StoreBufferBlock and add the address to the pointers_.
1056 // RDX: Address being stored 1058 // RDX: Address being stored
1057 __ movq(RAX, Address(THR, Thread::store_buffer_block_offset())); 1059 __ movq(RAX, Address(THR, Thread::store_buffer_block_offset()));
1058 __ movl(RCX, Address(RAX, StoreBufferBlock::top_offset())); 1060 __ movl(RCX, Address(RAX, StoreBufferBlock::top_offset()));
1059 __ movq(Address(RAX, RCX, TIMES_8, StoreBufferBlock::pointers_offset()), RDX); 1061 __ movq(Address(RAX, RCX, TIMES_8, StoreBufferBlock::pointers_offset()), RDX);
1060 1062
1061 // Increment top_ and check for overflow. 1063 // Increment top_ and check for overflow.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 } else { 1127 } else {
1126 __ j(ABOVE_EQUAL, &slow_case); 1128 __ j(ABOVE_EQUAL, &slow_case);
1127 } 1129 }
1128 __ movq(Address(RCX, Heap::TopOffset(space)), RBX); 1130 __ movq(Address(RCX, Heap::TopOffset(space)), RBX);
1129 NOT_IN_PRODUCT(__ UpdateAllocationStats(cls.id(), space)); 1131 NOT_IN_PRODUCT(__ UpdateAllocationStats(cls.id(), space));
1130 1132
1131 // RAX: new object start (untagged). 1133 // RAX: new object start (untagged).
1132 // RBX: next object start. 1134 // RBX: next object start.
1133 // RDX: new object type arguments (if is_cls_parameterized). 1135 // RDX: new object type arguments (if is_cls_parameterized).
1134 // Set the tags. 1136 // Set the tags.
1135 uword tags = 0; 1137 uint32_t tags = 0;
1136 tags = RawObject::SizeTag::update(instance_size, tags); 1138 tags = RawObject::SizeTag::update(instance_size, tags);
1137 ASSERT(cls.id() != kIllegalCid); 1139 ASSERT(cls.id() != kIllegalCid);
1138 tags = RawObject::ClassIdTag::update(cls.id(), tags); 1140 tags = RawObject::ClassIdTag::update(cls.id(), tags);
1141 // 64 bit store also zeros the identity hash field.
1139 __ movq(Address(RAX, Instance::tags_offset()), Immediate(tags)); 1142 __ movq(Address(RAX, Instance::tags_offset()), Immediate(tags));
1140 __ addq(RAX, Immediate(kHeapObjectTag)); 1143 __ addq(RAX, Immediate(kHeapObjectTag));
1141 1144
1142 // Initialize the remaining words of the object. 1145 // Initialize the remaining words of the object.
1143 // RAX: new object (tagged). 1146 // RAX: new object (tagged).
1144 // RBX: next object start. 1147 // RBX: next object start.
1145 // RDX: new object type arguments (if is_cls_parameterized). 1148 // RDX: new object type arguments (if is_cls_parameterized).
1146 // R9: raw null. 1149 // R9: raw null.
1147 // First try inlining the initialization without a loop. 1150 // First try inlining the initialization without a loop.
1148 if (instance_size < (kInlineInstanceSize * kWordSize)) { 1151 if (instance_size < (kInlineInstanceSize * kWordSize)) {
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after
2320 } 2323 }
2321 2324
2322 2325
2323 void StubCode::GenerateAsynchronousGapMarkerStub(Assembler* assembler) { 2326 void StubCode::GenerateAsynchronousGapMarkerStub(Assembler* assembler) {
2324 __ int3(); 2327 __ int3();
2325 } 2328 }
2326 2329
2327 } // namespace dart 2330 } // namespace dart
2328 2331
2329 #endif // defined TARGET_ARCH_X64 2332 #endif // defined TARGET_ARCH_X64
OLDNEW
« runtime/vm/intrinsifier.cc ('K') | « runtime/vm/stub_code_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698