| 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 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 // Restore the frame pointer. | 921 // Restore the frame pointer. |
| 922 __ LeaveStubFrame(); | 922 __ LeaveStubFrame(); |
| 923 __ ret(); | 923 __ ret(); |
| 924 } | 924 } |
| 925 | 925 |
| 926 | 926 |
| 927 DECLARE_LEAF_RUNTIME_ENTRY(void, StoreBufferBlockProcess, Isolate* isolate); | 927 DECLARE_LEAF_RUNTIME_ENTRY(void, StoreBufferBlockProcess, Isolate* isolate); |
| 928 | 928 |
| 929 // Helper stub to implement Assembler::StoreIntoObject. | 929 // Helper stub to implement Assembler::StoreIntoObject. |
| 930 // Input parameters: | 930 // Input parameters: |
| 931 // RAX: Address being stored | 931 // RDX: Address being stored |
| 932 void StubCode::GenerateUpdateStoreBufferStub(Assembler* assembler) { | 932 void StubCode::GenerateUpdateStoreBufferStub(Assembler* assembler) { |
| 933 // Save registers being destroyed. | 933 // Save registers being destroyed. |
| 934 __ pushq(RDX); | 934 __ pushq(RAX); |
| 935 __ pushq(RCX); | 935 __ pushq(RCX); |
| 936 | 936 |
| 937 Label add_to_buffer; | 937 Label add_to_buffer; |
| 938 // Check whether this object has already been remembered. Skip adding to the | 938 // Check whether this object has already been remembered. Skip adding to the |
| 939 // store buffer if the object is in the store buffer already. | 939 // store buffer if the object is in the store buffer already. |
| 940 // Spilled: RDX, RCX | 940 // Spilled: RAX, RCX |
| 941 // RAX: Address being stored | 941 // RDX: Address being stored |
| 942 __ movq(RCX, FieldAddress(RAX, Object::tags_offset())); | 942 Label reload; |
| 943 __ Bind(&reload); |
| 944 __ movq(RCX, FieldAddress(RDX, Object::tags_offset())); |
| 943 __ testq(RCX, Immediate(1 << RawObject::kRememberedBit)); | 945 __ testq(RCX, Immediate(1 << RawObject::kRememberedBit)); |
| 944 __ j(EQUAL, &add_to_buffer, Assembler::kNearJump); | 946 __ j(EQUAL, &add_to_buffer, Assembler::kNearJump); |
| 945 __ popq(RCX); | 947 __ popq(RCX); |
| 946 __ popq(RDX); | 948 __ popq(RAX); |
| 947 __ ret(); | 949 __ ret(); |
| 948 | 950 |
| 951 // Update the tags that this object has been remembered. |
| 952 // RDX: Address being stored |
| 953 // RAX: Current tag value |
| 949 __ Bind(&add_to_buffer); | 954 __ Bind(&add_to_buffer); |
| 955 __ movq(RCX, RAX); |
| 950 __ orq(RCX, Immediate(1 << RawObject::kRememberedBit)); | 956 __ orq(RCX, Immediate(1 << RawObject::kRememberedBit)); |
| 951 __ movq(FieldAddress(RAX, Object::tags_offset()), RCX); | 957 // Compare the tag word with RAX, update to RCX if unchanged. |
| 958 __ LockCmpxchgq(FieldAddress(RDX, Object::tags_offset()), RCX); |
| 959 __ j(NOT_EQUAL, &reload); |
| 952 | 960 |
| 953 // Load the isolate. | 961 // Load the isolate. |
| 954 // RAX: Address being stored | 962 // RDX: Address being stored |
| 955 __ LoadIsolate(RDX); | 963 __ LoadIsolate(RAX); |
| 956 | 964 |
| 957 // Load the StoreBuffer block out of the isolate. Then load top_ out of the | 965 // Load the StoreBuffer block out of the isolate. Then load top_ out of the |
| 958 // StoreBufferBlock and add the address to the pointers_. | 966 // StoreBufferBlock and add the address to the pointers_. |
| 959 // RAX: Address being stored | 967 // RDX: Address being stored |
| 960 // RDX: Isolate | 968 // RAX: Isolate |
| 961 __ movq(RDX, Address(RDX, Isolate::store_buffer_offset())); | 969 __ movq(RAX, Address(RAX, Isolate::store_buffer_offset())); |
| 962 __ movl(RCX, Address(RDX, StoreBufferBlock::top_offset())); | 970 __ movl(RCX, Address(RAX, StoreBufferBlock::top_offset())); |
| 963 __ movq(Address(RDX, RCX, TIMES_8, StoreBufferBlock::pointers_offset()), RAX); | 971 __ movq(Address(RAX, RCX, TIMES_8, StoreBufferBlock::pointers_offset()), RDX); |
| 964 | 972 |
| 965 // Increment top_ and check for overflow. | 973 // Increment top_ and check for overflow. |
| 966 // RCX: top_ | 974 // RCX: top_ |
| 967 // RDX: StoreBufferBlock | 975 // RAX: StoreBufferBlock |
| 968 Label L; | 976 Label L; |
| 969 __ incq(RCX); | 977 __ incq(RCX); |
| 970 __ movl(Address(RDX, StoreBufferBlock::top_offset()), RCX); | 978 __ movl(Address(RAX, StoreBufferBlock::top_offset()), RCX); |
| 971 __ cmpl(RCX, Immediate(StoreBufferBlock::kSize)); | 979 __ cmpl(RCX, Immediate(StoreBufferBlock::kSize)); |
| 972 // Restore values. | 980 // Restore values. |
| 973 __ popq(RCX); | 981 __ popq(RCX); |
| 974 __ popq(RDX); | 982 __ popq(RAX); |
| 975 __ j(EQUAL, &L, Assembler::kNearJump); | 983 __ j(EQUAL, &L, Assembler::kNearJump); |
| 976 __ ret(); | 984 __ ret(); |
| 977 | 985 |
| 978 // Handle overflow: Call the runtime leaf function. | 986 // Handle overflow: Call the runtime leaf function. |
| 979 __ Bind(&L); | 987 __ Bind(&L); |
| 980 // Setup frame, push callee-saved registers. | 988 // Setup frame, push callee-saved registers. |
| 981 __ EnterCallRuntimeFrame(0); | 989 __ EnterCallRuntimeFrame(0); |
| 982 __ LoadIsolate(CallingConventions::kArg1Reg); | 990 __ LoadIsolate(CallingConventions::kArg1Reg); |
| 983 __ CallRuntime(kStoreBufferBlockProcessRuntimeEntry, 1); | 991 __ CallRuntime(kStoreBufferBlockProcessRuntimeEntry, 1); |
| 984 __ LeaveCallRuntimeFrame(); | 992 __ LeaveCallRuntimeFrame(); |
| (...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1951 | 1959 |
| 1952 __ movq(left, Address(RSP, 2 * kWordSize)); | 1960 __ movq(left, Address(RSP, 2 * kWordSize)); |
| 1953 __ movq(right, Address(RSP, 1 * kWordSize)); | 1961 __ movq(right, Address(RSP, 1 * kWordSize)); |
| 1954 GenerateIdenticalWithNumberCheckStub(assembler, left, right); | 1962 GenerateIdenticalWithNumberCheckStub(assembler, left, right); |
| 1955 __ ret(); | 1963 __ ret(); |
| 1956 } | 1964 } |
| 1957 | 1965 |
| 1958 } // namespace dart | 1966 } // namespace dart |
| 1959 | 1967 |
| 1960 #endif // defined TARGET_ARCH_X64 | 1968 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |