| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/assembler_macros.h" | 9 #include "vm/assembler_macros.h" |
| 10 #include "vm/code_generator.h" | 10 #include "vm/code_generator.h" |
| (...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1077 // Restore the frame pointer. | 1077 // Restore the frame pointer. |
| 1078 __ LeaveFrame(); | 1078 __ LeaveFrame(); |
| 1079 __ ret(); | 1079 __ ret(); |
| 1080 } | 1080 } |
| 1081 | 1081 |
| 1082 | 1082 |
| 1083 // Helper stub to implement Assembler::StoreIntoObject. | 1083 // Helper stub to implement Assembler::StoreIntoObject. |
| 1084 // Input parameters: | 1084 // Input parameters: |
| 1085 // EAX: Address being stored | 1085 // EAX: Address being stored |
| 1086 void StubCode::GenerateUpdateStoreBufferStub(Assembler* assembler) { | 1086 void StubCode::GenerateUpdateStoreBufferStub(Assembler* assembler) { |
| 1087 Label L; | |
| 1088 // Save values being destroyed. | 1087 // Save values being destroyed. |
| 1089 __ pushl(CTX); | 1088 __ pushl(CTX); |
| 1090 __ pushl(EBX); | 1089 __ pushl(EBX); |
| 1091 | 1090 |
| 1092 // Load the isolate out of the context. | 1091 // Load the isolate out of the context. |
| 1093 // EAX: Address being stored | 1092 // EAX: Address being stored |
| 1094 __ movl(CTX, FieldAddress(CTX, Context::isolate_offset())); | 1093 __ movl(CTX, FieldAddress(CTX, Context::isolate_offset())); |
| 1095 | 1094 |
| 1096 // Load top_ out of the StoreBufferBlock and add the address to the pointers_. | 1095 // Load top_ out of the StoreBufferBlock and add the address to the pointers_. |
| 1097 // EAX: Address being stored | 1096 // EAX: Address being stored |
| 1098 // CTX: Isolate | 1097 // CTX: Isolate |
| 1099 intptr_t store_buffer_offset = Isolate::store_buffer_offset(); | 1098 intptr_t store_buffer_offset = Isolate::store_buffer_offset(); |
| 1100 __ movl(EBX, | 1099 __ movl(EBX, |
| 1101 Address(CTX, store_buffer_offset + StoreBufferBlock::top_offset())); | 1100 Address(CTX, store_buffer_offset + StoreBufferBlock::top_offset())); |
| 1102 __ movl(Address(CTX, | 1101 __ movl(Address(CTX, |
| 1103 EBX, TIMES_4, | 1102 EBX, TIMES_4, |
| 1104 store_buffer_offset + StoreBufferBlock::pointers_offset()), | 1103 store_buffer_offset + StoreBufferBlock::pointers_offset()), |
| 1105 EAX); | 1104 EAX); |
| 1106 | 1105 |
| 1107 // Increment top_ and check for overflow. | 1106 // Increment top_ and check for overflow. |
| 1108 // EBX: top_ | 1107 // EBX: top_ |
| 1109 // CTX: Isolate | 1108 // CTX: Isolate |
| 1109 Label L; |
| 1110 __ incl(EBX); | 1110 __ incl(EBX); |
| 1111 __ movl(Address(CTX, store_buffer_offset + StoreBufferBlock::top_offset()), | 1111 __ movl(Address(CTX, store_buffer_offset + StoreBufferBlock::top_offset()), |
| 1112 EBX); | 1112 EBX); |
| 1113 __ cmpl(EBX, Immediate(StoreBufferBlock::kSize)); | 1113 __ cmpl(EBX, Immediate(StoreBufferBlock::kSize)); |
| 1114 __ j(NOT_EQUAL, &L, Assembler::kNearJump); | 1114 __ j(NOT_EQUAL, &L, Assembler::kNearJump); |
| 1115 | 1115 |
| 1116 // Handle overflow: Reset the top_ pointer. | 1116 // Handle overflow: Reset the top_ pointer. |
| 1117 // CTX: Isolate | 1117 // CTX: Isolate |
| 1118 __ movl(Address(CTX, store_buffer_offset + StoreBufferBlock::top_offset()), | 1118 __ movl(Address(CTX, store_buffer_offset + StoreBufferBlock::top_offset()), |
| 1119 Immediate(0)); | 1119 Immediate(0)); |
| 1120 | 1120 |
| 1121 __ Bind(&L); | 1121 __ Bind(&L); |
| 1122 | |
| 1123 // Restore values. | 1122 // Restore values. |
| 1124 __ popl(EBX); | 1123 __ popl(EBX); |
| 1125 __ popl(CTX); | 1124 __ popl(CTX); |
| 1126 __ ret(); | 1125 __ ret(); |
| 1127 } | 1126 } |
| 1128 | 1127 |
| 1129 | 1128 |
| 1130 // Called for inline allocation of objects. | 1129 // Called for inline allocation of objects. |
| 1131 // Input parameters: | 1130 // Input parameters: |
| 1132 // ESP + 8 : type arguments object (only if class is parameterized). | 1131 // ESP + 8 : type arguments object (only if class is parameterized). |
| (...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1903 // TOS + 2: instance. | 1902 // TOS + 2: instance. |
| 1904 // TOS + 3: cache array. | 1903 // TOS + 3: cache array. |
| 1905 // Result in ECX: null -> not found, otherwise result (true or false). | 1904 // Result in ECX: null -> not found, otherwise result (true or false). |
| 1906 void StubCode::GenerateSubtype3TestCacheStub(Assembler* assembler) { | 1905 void StubCode::GenerateSubtype3TestCacheStub(Assembler* assembler) { |
| 1907 GenerateSubtypeNTestCacheStub(assembler, 3); | 1906 GenerateSubtypeNTestCacheStub(assembler, 3); |
| 1908 } | 1907 } |
| 1909 | 1908 |
| 1910 } // namespace dart | 1909 } // namespace dart |
| 1911 | 1910 |
| 1912 #endif // defined TARGET_ARCH_IA32 | 1911 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |