Chromium Code Reviews| 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 3163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3174 ASSERT(cls.id() != kIllegalCid); | 3174 ASSERT(cls.id() != kIllegalCid); |
| 3175 tags = RawObject::ClassIdTag::update(cls.id(), tags); | 3175 tags = RawObject::ClassIdTag::update(cls.id(), tags); |
| 3176 LoadImmediate(IP, tags); | 3176 LoadImmediate(IP, tags); |
| 3177 str(IP, FieldAddress(instance_reg, Object::tags_offset())); | 3177 str(IP, FieldAddress(instance_reg, Object::tags_offset())); |
| 3178 } else { | 3178 } else { |
| 3179 b(failure); | 3179 b(failure); |
| 3180 } | 3180 } |
| 3181 } | 3181 } |
| 3182 | 3182 |
| 3183 | 3183 |
| 3184 void Assembler::TryAllocateArray(intptr_t cid, | |
| 3185 intptr_t instance_size, | |
| 3186 Label* failure, | |
| 3187 Register instance, | |
| 3188 Register end_address, | |
| 3189 Register temp1, | |
| 3190 Register temp2) { | |
|
srdjan
2014/08/11 21:42:34
Guard with FLAG_inline_alloc
Florian Schneider
2014/08/13 14:56:11
Done.
| |
| 3191 Isolate* isolate = Isolate::Current(); | |
| 3192 Heap* heap = isolate->heap(); | |
| 3193 LoadImmediate(temp1, heap->TopAddress()); | |
| 3194 ldr(instance, Address(temp1, 0)); // Potential new object start. | |
| 3195 AddImmediate(end_address, instance, instance_size); | |
| 3196 b(failure, VS); | |
| 3197 | |
| 3198 // Check if the allocation fits into the remaining space. | |
| 3199 // instance: potential new object start. | |
| 3200 // end_address: potential next object start. | |
| 3201 LoadImmediate(temp2, heap->EndAddress()); | |
| 3202 ldr(temp2, Address(temp2, 0)); | |
| 3203 cmp(end_address, Operand(temp2)); | |
| 3204 b(failure, CS); | |
| 3205 | |
| 3206 // Successfully allocated the object(s), now update top to point to | |
| 3207 // next object start and initialize the object. | |
| 3208 str(end_address, Address(temp1, 0)); | |
| 3209 add(instance, instance, Operand(kHeapObjectTag)); | |
| 3210 LoadImmediate(temp2, instance_size); | |
| 3211 UpdateAllocationStatsWithSize(cid, temp2, temp1); | |
| 3212 | |
| 3213 // Initialize the tags. | |
| 3214 // instance: new object start as a tagged pointer. | |
| 3215 uword tags = 0; | |
| 3216 tags = RawObject::ClassIdTag::update(cid, tags); | |
| 3217 tags = RawObject::SizeTag::update(instance_size, tags); | |
| 3218 LoadImmediate(temp2, tags); | |
| 3219 str(temp2, FieldAddress(instance, Array::tags_offset())); // Store tags. | |
| 3220 } | |
| 3221 | |
| 3222 | |
| 3184 void Assembler::Stop(const char* message) { | 3223 void Assembler::Stop(const char* message) { |
| 3185 if (FLAG_print_stop_message) { | 3224 if (FLAG_print_stop_message) { |
| 3186 StubCode* stub_code = Isolate::Current()->stub_code(); | 3225 StubCode* stub_code = Isolate::Current()->stub_code(); |
| 3187 PushList((1 << R0) | (1 << IP) | (1 << LR)); // Preserve R0, IP, LR. | 3226 PushList((1 << R0) | (1 << IP) | (1 << LR)); // Preserve R0, IP, LR. |
| 3188 LoadImmediate(R0, reinterpret_cast<int32_t>(message)); | 3227 LoadImmediate(R0, reinterpret_cast<int32_t>(message)); |
| 3189 // PrintStopMessage() preserves all registers. | 3228 // PrintStopMessage() preserves all registers. |
| 3190 BranchLink(&stub_code->PrintStopMessageLabel()); // Passing message in R0. | 3229 BranchLink(&stub_code->PrintStopMessageLabel()); // Passing message in R0. |
| 3191 PopList((1 << R0) | (1 << IP) | (1 << LR)); // Restore R0, IP, LR. | 3230 PopList((1 << R0) | (1 << IP) | (1 << LR)); // Restore R0, IP, LR. |
| 3192 } | 3231 } |
| 3193 // Emit the message address before the svc instruction, so that we can | 3232 // Emit the message address before the svc instruction, so that we can |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3324 | 3363 |
| 3325 | 3364 |
| 3326 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3365 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
| 3327 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); | 3366 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); |
| 3328 return fpu_reg_names[reg]; | 3367 return fpu_reg_names[reg]; |
| 3329 } | 3368 } |
| 3330 | 3369 |
| 3331 } // namespace dart | 3370 } // namespace dart |
| 3332 | 3371 |
| 3333 #endif // defined TARGET_ARCH_ARM | 3372 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |