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 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 // Update the tags that this object has been remembered. | 986 // Update the tags that this object has been remembered. |
987 // RDX: Address being stored | 987 // RDX: Address being stored |
988 // RAX: Current tag value | 988 // RAX: Current tag value |
989 __ Bind(&add_to_buffer); | 989 __ Bind(&add_to_buffer); |
990 __ movq(RCX, RAX); | 990 __ movq(RCX, RAX); |
991 __ orq(RCX, Immediate(1 << RawObject::kRememberedBit)); | 991 __ orq(RCX, Immediate(1 << RawObject::kRememberedBit)); |
992 // Compare the tag word with RAX, update to RCX if unchanged. | 992 // Compare the tag word with RAX, update to RCX if unchanged. |
993 __ LockCmpxchgq(FieldAddress(RDX, Object::tags_offset()), RCX); | 993 __ LockCmpxchgq(FieldAddress(RDX, Object::tags_offset()), RCX); |
994 __ j(NOT_EQUAL, &reload); | 994 __ j(NOT_EQUAL, &reload); |
995 | 995 |
996 // Load the isolate. | 996 // Load the StoreBuffer block out of the thread. Then load top_ out of the |
997 // RDX: Address being stored | |
998 __ LoadIsolate(RAX); | |
999 | |
1000 // Load the StoreBuffer block out of the isolate. Then load top_ out of the | |
1001 // StoreBufferBlock and add the address to the pointers_. | 997 // StoreBufferBlock and add the address to the pointers_. |
1002 // RDX: Address being stored | 998 // RDX: Address being stored |
1003 // RAX: Isolate | 999 __ movq(RAX, Address(THR, Thread::store_buffer_block_offset())); |
1004 __ movq(RAX, Address(RAX, Isolate::store_buffer_offset())); | |
1005 __ movl(RCX, Address(RAX, StoreBufferBlock::top_offset())); | 1000 __ movl(RCX, Address(RAX, StoreBufferBlock::top_offset())); |
1006 __ movq(Address(RAX, RCX, TIMES_8, StoreBufferBlock::pointers_offset()), RDX); | 1001 __ movq(Address(RAX, RCX, TIMES_8, StoreBufferBlock::pointers_offset()), RDX); |
1007 | 1002 |
1008 // Increment top_ and check for overflow. | 1003 // Increment top_ and check for overflow. |
1009 // RCX: top_ | 1004 // RCX: top_ |
1010 // RAX: StoreBufferBlock | 1005 // RAX: StoreBufferBlock |
1011 Label L; | 1006 Label L; |
1012 __ incq(RCX); | 1007 __ incq(RCX); |
1013 __ movl(Address(RAX, StoreBufferBlock::top_offset()), RCX); | 1008 __ movl(Address(RAX, StoreBufferBlock::top_offset()), RCX); |
1014 __ cmpl(RCX, Immediate(StoreBufferBlock::kSize)); | 1009 __ cmpl(RCX, Immediate(StoreBufferBlock::kSize)); |
1015 // Restore values. | 1010 // Restore values. |
1016 __ popq(RCX); | 1011 __ popq(RCX); |
1017 __ popq(RAX); | 1012 __ popq(RAX); |
1018 __ j(EQUAL, &L, Assembler::kNearJump); | 1013 __ j(EQUAL, &L, Assembler::kNearJump); |
1019 __ ret(); | 1014 __ ret(); |
1020 | 1015 |
1021 // Handle overflow: Call the runtime leaf function. | 1016 // Handle overflow: Call the runtime leaf function. |
1022 __ Bind(&L); | 1017 __ Bind(&L); |
1023 // Setup frame, push callee-saved registers. | 1018 // Setup frame, push callee-saved registers. |
1024 __ EnterCallRuntimeFrame(0); | 1019 __ EnterCallRuntimeFrame(0); |
1025 __ LoadIsolate(CallingConventions::kArg1Reg); | 1020 __ movq(CallingConventions::kArg1Reg, THR); |
1026 __ CallRuntime(kStoreBufferBlockProcessRuntimeEntry, 1); | 1021 __ CallRuntime(kStoreBufferBlockProcessRuntimeEntry, 1); |
1027 __ LeaveCallRuntimeFrame(); | 1022 __ LeaveCallRuntimeFrame(); |
1028 __ ret(); | 1023 __ ret(); |
1029 } | 1024 } |
1030 | 1025 |
1031 | 1026 |
1032 // Called for inline allocation of objects. | 1027 // Called for inline allocation of objects. |
1033 // Input parameters: | 1028 // Input parameters: |
1034 // RSP + 8 : type arguments object (only if class is parameterized). | 1029 // RSP + 8 : type arguments object (only if class is parameterized). |
1035 // RSP : points to return address. | 1030 // RSP : points to return address. |
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2140 // Result: | 2135 // Result: |
2141 // RCX: entry point. | 2136 // RCX: entry point. |
2142 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { | 2137 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { |
2143 EmitMegamorphicLookup(assembler, RDI, RBX, RCX); | 2138 EmitMegamorphicLookup(assembler, RDI, RBX, RCX); |
2144 __ ret(); | 2139 __ ret(); |
2145 } | 2140 } |
2146 | 2141 |
2147 } // namespace dart | 2142 } // namespace dart |
2148 | 2143 |
2149 #endif // defined TARGET_ARCH_X64 | 2144 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |