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" |
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 // First compute the rounded instance size. | 943 // First compute the rounded instance size. |
944 // T1: number of context variables. | 944 // T1: number of context variables. |
945 intptr_t fixed_size = sizeof(RawContext) + kObjectAlignment - 1; | 945 intptr_t fixed_size = sizeof(RawContext) + kObjectAlignment - 1; |
946 __ LoadImmediate(T2, fixed_size); | 946 __ LoadImmediate(T2, fixed_size); |
947 __ sll(T0, T1, 2); | 947 __ sll(T0, T1, 2); |
948 __ addu(T2, T2, T0); | 948 __ addu(T2, T2, T0); |
949 ASSERT(kSmiTagShift == 1); | 949 ASSERT(kSmiTagShift == 1); |
950 __ LoadImmediate(T0, ~((kObjectAlignment) - 1)); | 950 __ LoadImmediate(T0, ~((kObjectAlignment) - 1)); |
951 __ and_(T2, T2, T0); | 951 __ and_(T2, T2, T0); |
952 | 952 |
| 953 __ MaybeTraceAllocation(kContextCid, T4, &slow_case, |
| 954 /* inline_isolate = */ false); |
953 // Now allocate the object. | 955 // Now allocate the object. |
954 // T1: number of context variables. | 956 // T1: number of context variables. |
955 // T2: object size. | 957 // T2: object size. |
956 const intptr_t cid = kContextCid; | 958 const intptr_t cid = kContextCid; |
957 Heap::Space space = Heap::SpaceForAllocation(cid); | 959 Heap::Space space = Heap::SpaceForAllocation(cid); |
958 __ LoadIsolate(T5); | 960 __ LoadIsolate(T5); |
959 __ lw(T5, Address(T5, Isolate::heap_offset())); | 961 __ lw(T5, Address(T5, Isolate::heap_offset())); |
960 __ lw(V0, Address(T5, Heap::TopOffset(space))); | 962 __ lw(V0, Address(T5, Heap::TopOffset(space))); |
961 __ addu(T3, T2, V0); | 963 __ addu(T3, T2, V0); |
962 | 964 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 // kInlineInstanceSize is a constant used as a threshold for determining | 1136 // kInlineInstanceSize is a constant used as a threshold for determining |
1135 // when the object initialization should be done as a loop or as | 1137 // when the object initialization should be done as a loop or as |
1136 // straight line code. | 1138 // straight line code. |
1137 const int kInlineInstanceSize = 12; | 1139 const int kInlineInstanceSize = 12; |
1138 const intptr_t instance_size = cls.instance_size(); | 1140 const intptr_t instance_size = cls.instance_size(); |
1139 ASSERT(instance_size > 0); | 1141 ASSERT(instance_size > 0); |
1140 if (is_cls_parameterized) { | 1142 if (is_cls_parameterized) { |
1141 __ lw(T1, Address(SP, 0 * kWordSize)); | 1143 __ lw(T1, Address(SP, 0 * kWordSize)); |
1142 // T1: type arguments. | 1144 // T1: type arguments. |
1143 } | 1145 } |
| 1146 Isolate* isolate = Isolate::Current(); |
1144 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) && | 1147 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) && |
1145 !cls.trace_allocation()) { | 1148 !cls.TraceAllocation(isolate)) { |
1146 Label slow_case; | 1149 Label slow_case; |
1147 // Allocate the object and update top to point to | 1150 // Allocate the object and update top to point to |
1148 // next object start and initialize the allocated object. | 1151 // next object start and initialize the allocated object. |
1149 // T1: instantiated type arguments (if is_cls_parameterized). | 1152 // T1: instantiated type arguments (if is_cls_parameterized). |
1150 Heap::Space space = Heap::SpaceForAllocation(cls.id()); | 1153 Heap::Space space = Heap::SpaceForAllocation(cls.id()); |
1151 __ lw(T5, Address(THR, Thread::heap_offset())); | 1154 __ lw(T5, Address(THR, Thread::heap_offset())); |
1152 __ lw(T2, Address(T5, Heap::TopOffset(space))); | 1155 __ lw(T2, Address(T5, Heap::TopOffset(space))); |
1153 __ LoadImmediate(T4, instance_size); | 1156 __ LoadImmediate(T4, instance_size); |
1154 __ addu(T3, T2, T4); | 1157 __ addu(T3, T2, T4); |
1155 // Check if the allocation fits into the remaining space. | 1158 // Check if the allocation fits into the remaining space. |
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2268 // Result: | 2271 // Result: |
2269 // T1: entry point. | 2272 // T1: entry point. |
2270 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { | 2273 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { |
2271 EmitMegamorphicLookup(assembler, T0, T1, T1); | 2274 EmitMegamorphicLookup(assembler, T0, T1, T1); |
2272 __ Ret(); | 2275 __ Ret(); |
2273 } | 2276 } |
2274 | 2277 |
2275 } // namespace dart | 2278 } // namespace dart |
2276 | 2279 |
2277 #endif // defined TARGET_ARCH_MIPS | 2280 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |