| 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/cpu.h" | 9 #include "vm/cpu.h" |
| 10 #include "vm/longjump.h" | 10 #include "vm/longjump.h" |
| (...skipping 3128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3139 } | 3139 } |
| 3140 } | 3140 } |
| 3141 | 3141 |
| 3142 | 3142 |
| 3143 void Assembler::TryAllocate(const Class& cls, | 3143 void Assembler::TryAllocate(const Class& cls, |
| 3144 Label* failure, | 3144 Label* failure, |
| 3145 Register instance_reg, | 3145 Register instance_reg, |
| 3146 Register temp_reg) { | 3146 Register temp_reg) { |
| 3147 ASSERT(failure != NULL); | 3147 ASSERT(failure != NULL); |
| 3148 if (FLAG_inline_alloc) { | 3148 if (FLAG_inline_alloc) { |
| 3149 Heap* heap = Isolate::Current()->heap(); | 3149 ASSERT(instance_reg != temp_reg); |
| 3150 ASSERT(temp_reg != IP); |
| 3150 const intptr_t instance_size = cls.instance_size(); | 3151 const intptr_t instance_size = cls.instance_size(); |
| 3151 LoadImmediate(instance_reg, heap->TopAddress()); | 3152 |
| 3152 ldr(instance_reg, Address(instance_reg, 0)); | 3153 LoadImmediate(temp_reg, Isolate::Current()->heap()->NewSpaceAddress()); |
| 3154 |
| 3155 ldr(instance_reg, Address(temp_reg, Scavenger::top_offset())); |
| 3153 AddImmediate(instance_reg, instance_size); | 3156 AddImmediate(instance_reg, instance_size); |
| 3154 | 3157 |
| 3155 // instance_reg: potential next object start. | 3158 // instance_reg: potential next object start. |
| 3156 LoadImmediate(IP, heap->EndAddress()); | 3159 ldr(IP, Address(temp_reg, Scavenger::end_offset())); |
| 3157 ldr(IP, Address(IP, 0)); | |
| 3158 cmp(IP, Operand(instance_reg)); | 3160 cmp(IP, Operand(instance_reg)); |
| 3159 // fail if heap end unsigned less than or equal to instance_reg. | 3161 // fail if heap end unsigned less than or equal to instance_reg. |
| 3160 b(failure, LS); | 3162 b(failure, LS); |
| 3161 | 3163 |
| 3162 // Successfully allocated the object, now update top to point to | 3164 // Successfully allocated the object, now update top to point to |
| 3163 // next object start and store the class in the class field of object. | 3165 // next object start and store the class in the class field of object. |
| 3164 LoadImmediate(IP, heap->TopAddress()); | 3166 str(instance_reg, Address(temp_reg, Scavenger::top_offset())); |
| 3165 str(instance_reg, Address(IP, 0)); | |
| 3166 | 3167 |
| 3167 ASSERT(instance_size >= kHeapObjectTag); | 3168 ASSERT(instance_size >= kHeapObjectTag); |
| 3168 AddImmediate(instance_reg, -instance_size + kHeapObjectTag); | 3169 AddImmediate(instance_reg, -instance_size + kHeapObjectTag); |
| 3169 UpdateAllocationStats(cls.id(), temp_reg); | 3170 UpdateAllocationStats(cls.id(), temp_reg); |
| 3170 | 3171 |
| 3171 uword tags = 0; | 3172 uword tags = 0; |
| 3172 tags = RawObject::SizeTag::update(instance_size, tags); | 3173 tags = RawObject::SizeTag::update(instance_size, tags); |
| 3173 ASSERT(cls.id() != kIllegalCid); | 3174 ASSERT(cls.id() != kIllegalCid); |
| 3174 tags = RawObject::ClassIdTag::update(cls.id(), tags); | 3175 tags = RawObject::ClassIdTag::update(cls.id(), tags); |
| 3175 LoadImmediate(IP, tags); | 3176 LoadImmediate(IP, tags); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3323 | 3324 |
| 3324 | 3325 |
| 3325 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3326 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
| 3326 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); | 3327 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); |
| 3327 return fpu_reg_names[reg]; | 3328 return fpu_reg_names[reg]; |
| 3328 } | 3329 } |
| 3329 | 3330 |
| 3330 } // namespace dart | 3331 } // namespace dart |
| 3331 | 3332 |
| 3332 #endif // defined TARGET_ARCH_ARM | 3333 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |