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_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
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 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 DECLARE_LEAF_RUNTIME_ENTRY(void, StoreBufferBlockProcess, Isolate* isolate); | 952 DECLARE_LEAF_RUNTIME_ENTRY(void, StoreBufferBlockProcess, Isolate* isolate); |
953 | 953 |
954 // Helper stub to implement Assembler::StoreIntoObject. | 954 // Helper stub to implement Assembler::StoreIntoObject. |
955 // Input parameters: | 955 // Input parameters: |
956 // EAX: Address being stored | 956 // EAX: Address being stored |
957 void StubCode::GenerateUpdateStoreBufferStub(Assembler* assembler) { | 957 void StubCode::GenerateUpdateStoreBufferStub(Assembler* assembler) { |
958 // Save values being destroyed. | 958 // Save values being destroyed. |
959 __ pushl(EDX); | 959 __ pushl(EDX); |
960 __ pushl(ECX); | 960 __ pushl(ECX); |
961 | 961 |
| 962 Label add_to_buffer; |
| 963 // Check whether this object has already been remembered. Skip adding to the |
| 964 // store buffer if the object is in the store buffer already. |
| 965 // Spilled: EDX, ECX |
| 966 // EAX: Address being stored |
| 967 __ movl(ECX, FieldAddress(EAX, Object::tags_offset())); |
| 968 __ testl(ECX, Immediate(1 << RawObject::kRememberedBit)); |
| 969 __ j(EQUAL, &add_to_buffer, Assembler::kNearJump); |
| 970 __ popl(ECX); |
| 971 __ popl(EDX); |
| 972 __ ret(); |
| 973 |
| 974 __ Bind(&add_to_buffer); |
| 975 __ orl(ECX, Immediate(1 << RawObject::kRememberedBit)); |
| 976 __ movl(FieldAddress(EAX, Object::tags_offset()), ECX); |
| 977 |
962 // Load the isolate out of the context. | 978 // Load the isolate out of the context. |
963 // Spilled: EDX, ECX | 979 // Spilled: EDX, ECX |
964 // EAX: Address being stored | 980 // EAX: Address being stored |
965 __ movl(EDX, FieldAddress(CTX, Context::isolate_offset())); | 981 __ movl(EDX, FieldAddress(CTX, Context::isolate_offset())); |
966 | 982 |
967 // Load top_ out of the StoreBufferBlock and add the address to the pointers_. | 983 // Load the StoreBuffer block out of the isolate. Then load top_ out of the |
| 984 // StoreBufferBlock and add the address to the pointers_. |
968 // Spilled: EDX, ECX | 985 // Spilled: EDX, ECX |
969 // EAX: Address being stored | 986 // EAX: Address being stored |
970 // EDX: Isolate | 987 // EDX: Isolate |
971 intptr_t store_buffer_offset = Isolate::store_buffer_block_offset(); | 988 __ movl(EDX, Address(EDX, Isolate::store_buffer_offset())); |
972 __ movl(ECX, | 989 __ movl(ECX, Address(EDX, StoreBufferBlock::top_offset())); |
973 Address(EDX, store_buffer_offset + StoreBufferBlock::top_offset())); | 990 __ movl(Address(EDX, ECX, TIMES_4, StoreBufferBlock::pointers_offset()), EAX); |
974 __ movl(Address(EDX, | |
975 ECX, TIMES_4, | |
976 store_buffer_offset + StoreBufferBlock::pointers_offset()), | |
977 EAX); | |
978 | 991 |
979 // Increment top_ and check for overflow. | 992 // Increment top_ and check for overflow. |
980 // Spilled: EDX, ECX | 993 // Spilled: EDX, ECX |
981 // ECX: top_ | 994 // ECX: top_ |
982 // EDX: Isolate | 995 // EDX: StoreBufferBlock |
983 Label L; | 996 Label L; |
984 __ incl(ECX); | 997 __ incl(ECX); |
985 __ movl(Address(EDX, store_buffer_offset + StoreBufferBlock::top_offset()), | 998 __ movl(Address(EDX, StoreBufferBlock::top_offset()), ECX); |
986 ECX); | |
987 __ cmpl(ECX, Immediate(StoreBufferBlock::kSize)); | 999 __ cmpl(ECX, Immediate(StoreBufferBlock::kSize)); |
988 // Restore values. | 1000 // Restore values. |
989 // Spilled: EDX, ECX | 1001 // Spilled: EDX, ECX |
990 __ popl(ECX); | 1002 __ popl(ECX); |
991 __ popl(EDX); | 1003 __ popl(EDX); |
992 __ j(EQUAL, &L, Assembler::kNearJump); | 1004 __ j(EQUAL, &L, Assembler::kNearJump); |
993 __ ret(); | 1005 __ ret(); |
994 | 1006 |
995 // Handle overflow: Call the runtime leaf function. | 1007 // Handle overflow: Call the runtime leaf function. |
996 __ Bind(&L); | 1008 __ Bind(&L); |
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2099 __ Bind(&done); | 2111 __ Bind(&done); |
2100 __ popl(temp); | 2112 __ popl(temp); |
2101 __ popl(right); | 2113 __ popl(right); |
2102 __ popl(left); | 2114 __ popl(left); |
2103 __ ret(); | 2115 __ ret(); |
2104 } | 2116 } |
2105 | 2117 |
2106 } // namespace dart | 2118 } // namespace dart |
2107 | 2119 |
2108 #endif // defined TARGET_ARCH_IA32 | 2120 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |