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 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 if (is_cls_parameterized) { | 1151 if (is_cls_parameterized) { |
1152 __ lw(T1, Address(SP, 0 * kWordSize)); | 1152 __ lw(T1, Address(SP, 0 * kWordSize)); |
1153 // T1: type arguments. | 1153 // T1: type arguments. |
1154 } | 1154 } |
1155 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) && | 1155 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) && |
1156 !cls.trace_allocation()) { | 1156 !cls.trace_allocation()) { |
1157 Label slow_case; | 1157 Label slow_case; |
1158 // Allocate the object and update top to point to | 1158 // Allocate the object and update top to point to |
1159 // next object start and initialize the allocated object. | 1159 // next object start and initialize the allocated object. |
1160 // T1: instantiated type arguments (if is_cls_parameterized). | 1160 // T1: instantiated type arguments (if is_cls_parameterized). |
1161 Heap* heap = Isolate::Current()->heap(); | |
1162 Heap::Space space = Heap::SpaceForAllocation(cls.id()); | 1161 Heap::Space space = Heap::SpaceForAllocation(cls.id()); |
1163 __ LoadImmediate(T5, heap->TopAddress(space)); | 1162 __ lw(T5, Address(THR, Thread::heap_offset())); |
1164 __ lw(T2, Address(T5)); | 1163 __ lw(T2, Address(T5, Heap::TopOffset(space))); |
1165 __ LoadImmediate(T4, instance_size); | 1164 __ LoadImmediate(T4, instance_size); |
1166 __ addu(T3, T2, T4); | 1165 __ addu(T3, T2, T4); |
1167 // Check if the allocation fits into the remaining space. | 1166 // Check if the allocation fits into the remaining space. |
1168 // T2: potential new object start. | 1167 // T2: potential new object start. |
1169 // T3: potential next object start. | 1168 // T3: potential next object start. |
1170 __ LoadImmediate(TMP, heap->EndAddress(space)); | 1169 // T5: heap. |
1171 __ lw(CMPRES1, Address(TMP)); | 1170 __ lw(CMPRES1, Address(T5, Heap::EndOffset(space))); |
1172 if (FLAG_use_slow_path) { | 1171 if (FLAG_use_slow_path) { |
1173 __ b(&slow_case); | 1172 __ b(&slow_case); |
1174 } else { | 1173 } else { |
1175 __ BranchUnsignedGreaterEqual(T3, CMPRES1, &slow_case); | 1174 __ BranchUnsignedGreaterEqual(T3, CMPRES1, &slow_case); |
1176 } | 1175 } |
1177 // Successfully allocated the object(s), now update top to point to | 1176 // Successfully allocated the object(s), now update top to point to |
1178 // next object start and initialize the object. | 1177 // next object start and initialize the object. |
1179 __ sw(T3, Address(T5)); | 1178 __ sw(T3, Address(T5, Heap::TopOffset(space))); |
1180 __ UpdateAllocationStats(cls.id(), T5, space); | 1179 __ UpdateAllocationStats(cls.id(), T5, space, /* inline_isolate = */ false); |
1181 | 1180 |
1182 // T2: new object start. | 1181 // T2: new object start. |
1183 // T3: next object start. | 1182 // T3: next object start. |
1184 // T1: new object type arguments (if is_cls_parameterized). | 1183 // T1: new object type arguments (if is_cls_parameterized). |
1185 // Set the tags. | 1184 // Set the tags. |
1186 uword tags = 0; | 1185 uword tags = 0; |
1187 tags = RawObject::SizeTag::update(instance_size, tags); | 1186 tags = RawObject::SizeTag::update(instance_size, tags); |
1188 ASSERT(cls.id() != kIllegalCid); | 1187 ASSERT(cls.id() != kIllegalCid); |
1189 tags = RawObject::ClassIdTag::update(cls.id(), tags); | 1188 tags = RawObject::ClassIdTag::update(cls.id(), tags); |
1190 __ LoadImmediate(T0, tags); | 1189 __ LoadImmediate(T0, tags); |
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2286 // Result: | 2285 // Result: |
2287 // T1: entry point. | 2286 // T1: entry point. |
2288 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { | 2287 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { |
2289 EmitMegamorphicLookup(assembler, T0, T1, T1); | 2288 EmitMegamorphicLookup(assembler, T0, T1, T1); |
2290 __ Ret(); | 2289 __ Ret(); |
2291 } | 2290 } |
2292 | 2291 |
2293 } // namespace dart | 2292 } // namespace dart |
2294 | 2293 |
2295 #endif // defined TARGET_ARCH_MIPS | 2294 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |