OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 __ popl(EAX); // Pop argument (type arguments of object). | 1174 __ popl(EAX); // Pop argument (type arguments of object). |
1175 __ popl(EAX); // Pop argument (class of object). | 1175 __ popl(EAX); // Pop argument (class of object). |
1176 __ popl(EAX); // Pop result (newly allocated object). | 1176 __ popl(EAX); // Pop result (newly allocated object). |
1177 // EAX: new object | 1177 // EAX: new object |
1178 // Restore the frame pointer. | 1178 // Restore the frame pointer. |
1179 __ LeaveFrame(); | 1179 __ LeaveFrame(); |
1180 __ ret(); | 1180 __ ret(); |
1181 } | 1181 } |
1182 | 1182 |
1183 | 1183 |
| 1184 void StubCode::GenerateMethodExtractor(Assembler* assembler, |
| 1185 const Function& closure_function) { |
| 1186 const Immediate raw_null = |
| 1187 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1188 |
| 1189 AssemblerMacros::EnterStubFrame(assembler); |
| 1190 __ movl(EAX, Address(EBP, 2 * kWordSize)); |
| 1191 __ pushl(EAX); // Push receiver. |
| 1192 |
| 1193 __ LoadClass(ECX, EAX, EBX); |
| 1194 // Compute instance type arguments into EBX. |
| 1195 Label has_no_type_arguments; |
| 1196 __ movl(EBX, raw_null); |
| 1197 __ movl(EDI, FieldAddress(ECX, |
| 1198 Class::type_arguments_field_offset_in_words_offset())); |
| 1199 __ cmpl(EDI, Immediate(Class::kNoTypeArguments)); |
| 1200 __ j(EQUAL, &has_no_type_arguments, Assembler::kNearJump); |
| 1201 __ movl(EBX, FieldAddress(EAX, EDI, TIMES_4, 0)); |
| 1202 __ Bind(&has_no_type_arguments); |
| 1203 __ pushl(EBX); // Push type arguments. |
| 1204 |
| 1205 const Code& stub = Code::Handle( |
| 1206 GetAllocationStubForClosure( |
| 1207 Function::ZoneHandle(closure_function.raw()))); |
| 1208 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); |
| 1209 __ call(&label); |
| 1210 __ Drop(2); // Drop receiver and type arguments. |
| 1211 __ LeaveFrame(); |
| 1212 __ ret(); |
| 1213 } |
| 1214 |
| 1215 |
1184 // Called for inline allocation of closures. | 1216 // Called for inline allocation of closures. |
1185 // Input parameters: | 1217 // Input parameters: |
1186 // ESP + 8 : receiver (null if not an implicit instance closure). | 1218 // ESP + 8 : receiver (null if not an implicit instance closure). |
1187 // ESP + 4 : type arguments object (null if class is no parameterized). | 1219 // ESP + 4 : type arguments object (null if class is no parameterized). |
1188 // ESP : points to return address. | 1220 // ESP : points to return address. |
1189 // Uses EAX, EBX, ECX, EDX as temporary registers. | 1221 // Uses EAX, EBX, ECX, EDX as temporary registers. |
1190 void StubCode::GenerateAllocationStubForClosure(Assembler* assembler, | 1222 void StubCode::GenerateAllocationStubForClosure(Assembler* assembler, |
1191 const Function& func) { | 1223 const Function& func) { |
1192 const Immediate raw_null = | 1224 const Immediate raw_null = |
1193 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 1225 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2111 __ Bind(&done); | 2143 __ Bind(&done); |
2112 __ popl(temp); | 2144 __ popl(temp); |
2113 __ popl(right); | 2145 __ popl(right); |
2114 __ popl(left); | 2146 __ popl(left); |
2115 __ ret(); | 2147 __ ret(); |
2116 } | 2148 } |
2117 | 2149 |
2118 } // namespace dart | 2150 } // namespace dart |
2119 | 2151 |
2120 #endif // defined TARGET_ARCH_IA32 | 2152 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |