| 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_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 | 1060 |
| 1061 | 1061 |
| 1062 // Called for inline allocation of objects. | 1062 // Called for inline allocation of objects. |
| 1063 // Input parameters: | 1063 // Input parameters: |
| 1064 // LR : return address. | 1064 // LR : return address. |
| 1065 // SP + 4 : type arguments object (only if class is parameterized). | 1065 // SP + 4 : type arguments object (only if class is parameterized). |
| 1066 // SP + 0 : type arguments of instantiator (only if class is parameterized). | 1066 // SP + 0 : type arguments of instantiator (only if class is parameterized). |
| 1067 void StubCode::GenerateAllocationStubForClass(Assembler* assembler, | 1067 void StubCode::GenerateAllocationStubForClass(Assembler* assembler, |
| 1068 const Class& cls) { | 1068 const Class& cls) { |
| 1069 // The generated code is different if the class is parameterized. | 1069 // The generated code is different if the class is parameterized. |
| 1070 const bool is_cls_parameterized = cls.HasTypeArguments(); | 1070 const bool is_cls_parameterized = cls.NumTypeArguments() > 0; |
| 1071 ASSERT(!cls.HasTypeArguments() || | 1071 ASSERT(!is_cls_parameterized || |
| 1072 (cls.type_arguments_field_offset() != Class::kNoTypeArguments)); | 1072 (cls.type_arguments_field_offset() != Class::kNoTypeArguments)); |
| 1073 // kInlineInstanceSize is a constant used as a threshold for determining | 1073 // kInlineInstanceSize is a constant used as a threshold for determining |
| 1074 // when the object initialization should be done as a loop or as | 1074 // when the object initialization should be done as a loop or as |
| 1075 // straight line code. | 1075 // straight line code. |
| 1076 const int kInlineInstanceSize = 12; | 1076 const int kInlineInstanceSize = 12; |
| 1077 const intptr_t instance_size = cls.instance_size(); | 1077 const intptr_t instance_size = cls.instance_size(); |
| 1078 ASSERT(instance_size > 0); | 1078 ASSERT(instance_size > 0); |
| 1079 const intptr_t type_args_size = InstantiatedTypeArguments::InstanceSize(); | 1079 const intptr_t type_args_size = InstantiatedTypeArguments::InstanceSize(); |
| 1080 if (FLAG_inline_alloc && | 1080 if (FLAG_inline_alloc && |
| 1081 Heap::IsAllocatableInNewSpace(instance_size + type_args_size)) { | 1081 Heap::IsAllocatableInNewSpace(instance_size + type_args_size)) { |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1232 // LR : return address. | 1232 // LR : return address. |
| 1233 // SP + 4 : receiver (null if not an implicit instance closure). | 1233 // SP + 4 : receiver (null if not an implicit instance closure). |
| 1234 // SP + 0 : type arguments object (null if class is no parameterized). | 1234 // SP + 0 : type arguments object (null if class is no parameterized). |
| 1235 void StubCode::GenerateAllocationStubForClosure(Assembler* assembler, | 1235 void StubCode::GenerateAllocationStubForClosure(Assembler* assembler, |
| 1236 const Function& func) { | 1236 const Function& func) { |
| 1237 ASSERT(func.IsClosureFunction()); | 1237 ASSERT(func.IsClosureFunction()); |
| 1238 ASSERT(!func.IsImplicitStaticClosureFunction()); | 1238 ASSERT(!func.IsImplicitStaticClosureFunction()); |
| 1239 const bool is_implicit_instance_closure = | 1239 const bool is_implicit_instance_closure = |
| 1240 func.IsImplicitInstanceClosureFunction(); | 1240 func.IsImplicitInstanceClosureFunction(); |
| 1241 const Class& cls = Class::ZoneHandle(func.signature_class()); | 1241 const Class& cls = Class::ZoneHandle(func.signature_class()); |
| 1242 const bool has_type_arguments = cls.HasTypeArguments(); | 1242 const bool has_type_arguments = cls.NumTypeArguments() > 0; |
| 1243 | 1243 |
| 1244 __ EnterStubFrame(true); // Uses pool pointer to refer to function. | 1244 __ EnterStubFrame(true); // Uses pool pointer to refer to function. |
| 1245 const intptr_t kTypeArgumentsFPOffset = 3 * kWordSize; | 1245 const intptr_t kTypeArgumentsFPOffset = 3 * kWordSize; |
| 1246 const intptr_t kReceiverFPOffset = 4 * kWordSize; | 1246 const intptr_t kReceiverFPOffset = 4 * kWordSize; |
| 1247 const intptr_t closure_size = Closure::InstanceSize(); | 1247 const intptr_t closure_size = Closure::InstanceSize(); |
| 1248 const intptr_t context_size = Context::InstanceSize(1); // Captured receiver. | 1248 const intptr_t context_size = Context::InstanceSize(1); // Captured receiver. |
| 1249 if (FLAG_inline_alloc && | 1249 if (FLAG_inline_alloc && |
| 1250 Heap::IsAllocatableInNewSpace(closure_size + context_size)) { | 1250 Heap::IsAllocatableInNewSpace(closure_size + context_size)) { |
| 1251 Label slow_case; | 1251 Label slow_case; |
| 1252 Heap* heap = Isolate::Current()->heap(); | 1252 Heap* heap = Isolate::Current()->heap(); |
| (...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2105 __ ldr(left, Address(SP, 4 * kWordSize)); | 2105 __ ldr(left, Address(SP, 4 * kWordSize)); |
| 2106 __ ldr(right, Address(SP, 3 * kWordSize)); | 2106 __ ldr(right, Address(SP, 3 * kWordSize)); |
| 2107 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 2107 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
| 2108 __ PopList((1 << R0) | (1 << R1) | (1 << R2)); | 2108 __ PopList((1 << R0) | (1 << R1) | (1 << R2)); |
| 2109 __ Ret(); | 2109 __ Ret(); |
| 2110 } | 2110 } |
| 2111 | 2111 |
| 2112 } // namespace dart | 2112 } // namespace dart |
| 2113 | 2113 |
| 2114 #endif // defined TARGET_ARCH_ARM | 2114 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |