| 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" |
| 11 #include "vm/dart_entry.h" | 11 #include "vm/dart_entry.h" |
| 12 #include "vm/flow_graph_compiler.h" | 12 #include "vm/flow_graph_compiler.h" |
| 13 #include "vm/heap.h" |
| 13 #include "vm/instructions.h" | 14 #include "vm/instructions.h" |
| 14 #include "vm/object_store.h" | 15 #include "vm/object_store.h" |
| 15 #include "vm/stack_frame.h" | 16 #include "vm/stack_frame.h" |
| 16 #include "vm/stub_code.h" | 17 #include "vm/stub_code.h" |
| 17 | 18 |
| 18 #define __ assembler-> | 19 #define __ assembler-> |
| 19 | 20 |
| 20 namespace dart { | 21 namespace dart { |
| 21 | 22 |
| 22 DEFINE_FLAG(bool, inline_alloc, true, "Inline allocation of objects."); | 23 DEFINE_FLAG(bool, inline_alloc, true, "Inline allocation of objects."); |
| (...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 const bool is_cls_parameterized = | 927 const bool is_cls_parameterized = |
| 927 cls.type_arguments_field_offset() != Class::kNoTypeArguments; | 928 cls.type_arguments_field_offset() != Class::kNoTypeArguments; |
| 928 // kInlineInstanceSize is a constant used as a threshold for determining | 929 // kInlineInstanceSize is a constant used as a threshold for determining |
| 929 // when the object initialization should be done as a loop or as | 930 // when the object initialization should be done as a loop or as |
| 930 // straight line code. | 931 // straight line code. |
| 931 const int kInlineInstanceSize = 12; | 932 const int kInlineInstanceSize = 12; |
| 932 const intptr_t instance_size = cls.instance_size(); | 933 const intptr_t instance_size = cls.instance_size(); |
| 933 ASSERT(instance_size > 0); | 934 ASSERT(instance_size > 0); |
| 934 const intptr_t type_args_size = InstantiatedTypeArguments::InstanceSize(); | 935 const intptr_t type_args_size = InstantiatedTypeArguments::InstanceSize(); |
| 935 if (FLAG_inline_alloc && | 936 if (FLAG_inline_alloc && |
| 936 PageSpace::IsPageAllocatableSize(instance_size + type_args_size)) { | 937 Heap::IsNewAllocatableSize(instance_size + type_args_size)) { |
| 937 Label slow_case; | 938 Label slow_case; |
| 938 Heap* heap = Isolate::Current()->heap(); | 939 Heap* heap = Isolate::Current()->heap(); |
| 939 __ LoadImmediate(R5, heap->TopAddress()); | 940 __ LoadImmediate(R5, heap->TopAddress()); |
| 940 __ ldr(R2, Address(R5, 0)); | 941 __ ldr(R2, Address(R5, 0)); |
| 941 __ AddImmediate(R3, R2, instance_size); | 942 __ AddImmediate(R3, R2, instance_size); |
| 942 if (is_cls_parameterized) { | 943 if (is_cls_parameterized) { |
| 943 __ ldm(IA, SP, (1 << R0) | (1 << R1)); | 944 __ ldm(IA, SP, (1 << R0) | (1 << R1)); |
| 944 __ mov(R4, ShifterOperand(R3)); | 945 __ mov(R4, ShifterOperand(R3)); |
| 945 // A new InstantiatedTypeArguments object only needs to be allocated if | 946 // A new InstantiatedTypeArguments object only needs to be allocated if |
| 946 // the instantiator is provided (not kNoInstantiator, but may be null). | 947 // the instantiator is provided (not kNoInstantiator, but may be null). |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1096 func.IsImplicitInstanceClosureFunction(); | 1097 func.IsImplicitInstanceClosureFunction(); |
| 1097 const Class& cls = Class::ZoneHandle(func.signature_class()); | 1098 const Class& cls = Class::ZoneHandle(func.signature_class()); |
| 1098 const bool has_type_arguments = cls.HasTypeArguments(); | 1099 const bool has_type_arguments = cls.HasTypeArguments(); |
| 1099 | 1100 |
| 1100 __ EnterStubFrame(true); // Uses pool pointer to refer to function. | 1101 __ EnterStubFrame(true); // Uses pool pointer to refer to function. |
| 1101 const intptr_t kTypeArgumentsFPOffset = 3 * kWordSize; | 1102 const intptr_t kTypeArgumentsFPOffset = 3 * kWordSize; |
| 1102 const intptr_t kReceiverFPOffset = 4 * kWordSize; | 1103 const intptr_t kReceiverFPOffset = 4 * kWordSize; |
| 1103 const intptr_t closure_size = Closure::InstanceSize(); | 1104 const intptr_t closure_size = Closure::InstanceSize(); |
| 1104 const intptr_t context_size = Context::InstanceSize(1); // Captured receiver. | 1105 const intptr_t context_size = Context::InstanceSize(1); // Captured receiver. |
| 1105 if (FLAG_inline_alloc && | 1106 if (FLAG_inline_alloc && |
| 1106 PageSpace::IsPageAllocatableSize(closure_size + context_size)) { | 1107 Heap::IsNewAllocatableSize(closure_size + context_size)) { |
| 1107 Label slow_case; | 1108 Label slow_case; |
| 1108 Heap* heap = Isolate::Current()->heap(); | 1109 Heap* heap = Isolate::Current()->heap(); |
| 1109 __ LoadImmediate(R5, heap->TopAddress()); | 1110 __ LoadImmediate(R5, heap->TopAddress()); |
| 1110 __ ldr(R2, Address(R5, 0)); | 1111 __ ldr(R2, Address(R5, 0)); |
| 1111 __ AddImmediate(R3, R2, closure_size); | 1112 __ AddImmediate(R3, R2, closure_size); |
| 1112 if (is_implicit_instance_closure) { | 1113 if (is_implicit_instance_closure) { |
| 1113 __ mov(R4, ShifterOperand(R3)); // R4: new context address. | 1114 __ mov(R4, ShifterOperand(R3)); // R4: new context address. |
| 1114 __ AddImmediate(R3, context_size); | 1115 __ AddImmediate(R3, context_size); |
| 1115 } | 1116 } |
| 1116 // Check if the allocation fits into the remaining space. | 1117 // Check if the allocation fits into the remaining space. |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1902 __ Bind(&reference_compare); | 1903 __ Bind(&reference_compare); |
| 1903 __ cmp(left, ShifterOperand(right)); | 1904 __ cmp(left, ShifterOperand(right)); |
| 1904 __ Bind(&done); | 1905 __ Bind(&done); |
| 1905 __ PopList((1 << R0) | (1 << R1) | (1 << R2)); | 1906 __ PopList((1 << R0) | (1 << R1) | (1 << R2)); |
| 1906 __ Ret(); | 1907 __ Ret(); |
| 1907 } | 1908 } |
| 1908 | 1909 |
| 1909 } // namespace dart | 1910 } // namespace dart |
| 1910 | 1911 |
| 1911 #endif // defined TARGET_ARCH_ARM | 1912 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |