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" // NOLINT | 5 #include "vm/globals.h" // NOLINT |
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/cpu.h" | 9 #include "vm/cpu.h" |
10 #include "vm/longjump.h" | 10 #include "vm/longjump.h" |
(...skipping 3150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3161 ASSERT(failure != NULL); | 3161 ASSERT(failure != NULL); |
3162 if (FLAG_inline_alloc) { | 3162 if (FLAG_inline_alloc) { |
3163 ASSERT(instance_reg != temp_reg); | 3163 ASSERT(instance_reg != temp_reg); |
3164 ASSERT(temp_reg != IP); | 3164 ASSERT(temp_reg != IP); |
3165 const intptr_t instance_size = cls.instance_size(); | 3165 const intptr_t instance_size = cls.instance_size(); |
3166 ASSERT(instance_size != 0); | 3166 ASSERT(instance_size != 0); |
3167 // If this allocation is traced, program will jump to failure path | 3167 // If this allocation is traced, program will jump to failure path |
3168 // (i.e. the allocation stub) which will allocate the object and trace the | 3168 // (i.e. the allocation stub) which will allocate the object and trace the |
3169 // allocation call site. | 3169 // allocation call site. |
3170 NOT_IN_PRODUCT(MaybeTraceAllocation(cls.id(), temp_reg, failure)); | 3170 NOT_IN_PRODUCT(MaybeTraceAllocation(cls.id(), temp_reg, failure)); |
3171 Heap::Space space = Heap::kNew; | 3171 NOT_IN_PRODUCT(Heap::Space space = Heap::kNew); |
3172 ldr(temp_reg, Address(THR, Thread::heap_offset())); | 3172 ldr(instance_reg, Address(THR, Thread::top_offset())); |
3173 ldr(instance_reg, Address(temp_reg, Heap::TopOffset(space))); | |
3174 // TODO(koda): Protect against unsigned overflow here. | 3173 // TODO(koda): Protect against unsigned overflow here. |
3175 AddImmediateSetFlags(instance_reg, instance_reg, instance_size); | 3174 AddImmediateSetFlags(instance_reg, instance_reg, instance_size); |
3176 | 3175 |
3177 // instance_reg: potential next object start. | 3176 // instance_reg: potential next object start. |
3178 ldr(IP, Address(temp_reg, Heap::EndOffset(space))); | 3177 ldr(IP, Address(THR, Thread::end_offset())); |
3179 cmp(IP, Operand(instance_reg)); | 3178 cmp(IP, Operand(instance_reg)); |
3180 // fail if heap end unsigned less than or equal to instance_reg. | 3179 // fail if heap end unsigned less than or equal to instance_reg. |
3181 b(failure, LS); | 3180 b(failure, LS); |
3182 | 3181 |
3183 // Successfully allocated the object, now update top to point to | 3182 // Successfully allocated the object, now update top to point to |
3184 // next object start and store the class in the class field of object. | 3183 // next object start and store the class in the class field of object. |
3185 str(instance_reg, Address(temp_reg, Heap::TopOffset(space))); | 3184 str(instance_reg, Address(THR, Thread::top_offset())); |
3186 | |
3187 NOT_IN_PRODUCT(LoadAllocationStatsAddress(temp_reg, cls.id())); | 3185 NOT_IN_PRODUCT(LoadAllocationStatsAddress(temp_reg, cls.id())); |
3188 | 3186 |
3189 ASSERT(instance_size >= kHeapObjectTag); | 3187 ASSERT(instance_size >= kHeapObjectTag); |
3190 AddImmediate(instance_reg, -instance_size + kHeapObjectTag); | 3188 AddImmediate(instance_reg, -instance_size + kHeapObjectTag); |
3191 | 3189 |
3192 uint32_t tags = 0; | 3190 uint32_t tags = 0; |
3193 tags = RawObject::SizeTag::update(instance_size, tags); | 3191 tags = RawObject::SizeTag::update(instance_size, tags); |
3194 ASSERT(cls.id() != kIllegalCid); | 3192 ASSERT(cls.id() != kIllegalCid); |
3195 tags = RawObject::ClassIdTag::update(cls.id(), tags); | 3193 tags = RawObject::ClassIdTag::update(cls.id(), tags); |
3196 LoadImmediate(IP, tags); | 3194 LoadImmediate(IP, tags); |
(...skipping 10 matching lines...) Expand all Loading... |
3207 Label* failure, | 3205 Label* failure, |
3208 Register instance, | 3206 Register instance, |
3209 Register end_address, | 3207 Register end_address, |
3210 Register temp1, | 3208 Register temp1, |
3211 Register temp2) { | 3209 Register temp2) { |
3212 if (FLAG_inline_alloc) { | 3210 if (FLAG_inline_alloc) { |
3213 // If this allocation is traced, program will jump to failure path | 3211 // If this allocation is traced, program will jump to failure path |
3214 // (i.e. the allocation stub) which will allocate the object and trace the | 3212 // (i.e. the allocation stub) which will allocate the object and trace the |
3215 // allocation call site. | 3213 // allocation call site. |
3216 NOT_IN_PRODUCT(MaybeTraceAllocation(cid, temp1, failure)); | 3214 NOT_IN_PRODUCT(MaybeTraceAllocation(cid, temp1, failure)); |
3217 Heap::Space space = Heap::kNew; | 3215 NOT_IN_PRODUCT(Heap::Space space = Heap::kNew); |
3218 ldr(temp1, Address(THR, Thread::heap_offset())); | |
3219 // Potential new object start. | 3216 // Potential new object start. |
3220 ldr(instance, Address(temp1, Heap::TopOffset(space))); | 3217 ldr(instance, Address(THR, Thread::top_offset())); |
3221 AddImmediateSetFlags(end_address, instance, instance_size); | 3218 AddImmediateSetFlags(end_address, instance, instance_size); |
3222 b(failure, CS); // Branch if unsigned overflow. | 3219 b(failure, CS); // Branch if unsigned overflow. |
3223 | 3220 |
3224 // Check if the allocation fits into the remaining space. | 3221 // Check if the allocation fits into the remaining space. |
3225 // instance: potential new object start. | 3222 // instance: potential new object start. |
3226 // end_address: potential next object start. | 3223 // end_address: potential next object start. |
3227 ldr(temp2, Address(temp1, Heap::EndOffset(space))); | 3224 ldr(temp2, Address(THR, Thread::end_offset())); |
3228 cmp(end_address, Operand(temp2)); | 3225 cmp(end_address, Operand(temp2)); |
3229 b(failure, CS); | 3226 b(failure, CS); |
3230 | 3227 |
3231 NOT_IN_PRODUCT(LoadAllocationStatsAddress(temp2, cid)); | 3228 NOT_IN_PRODUCT(LoadAllocationStatsAddress(temp2, cid)); |
3232 | 3229 |
3233 // Successfully allocated the object(s), now update top to point to | 3230 // Successfully allocated the object(s), now update top to point to |
3234 // next object start and initialize the object. | 3231 // next object start and initialize the object. |
3235 str(end_address, Address(temp1, Heap::TopOffset(space))); | 3232 str(end_address, Address(THR, Thread::top_offset())); |
3236 add(instance, instance, Operand(kHeapObjectTag)); | 3233 add(instance, instance, Operand(kHeapObjectTag)); |
3237 | 3234 |
3238 // Initialize the tags. | 3235 // Initialize the tags. |
3239 // instance: new object start as a tagged pointer. | 3236 // instance: new object start as a tagged pointer. |
3240 uint32_t tags = 0; | 3237 uint32_t tags = 0; |
3241 tags = RawObject::ClassIdTag::update(cid, tags); | 3238 tags = RawObject::ClassIdTag::update(cid, tags); |
3242 tags = RawObject::SizeTag::update(instance_size, tags); | 3239 tags = RawObject::SizeTag::update(instance_size, tags); |
3243 LoadImmediate(temp1, tags); | 3240 LoadImmediate(temp1, tags); |
3244 str(temp1, FieldAddress(instance, Array::tags_offset())); // Store tags. | 3241 str(temp1, FieldAddress(instance, Array::tags_offset())); // Store tags. |
3245 | 3242 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3431 }; | 3428 }; |
3432 | 3429 |
3433 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3430 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
3434 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); | 3431 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); |
3435 return fpu_reg_names[reg]; | 3432 return fpu_reg_names[reg]; |
3436 } | 3433 } |
3437 | 3434 |
3438 } // namespace dart | 3435 } // namespace dart |
3439 | 3436 |
3440 #endif // defined TARGET_ARCH_ARM | 3437 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |