| 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 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 __ CallRuntime(kAllocateContextRuntimeEntry); // Allocate context. | 1073 __ CallRuntime(kAllocateContextRuntimeEntry); // Allocate context. |
| 1074 __ popl(EAX); // Pop number of context variables argument. | 1074 __ popl(EAX); // Pop number of context variables argument. |
| 1075 __ popl(EAX); // Pop the new context object. | 1075 __ popl(EAX); // Pop the new context object. |
| 1076 // EAX: new object | 1076 // EAX: new object |
| 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. |
| 1084 // Input parameters: |
| 1085 // EAX: Address being stored |
| 1086 void StubCode::GenerateUpdateStoreBufferStub(Assembler* assembler) { |
| 1087 Label L; |
| 1088 // Save values being destroyed. |
| 1089 __ pushl(CTX); |
| 1090 __ pushl(EBX); |
| 1091 |
| 1092 // Load the isolate out of the context. |
| 1093 // EAX: Address being stored |
| 1094 __ movl(CTX, FieldAddress(CTX, Context::isolate_offset())); |
| 1095 |
| 1096 // Load top_ out of the StoreBufferBlock and add the address to the pointers_. |
| 1097 // EAX: Address being stored |
| 1098 // CTX: Isolate |
| 1099 intptr_t store_buffer_offset = Isolate::store_buffer_offset(); |
| 1100 __ movl(EBX, |
| 1101 Address(CTX, store_buffer_offset + StoreBufferBlock::top_offset())); |
| 1102 __ movl(Address(CTX, |
| 1103 EBX, TIMES_4, |
| 1104 store_buffer_offset + StoreBufferBlock::pointers_offset()), |
| 1105 EAX); |
| 1106 |
| 1107 // Increment top_ and check for overflow. |
| 1108 // EBX: top_ |
| 1109 // CTX: Isolate |
| 1110 __ incl(EBX); |
| 1111 __ movl(Address(CTX, store_buffer_offset + StoreBufferBlock::top_offset()), |
| 1112 EBX); |
| 1113 __ cmpl(EBX, Immediate(StoreBufferBlock::kSize)); |
| 1114 __ j(NOT_EQUAL, &L, Assembler::kNearJump); |
| 1115 |
| 1116 // Handle overflow: Reset the top_ pointer. |
| 1117 // CTX: Isolate |
| 1118 __ movl(Address(CTX, store_buffer_offset + StoreBufferBlock::top_offset()), |
| 1119 Immediate(0)); |
| 1120 |
| 1121 __ Bind(&L); |
| 1122 |
| 1123 // Restore values. |
| 1124 __ popl(EBX); |
| 1125 __ popl(CTX); |
| 1126 __ ret(); |
| 1127 } |
| 1128 |
| 1129 |
| 1083 // Called for inline allocation of objects. | 1130 // Called for inline allocation of objects. |
| 1084 // Input parameters: | 1131 // Input parameters: |
| 1085 // ESP + 8 : type arguments object (only if class is parameterized). | 1132 // ESP + 8 : type arguments object (only if class is parameterized). |
| 1086 // ESP + 4 : type arguments of instantiator (only if class is parameterized). | 1133 // ESP + 4 : type arguments of instantiator (only if class is parameterized). |
| 1087 // ESP : points to return address. | 1134 // ESP : points to return address. |
| 1088 // Uses EAX, EBX, ECX, EDX, EDI as temporary registers. | 1135 // Uses EAX, EBX, ECX, EDX, EDI as temporary registers. |
| 1089 void StubCode::GenerateAllocationStubForClass(Assembler* assembler, | 1136 void StubCode::GenerateAllocationStubForClass(Assembler* assembler, |
| 1090 const Class& cls) { | 1137 const Class& cls) { |
| 1091 const intptr_t kObjectTypeArgumentsOffset = 2 * kWordSize; | 1138 const intptr_t kObjectTypeArgumentsOffset = 2 * kWordSize; |
| 1092 const intptr_t kInstantiatorTypeArgumentsOffset = 1 * kWordSize; | 1139 const intptr_t kInstantiatorTypeArgumentsOffset = 1 * kWordSize; |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1856 // TOS + 2: instance. | 1903 // TOS + 2: instance. |
| 1857 // TOS + 3: cache array. | 1904 // TOS + 3: cache array. |
| 1858 // Result in ECX: null -> not found, otherwise result (true or false). | 1905 // Result in ECX: null -> not found, otherwise result (true or false). |
| 1859 void StubCode::GenerateSubtype3TestCacheStub(Assembler* assembler) { | 1906 void StubCode::GenerateSubtype3TestCacheStub(Assembler* assembler) { |
| 1860 GenerateSubtypeNTestCacheStub(assembler, 3); | 1907 GenerateSubtypeNTestCacheStub(assembler, 3); |
| 1861 } | 1908 } |
| 1862 | 1909 |
| 1863 } // namespace dart | 1910 } // namespace dart |
| 1864 | 1911 |
| 1865 #endif // defined TARGET_ARCH_IA32 | 1912 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |