| 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 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1088 // ESP + 4 : type arguments of instantiator (only if class is parameterized). | 1088 // ESP + 4 : type arguments of instantiator (only if class is parameterized). |
| 1089 // ESP : points to return address. | 1089 // ESP : points to return address. |
| 1090 // Uses EAX, EBX, ECX, EDX, EDI as temporary registers. | 1090 // Uses EAX, EBX, ECX, EDX, EDI as temporary registers. |
| 1091 void StubCode::GenerateAllocationStubForClass(Assembler* assembler, | 1091 void StubCode::GenerateAllocationStubForClass(Assembler* assembler, |
| 1092 const Class& cls) { | 1092 const Class& cls) { |
| 1093 const intptr_t kObjectTypeArgumentsOffset = 2 * kWordSize; | 1093 const intptr_t kObjectTypeArgumentsOffset = 2 * kWordSize; |
| 1094 const intptr_t kInstantiatorTypeArgumentsOffset = 1 * kWordSize; | 1094 const intptr_t kInstantiatorTypeArgumentsOffset = 1 * kWordSize; |
| 1095 const Immediate& raw_null = | 1095 const Immediate& raw_null = |
| 1096 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 1096 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1097 // The generated code is different if the class is parameterized. | 1097 // The generated code is different if the class is parameterized. |
| 1098 const bool is_cls_parameterized = cls.HasTypeArguments(); | 1098 const bool is_cls_parameterized = cls.NumTypeArguments() > 0; |
| 1099 ASSERT(!cls.HasTypeArguments() || | 1099 ASSERT(!is_cls_parameterized || |
| 1100 (cls.type_arguments_field_offset() != Class::kNoTypeArguments)); | 1100 (cls.type_arguments_field_offset() != Class::kNoTypeArguments)); |
| 1101 // kInlineInstanceSize is a constant used as a threshold for determining | 1101 // kInlineInstanceSize is a constant used as a threshold for determining |
| 1102 // when the object initialization should be done as a loop or as | 1102 // when the object initialization should be done as a loop or as |
| 1103 // straight line code. | 1103 // straight line code. |
| 1104 const int kInlineInstanceSize = 12; | 1104 const int kInlineInstanceSize = 12; |
| 1105 const intptr_t instance_size = cls.instance_size(); | 1105 const intptr_t instance_size = cls.instance_size(); |
| 1106 ASSERT(instance_size > 0); | 1106 ASSERT(instance_size > 0); |
| 1107 const intptr_t type_args_size = InstantiatedTypeArguments::InstanceSize(); | 1107 const intptr_t type_args_size = InstantiatedTypeArguments::InstanceSize(); |
| 1108 if (FLAG_inline_alloc && | 1108 if (FLAG_inline_alloc && |
| 1109 Heap::IsAllocatableInNewSpace(instance_size + type_args_size)) { | 1109 Heap::IsAllocatableInNewSpace(instance_size + type_args_size)) { |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1265 // Uses EAX, EBX, ECX, EDX as temporary registers. | 1265 // Uses EAX, EBX, ECX, EDX as temporary registers. |
| 1266 void StubCode::GenerateAllocationStubForClosure(Assembler* assembler, | 1266 void StubCode::GenerateAllocationStubForClosure(Assembler* assembler, |
| 1267 const Function& func) { | 1267 const Function& func) { |
| 1268 const Immediate& raw_null = | 1268 const Immediate& raw_null = |
| 1269 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 1269 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1270 ASSERT(func.IsClosureFunction()); | 1270 ASSERT(func.IsClosureFunction()); |
| 1271 ASSERT(!func.IsImplicitStaticClosureFunction()); | 1271 ASSERT(!func.IsImplicitStaticClosureFunction()); |
| 1272 const bool is_implicit_instance_closure = | 1272 const bool is_implicit_instance_closure = |
| 1273 func.IsImplicitInstanceClosureFunction(); | 1273 func.IsImplicitInstanceClosureFunction(); |
| 1274 const Class& cls = Class::ZoneHandle(func.signature_class()); | 1274 const Class& cls = Class::ZoneHandle(func.signature_class()); |
| 1275 const bool has_type_arguments = cls.HasTypeArguments(); | 1275 const bool has_type_arguments = cls.NumTypeArguments() > 0; |
| 1276 const intptr_t kTypeArgumentsOffset = 1 * kWordSize; | 1276 const intptr_t kTypeArgumentsOffset = 1 * kWordSize; |
| 1277 const intptr_t kReceiverOffset = 2 * kWordSize; | 1277 const intptr_t kReceiverOffset = 2 * kWordSize; |
| 1278 const intptr_t closure_size = Closure::InstanceSize(); | 1278 const intptr_t closure_size = Closure::InstanceSize(); |
| 1279 const intptr_t context_size = Context::InstanceSize(1); // Captured receiver. | 1279 const intptr_t context_size = Context::InstanceSize(1); // Captured receiver. |
| 1280 if (FLAG_inline_alloc && | 1280 if (FLAG_inline_alloc && |
| 1281 Heap::IsAllocatableInNewSpace(closure_size + context_size)) { | 1281 Heap::IsAllocatableInNewSpace(closure_size + context_size)) { |
| 1282 Label slow_case; | 1282 Label slow_case; |
| 1283 Heap* heap = Isolate::Current()->heap(); | 1283 Heap* heap = Isolate::Current()->heap(); |
| 1284 __ movl(EAX, Address::Absolute(heap->TopAddress())); | 1284 __ movl(EAX, Address::Absolute(heap->TopAddress())); |
| 1285 __ leal(EBX, Address(EAX, closure_size)); | 1285 __ leal(EBX, Address(EAX, closure_size)); |
| (...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2173 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 2173 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
| 2174 __ popl(temp); | 2174 __ popl(temp); |
| 2175 __ popl(right); | 2175 __ popl(right); |
| 2176 __ popl(left); | 2176 __ popl(left); |
| 2177 __ ret(); | 2177 __ ret(); |
| 2178 } | 2178 } |
| 2179 | 2179 |
| 2180 } // namespace dart | 2180 } // namespace dart |
| 2181 | 2181 |
| 2182 #endif // defined TARGET_ARCH_IA32 | 2182 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |