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" // Needed here to get TARGET_ARCH_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
7 | 7 |
8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 | 9 |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 2168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2179 const Immediate& raw_null = | 2179 const Immediate& raw_null = |
2180 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 2180 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
2181 __ cmpl(instantiator_reg, raw_null); | 2181 __ cmpl(instantiator_reg, raw_null); |
2182 __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump); | 2182 __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump); |
2183 } | 2183 } |
2184 // Lookup cache before calling runtime. | 2184 // Lookup cache before calling runtime. |
2185 // TODO(fschneider): Consider moving this into a shared stub to reduce | 2185 // TODO(fschneider): Consider moving this into a shared stub to reduce |
2186 // generated code size. | 2186 // generated code size. |
2187 __ LoadObject(EDI, type_arguments()); | 2187 __ LoadObject(EDI, type_arguments()); |
2188 __ movl(EDI, FieldAddress(EDI, TypeArguments::instantiations_offset())); | 2188 __ movl(EDI, FieldAddress(EDI, TypeArguments::instantiations_offset())); |
2189 __ movl(EBX, FieldAddress(EDI, Array::length_offset())); | |
2190 __ leal(EDI, FieldAddress(EDI, Array::data_offset())); | 2189 __ leal(EDI, FieldAddress(EDI, Array::data_offset())); |
2191 __ leal(EBX, Address(EDI, EBX, TIMES_2, 0)); // EBX is smi. | 2190 // The instantiations cache is initialized with Object::zero_array() and is |
| 2191 // therefore guaranteed to contain kNoInstantiator. No length check needed. |
2192 Label loop, found, slow_case; | 2192 Label loop, found, slow_case; |
2193 __ Bind(&loop); | 2193 __ Bind(&loop); |
2194 __ cmpl(EDI, EBX); | |
2195 __ j(ABOVE_EQUAL, &slow_case); | |
2196 __ movl(EDX, Address(EDI, 0 * kWordSize)); // Cached instantiator. | 2194 __ movl(EDX, Address(EDI, 0 * kWordSize)); // Cached instantiator. |
2197 __ cmpl(EDX, EAX); | 2195 __ cmpl(EDX, EAX); |
2198 __ j(EQUAL, &found, Assembler::kNearJump); | 2196 __ j(EQUAL, &found, Assembler::kNearJump); |
| 2197 __ addl(EDI, Immediate(2 * kWordSize)); |
2199 __ cmpl(EDX, Immediate(Smi::RawValue(StubCode::kNoInstantiator))); | 2198 __ cmpl(EDX, Immediate(Smi::RawValue(StubCode::kNoInstantiator))); |
2200 __ j(EQUAL, &slow_case); | 2199 __ j(NOT_EQUAL, &loop, Assembler::kNearJump); |
2201 __ addl(EDI, Immediate(2 * kWordSize)); | 2200 __ jmp(&slow_case, Assembler::kNearJump); |
2202 __ jmp(&loop, Assembler::kNearJump); | |
2203 __ Bind(&found); | 2201 __ Bind(&found); |
2204 __ movl(EAX, Address(EDI, 1 * kWordSize)); // Cached instantiated args. | 2202 __ movl(EAX, Address(EDI, 1 * kWordSize)); // Cached instantiated args. |
2205 __ jmp(&type_arguments_instantiated); | 2203 __ jmp(&type_arguments_instantiated, Assembler::kNearJump); |
2206 | 2204 |
2207 __ Bind(&slow_case); | 2205 __ Bind(&slow_case); |
2208 // Instantiate non-null type arguments. | 2206 // Instantiate non-null type arguments. |
2209 // A runtime call to instantiate the type arguments is required. | 2207 // A runtime call to instantiate the type arguments is required. |
2210 __ PushObject(Object::ZoneHandle()); // Make room for the result. | 2208 __ PushObject(Object::ZoneHandle()); // Make room for the result. |
2211 __ PushObject(type_arguments()); | 2209 __ PushObject(type_arguments()); |
2212 __ pushl(instantiator_reg); // Push instantiator type arguments. | 2210 __ pushl(instantiator_reg); // Push instantiator type arguments. |
2213 compiler->GenerateRuntimeCall(token_pos(), | 2211 compiler->GenerateRuntimeCall(token_pos(), |
2214 deopt_id(), | 2212 deopt_id(), |
2215 kInstantiateTypeArgumentsRuntimeEntry, | 2213 kInstantiateTypeArgumentsRuntimeEntry, |
(...skipping 3061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5277 PcDescriptors::kOther, | 5275 PcDescriptors::kOther, |
5278 locs()); | 5276 locs()); |
5279 __ Drop(2); // Discard type arguments and receiver. | 5277 __ Drop(2); // Discard type arguments and receiver. |
5280 } | 5278 } |
5281 | 5279 |
5282 } // namespace dart | 5280 } // namespace dart |
5283 | 5281 |
5284 #undef __ | 5282 #undef __ |
5285 | 5283 |
5286 #endif // defined TARGET_ARCH_IA32 | 5284 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |