| 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_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 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 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1079 // Called for inline allocation of objects. | 1079 // Called for inline allocation of objects. |
| 1080 // Input parameters: | 1080 // Input parameters: |
| 1081 // RSP + 16 : type arguments object (only if class is parameterized). | 1081 // RSP + 16 : type arguments object (only if class is parameterized). |
| 1082 // RSP + 8 : type arguments of instantiator (only if class is parameterized). | 1082 // RSP + 8 : type arguments of instantiator (only if class is parameterized). |
| 1083 // RSP : points to return address. | 1083 // RSP : points to return address. |
| 1084 void StubCode::GenerateAllocationStubForClass(Assembler* assembler, | 1084 void StubCode::GenerateAllocationStubForClass(Assembler* assembler, |
| 1085 const Class& cls) { | 1085 const Class& cls) { |
| 1086 const intptr_t kObjectTypeArgumentsOffset = 2 * kWordSize; | 1086 const intptr_t kObjectTypeArgumentsOffset = 2 * kWordSize; |
| 1087 const intptr_t kInstantiatorTypeArgumentsOffset = 1 * kWordSize; | 1087 const intptr_t kInstantiatorTypeArgumentsOffset = 1 * kWordSize; |
| 1088 // The generated code is different if the class is parameterized. | 1088 // The generated code is different if the class is parameterized. |
| 1089 const bool is_cls_parameterized = cls.HasTypeArguments(); | 1089 const bool is_cls_parameterized = cls.NumTypeArguments() > 0; |
| 1090 ASSERT(!cls.HasTypeArguments() || | 1090 ASSERT(!is_cls_parameterized || |
| 1091 (cls.type_arguments_field_offset() != Class::kNoTypeArguments)); | 1091 (cls.type_arguments_field_offset() != Class::kNoTypeArguments)); |
| 1092 // kInlineInstanceSize is a constant used as a threshold for determining | 1092 // kInlineInstanceSize is a constant used as a threshold for determining |
| 1093 // when the object initialization should be done as a loop or as | 1093 // when the object initialization should be done as a loop or as |
| 1094 // straight line code. | 1094 // straight line code. |
| 1095 const int kInlineInstanceSize = 12; // In words. | 1095 const int kInlineInstanceSize = 12; // In words. |
| 1096 const intptr_t instance_size = cls.instance_size(); | 1096 const intptr_t instance_size = cls.instance_size(); |
| 1097 ASSERT(instance_size > 0); | 1097 ASSERT(instance_size > 0); |
| 1098 const intptr_t type_args_size = InstantiatedTypeArguments::InstanceSize(); | 1098 const intptr_t type_args_size = InstantiatedTypeArguments::InstanceSize(); |
| 1099 __ LoadObject(R12, Object::null_object(), PP); | 1099 __ LoadObject(R12, Object::null_object(), PP); |
| 1100 if (FLAG_inline_alloc && | 1100 if (FLAG_inline_alloc && |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1253 // RSP + 16 : receiver (null if not an implicit instance closure). | 1253 // RSP + 16 : receiver (null if not an implicit instance closure). |
| 1254 // RSP + 8 : type arguments object (null if class is not parameterized). | 1254 // RSP + 8 : type arguments object (null if class is not parameterized). |
| 1255 // RSP : points to return address. | 1255 // RSP : points to return address. |
| 1256 void StubCode::GenerateAllocationStubForClosure(Assembler* assembler, | 1256 void StubCode::GenerateAllocationStubForClosure(Assembler* assembler, |
| 1257 const Function& func) { | 1257 const Function& func) { |
| 1258 ASSERT(func.IsClosureFunction()); | 1258 ASSERT(func.IsClosureFunction()); |
| 1259 ASSERT(!func.IsImplicitStaticClosureFunction()); | 1259 ASSERT(!func.IsImplicitStaticClosureFunction()); |
| 1260 const bool is_implicit_instance_closure = | 1260 const bool is_implicit_instance_closure = |
| 1261 func.IsImplicitInstanceClosureFunction(); | 1261 func.IsImplicitInstanceClosureFunction(); |
| 1262 const Class& cls = Class::ZoneHandle(func.signature_class()); | 1262 const Class& cls = Class::ZoneHandle(func.signature_class()); |
| 1263 const bool has_type_arguments = cls.HasTypeArguments(); | 1263 const bool has_type_arguments = cls.NumTypeArguments() > 0; |
| 1264 | 1264 |
| 1265 __ EnterStubFrameWithPP(); // Uses pool pointer to refer to function. | 1265 __ EnterStubFrameWithPP(); // Uses pool pointer to refer to function. |
| 1266 __ LoadObject(R12, Object::null_object(), PP); | 1266 __ LoadObject(R12, Object::null_object(), PP); |
| 1267 const intptr_t kTypeArgumentsOffset = 4 * kWordSize; | 1267 const intptr_t kTypeArgumentsOffset = 4 * kWordSize; |
| 1268 const intptr_t kReceiverOffset = 5 * kWordSize; | 1268 const intptr_t kReceiverOffset = 5 * kWordSize; |
| 1269 const intptr_t closure_size = Closure::InstanceSize(); | 1269 const intptr_t closure_size = Closure::InstanceSize(); |
| 1270 const intptr_t context_size = Context::InstanceSize(1); // Captured receiver. | 1270 const intptr_t context_size = Context::InstanceSize(1); // Captured receiver. |
| 1271 if (FLAG_inline_alloc && | 1271 if (FLAG_inline_alloc && |
| 1272 Heap::IsAllocatableInNewSpace(closure_size + context_size)) { | 1272 Heap::IsAllocatableInNewSpace(closure_size + context_size)) { |
| 1273 Label slow_case; | 1273 Label slow_case; |
| (...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2134 __ movq(right, Address(RSP, 3 * kWordSize)); | 2134 __ movq(right, Address(RSP, 3 * kWordSize)); |
| 2135 GenerateIdenticalWithNumberCheckStub(assembler, left, right); | 2135 GenerateIdenticalWithNumberCheckStub(assembler, left, right); |
| 2136 __ popq(right); | 2136 __ popq(right); |
| 2137 __ popq(left); | 2137 __ popq(left); |
| 2138 __ ret(); | 2138 __ ret(); |
| 2139 } | 2139 } |
| 2140 | 2140 |
| 2141 } // namespace dart | 2141 } // namespace dart |
| 2142 | 2142 |
| 2143 #endif // defined TARGET_ARCH_X64 | 2143 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |