| 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 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 DECLARE_LEAF_RUNTIME_ENTRY(void, StoreBufferBlockProcess, Isolate* isolate); | 941 DECLARE_LEAF_RUNTIME_ENTRY(void, StoreBufferBlockProcess, Isolate* isolate); |
| 942 | 942 |
| 943 // Helper stub to implement Assembler::StoreIntoObject. | 943 // Helper stub to implement Assembler::StoreIntoObject. |
| 944 // Input parameters: | 944 // Input parameters: |
| 945 // RAX: Address being stored | 945 // RAX: Address being stored |
| 946 void StubCode::GenerateUpdateStoreBufferStub(Assembler* assembler) { | 946 void StubCode::GenerateUpdateStoreBufferStub(Assembler* assembler) { |
| 947 // Save registers being destroyed. | 947 // Save registers being destroyed. |
| 948 __ pushq(RDX); | 948 __ pushq(RDX); |
| 949 __ pushq(RCX); | 949 __ pushq(RCX); |
| 950 | 950 |
| 951 Label add_to_buffer; |
| 952 // Check whether this object has already been remembered. Skip adding to the |
| 953 // store buffer if the object is in the store buffer already. |
| 954 // Spilled: RDX, RCX |
| 955 // RAX: Address being stored |
| 956 __ movq(RCX, FieldAddress(RAX, Object::tags_offset())); |
| 957 __ testq(RCX, Immediate(1 << RawObject::kRememberedBit)); |
| 958 __ j(EQUAL, &add_to_buffer, Assembler::kNearJump); |
| 959 __ popq(RCX); |
| 960 __ popq(RDX); |
| 961 __ ret(); |
| 962 |
| 963 __ Bind(&add_to_buffer); |
| 964 __ orq(RCX, Immediate(1 << RawObject::kRememberedBit)); |
| 965 __ movq(FieldAddress(RAX, Object::tags_offset()), RCX); |
| 966 |
| 951 // Load the isolate out of the context. | 967 // Load the isolate out of the context. |
| 952 // RAX: Address being stored | 968 // RAX: Address being stored |
| 953 __ movq(RDX, FieldAddress(CTX, Context::isolate_offset())); | 969 __ movq(RDX, FieldAddress(CTX, Context::isolate_offset())); |
| 954 | 970 |
| 955 // Load top_ out of the StoreBufferBlock and add the address to the pointers_. | 971 // Load the StoreBuffer block out of the isolate. Then load top_ out of the |
| 972 // StoreBufferBlock and add the address to the pointers_. |
| 956 // RAX: Address being stored | 973 // RAX: Address being stored |
| 957 // RDX: Isolate | 974 // RDX: Isolate |
| 958 intptr_t store_buffer_offset = Isolate::store_buffer_block_offset(); | 975 __ movq(RDX, Address(RDX, Isolate::store_buffer_offset())); |
| 959 __ movl(RCX, | 976 __ movl(RCX, Address(RDX, StoreBufferBlock::top_offset())); |
| 960 Address(RDX, store_buffer_offset + StoreBufferBlock::top_offset())); | 977 __ movq(Address(RDX, RCX, TIMES_8, StoreBufferBlock::pointers_offset()), RAX); |
| 961 __ movq(Address(RDX, | |
| 962 RCX, TIMES_8, | |
| 963 store_buffer_offset + StoreBufferBlock::pointers_offset()), | |
| 964 RAX); | |
| 965 | 978 |
| 966 // Increment top_ and check for overflow. | 979 // Increment top_ and check for overflow. |
| 967 // RCX: top_ | 980 // RCX: top_ |
| 968 // RDX: Isolate | 981 // RDX: StoreBufferBlock |
| 969 Label L; | 982 Label L; |
| 970 __ incq(RCX); | 983 __ incq(RCX); |
| 971 __ movl(Address(RDX, store_buffer_offset + StoreBufferBlock::top_offset()), | 984 __ movl(Address(RDX, StoreBufferBlock::top_offset()), RCX); |
| 972 RCX); | |
| 973 __ cmpl(RCX, Immediate(StoreBufferBlock::kSize)); | 985 __ cmpl(RCX, Immediate(StoreBufferBlock::kSize)); |
| 974 // Restore values. | 986 // Restore values. |
| 975 __ popq(RCX); | 987 __ popq(RCX); |
| 976 __ popq(RDX); | 988 __ popq(RDX); |
| 977 __ j(EQUAL, &L, Assembler::kNearJump); | 989 __ j(EQUAL, &L, Assembler::kNearJump); |
| 978 __ ret(); | 990 __ ret(); |
| 979 | 991 |
| 980 // Handle overflow: Call the runtime leaf function. | 992 // Handle overflow: Call the runtime leaf function. |
| 981 __ Bind(&L); | 993 __ Bind(&L); |
| 982 // Setup frame, push callee-saved registers. | 994 // Setup frame, push callee-saved registers. |
| (...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2054 __ cmpq(left, right); | 2066 __ cmpq(left, right); |
| 2055 __ Bind(&done); | 2067 __ Bind(&done); |
| 2056 __ popq(right); | 2068 __ popq(right); |
| 2057 __ popq(left); | 2069 __ popq(left); |
| 2058 __ ret(); | 2070 __ ret(); |
| 2059 } | 2071 } |
| 2060 | 2072 |
| 2061 } // namespace dart | 2073 } // namespace dart |
| 2062 | 2074 |
| 2063 #endif // defined TARGET_ARCH_X64 | 2075 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |