| 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_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
| 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 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 905 const bool is_cls_parameterized = | 906 const bool is_cls_parameterized = |
| 906 cls.type_arguments_field_offset() != Class::kNoTypeArguments; | 907 cls.type_arguments_field_offset() != Class::kNoTypeArguments; |
| 907 // kInlineInstanceSize is a constant used as a threshold for determining | 908 // kInlineInstanceSize is a constant used as a threshold for determining |
| 908 // when the object initialization should be done as a loop or as | 909 // when the object initialization should be done as a loop or as |
| 909 // straight line code. | 910 // straight line code. |
| 910 const int kInlineInstanceSize = 12; | 911 const int kInlineInstanceSize = 12; |
| 911 const intptr_t instance_size = cls.instance_size(); | 912 const intptr_t instance_size = cls.instance_size(); |
| 912 ASSERT(instance_size > 0); | 913 ASSERT(instance_size > 0); |
| 913 const intptr_t type_args_size = InstantiatedTypeArguments::InstanceSize(); | 914 const intptr_t type_args_size = InstantiatedTypeArguments::InstanceSize(); |
| 914 if (FLAG_inline_alloc && | 915 if (FLAG_inline_alloc && |
| 915 PageSpace::IsPageAllocatableSize(instance_size + type_args_size)) { | 916 Heap::IsNewAllocatableSize(instance_size + type_args_size)) { |
| 916 Label slow_case; | 917 Label slow_case; |
| 917 Heap* heap = Isolate::Current()->heap(); | 918 Heap* heap = Isolate::Current()->heap(); |
| 918 __ LoadImmediate(T5, heap->TopAddress()); | 919 __ LoadImmediate(T5, heap->TopAddress()); |
| 919 __ lw(T2, Address(T5)); | 920 __ lw(T2, Address(T5)); |
| 920 __ LoadImmediate(T4, instance_size); | 921 __ LoadImmediate(T4, instance_size); |
| 921 __ addu(T3, T2, T4); | 922 __ addu(T3, T2, T4); |
| 922 if (is_cls_parameterized) { | 923 if (is_cls_parameterized) { |
| 923 Label no_instantiator; | 924 Label no_instantiator; |
| 924 __ lw(T1, Address(SP, 1 * kWordSize)); | 925 __ lw(T1, Address(SP, 1 * kWordSize)); |
| 925 __ lw(T0, Address(SP, 0 * kWordSize)); | 926 __ lw(T0, Address(SP, 0 * kWordSize)); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1086 const Class& cls = Class::ZoneHandle(func.signature_class()); | 1087 const Class& cls = Class::ZoneHandle(func.signature_class()); |
| 1087 const bool has_type_arguments = cls.HasTypeArguments(); | 1088 const bool has_type_arguments = cls.HasTypeArguments(); |
| 1088 | 1089 |
| 1089 __ TraceSimMsg("AllocationStubForClosure"); | 1090 __ TraceSimMsg("AllocationStubForClosure"); |
| 1090 __ EnterStubFrame(true); // Uses pool pointer to refer to function. | 1091 __ EnterStubFrame(true); // Uses pool pointer to refer to function. |
| 1091 const intptr_t kTypeArgumentsFPOffset = 4 * kWordSize; | 1092 const intptr_t kTypeArgumentsFPOffset = 4 * kWordSize; |
| 1092 const intptr_t kReceiverFPOffset = 5 * kWordSize; | 1093 const intptr_t kReceiverFPOffset = 5 * kWordSize; |
| 1093 const intptr_t closure_size = Closure::InstanceSize(); | 1094 const intptr_t closure_size = Closure::InstanceSize(); |
| 1094 const intptr_t context_size = Context::InstanceSize(1); // Captured receiver. | 1095 const intptr_t context_size = Context::InstanceSize(1); // Captured receiver. |
| 1095 if (FLAG_inline_alloc && | 1096 if (FLAG_inline_alloc && |
| 1096 PageSpace::IsPageAllocatableSize(closure_size + context_size)) { | 1097 Heap::IsNewAllocatableSize(closure_size + context_size)) { |
| 1097 Label slow_case; | 1098 Label slow_case; |
| 1098 Heap* heap = Isolate::Current()->heap(); | 1099 Heap* heap = Isolate::Current()->heap(); |
| 1099 __ LoadImmediate(T5, heap->TopAddress()); | 1100 __ LoadImmediate(T5, heap->TopAddress()); |
| 1100 __ lw(T2, Address(T5)); | 1101 __ lw(T2, Address(T5)); |
| 1101 __ AddImmediate(T3, T2, closure_size); | 1102 __ AddImmediate(T3, T2, closure_size); |
| 1102 if (is_implicit_instance_closure) { | 1103 if (is_implicit_instance_closure) { |
| 1103 __ mov(T4, T3); // T4: new context address. | 1104 __ mov(T4, T3); // T4: new context address. |
| 1104 __ AddImmediate(T3, context_size); | 1105 __ AddImmediate(T3, context_size); |
| 1105 } | 1106 } |
| 1106 // Check if the allocation fits into the remaining space. | 1107 // Check if the allocation fits into the remaining space. |
| (...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1881 __ Bind(&done); | 1882 __ Bind(&done); |
| 1882 __ lw(T0, Address(SP, 0 * kWordSize)); | 1883 __ lw(T0, Address(SP, 0 * kWordSize)); |
| 1883 __ lw(T1, Address(SP, 1 * kWordSize)); | 1884 __ lw(T1, Address(SP, 1 * kWordSize)); |
| 1884 __ Ret(); | 1885 __ Ret(); |
| 1885 __ delay_slot()->addiu(SP, SP, Immediate(2 * kWordSize)); | 1886 __ delay_slot()->addiu(SP, SP, Immediate(2 * kWordSize)); |
| 1886 } | 1887 } |
| 1887 | 1888 |
| 1888 } // namespace dart | 1889 } // namespace dart |
| 1889 | 1890 |
| 1890 #endif // defined TARGET_ARCH_MIPS | 1891 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |