| 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 3433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3444 if (FLAG_inline_alloc) { | 3444 if (FLAG_inline_alloc) { |
| 3445 ASSERT(instance_reg != temp_reg); | 3445 ASSERT(instance_reg != temp_reg); |
| 3446 ASSERT(temp_reg != IP); | 3446 ASSERT(temp_reg != IP); |
| 3447 const intptr_t instance_size = cls.instance_size(); | 3447 const intptr_t instance_size = cls.instance_size(); |
| 3448 ASSERT(instance_size != 0); | 3448 ASSERT(instance_size != 0); |
| 3449 // If this allocation is traced, program will jump to failure path | 3449 // If this allocation is traced, program will jump to failure path |
| 3450 // (i.e. the allocation stub) which will allocate the object and trace the | 3450 // (i.e. the allocation stub) which will allocate the object and trace the |
| 3451 // allocation call site. | 3451 // allocation call site. |
| 3452 NOT_IN_PRODUCT(MaybeTraceAllocation(cls.id(), temp_reg, failure)); | 3452 NOT_IN_PRODUCT(MaybeTraceAllocation(cls.id(), temp_reg, failure)); |
| 3453 Heap::Space space = Heap::kNew; | 3453 Heap::Space space = Heap::kNew; |
| 3454 ldr(temp_reg, Address(THR, Thread::heap_offset())); | 3454 ldr(instance_reg, Address(THR, Thread::top_offset())); |
| 3455 ldr(instance_reg, Address(temp_reg, Heap::TopOffset(space))); | |
| 3456 // TODO(koda): Protect against unsigned overflow here. | 3455 // TODO(koda): Protect against unsigned overflow here. |
| 3457 AddImmediateSetFlags(instance_reg, instance_reg, instance_size); | 3456 AddImmediateSetFlags(instance_reg, instance_reg, instance_size); |
| 3458 | 3457 |
| 3459 // instance_reg: potential next object start. | 3458 // instance_reg: potential next object start. |
| 3460 ldr(IP, Address(temp_reg, Heap::EndOffset(space))); | 3459 ldr(IP, Address(THR, Thread::end_offset())); |
| 3461 cmp(IP, Operand(instance_reg)); | 3460 cmp(IP, Operand(instance_reg)); |
| 3462 // fail if heap end unsigned less than or equal to instance_reg. | 3461 // fail if heap end unsigned less than or equal to instance_reg. |
| 3463 b(failure, LS); | 3462 b(failure, LS); |
| 3464 | 3463 |
| 3465 // Successfully allocated the object, now update top to point to | 3464 // Successfully allocated the object, now update top to point to |
| 3466 // next object start and store the class in the class field of object. | 3465 // next object start and store the class in the class field of object. |
| 3467 str(instance_reg, Address(temp_reg, Heap::TopOffset(space))); | 3466 str(instance_reg, Address(THR, Thread::top_offset())); |
| 3468 | |
| 3469 NOT_IN_PRODUCT(LoadAllocationStatsAddress(temp_reg, cls.id())); | 3467 NOT_IN_PRODUCT(LoadAllocationStatsAddress(temp_reg, cls.id())); |
| 3470 | 3468 |
| 3471 ASSERT(instance_size >= kHeapObjectTag); | 3469 ASSERT(instance_size >= kHeapObjectTag); |
| 3472 AddImmediate(instance_reg, -instance_size + kHeapObjectTag); | 3470 AddImmediate(instance_reg, -instance_size + kHeapObjectTag); |
| 3473 | 3471 |
| 3474 uint32_t tags = 0; | 3472 uint32_t tags = 0; |
| 3475 tags = RawObject::SizeTag::update(instance_size, tags); | 3473 tags = RawObject::SizeTag::update(instance_size, tags); |
| 3476 ASSERT(cls.id() != kIllegalCid); | 3474 ASSERT(cls.id() != kIllegalCid); |
| 3477 tags = RawObject::ClassIdTag::update(cls.id(), tags); | 3475 tags = RawObject::ClassIdTag::update(cls.id(), tags); |
| 3478 LoadImmediate(IP, tags); | 3476 LoadImmediate(IP, tags); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 3491 Register instance, | 3489 Register instance, |
| 3492 Register end_address, | 3490 Register end_address, |
| 3493 Register temp1, | 3491 Register temp1, |
| 3494 Register temp2) { | 3492 Register temp2) { |
| 3495 if (FLAG_inline_alloc) { | 3493 if (FLAG_inline_alloc) { |
| 3496 // If this allocation is traced, program will jump to failure path | 3494 // If this allocation is traced, program will jump to failure path |
| 3497 // (i.e. the allocation stub) which will allocate the object and trace the | 3495 // (i.e. the allocation stub) which will allocate the object and trace the |
| 3498 // allocation call site. | 3496 // allocation call site. |
| 3499 NOT_IN_PRODUCT(MaybeTraceAllocation(cid, temp1, failure)); | 3497 NOT_IN_PRODUCT(MaybeTraceAllocation(cid, temp1, failure)); |
| 3500 Heap::Space space = Heap::kNew; | 3498 Heap::Space space = Heap::kNew; |
| 3501 ldr(temp1, Address(THR, Thread::heap_offset())); | |
| 3502 // Potential new object start. | 3499 // Potential new object start. |
| 3503 ldr(instance, Address(temp1, Heap::TopOffset(space))); | 3500 ldr(instance, Address(THR, Thread::top_offset())); |
| 3504 AddImmediateSetFlags(end_address, instance, instance_size); | 3501 AddImmediateSetFlags(end_address, instance, instance_size); |
| 3505 b(failure, CS); // Branch if unsigned overflow. | 3502 b(failure, CS); // Branch if unsigned overflow. |
| 3506 | 3503 |
| 3507 // Check if the allocation fits into the remaining space. | 3504 // Check if the allocation fits into the remaining space. |
| 3508 // instance: potential new object start. | 3505 // instance: potential new object start. |
| 3509 // end_address: potential next object start. | 3506 // end_address: potential next object start. |
| 3510 ldr(temp2, Address(temp1, Heap::EndOffset(space))); | 3507 ldr(temp2, Address(THR, Thread::end_offset())); |
| 3511 cmp(end_address, Operand(temp2)); | 3508 cmp(end_address, Operand(temp2)); |
| 3512 b(failure, CS); | 3509 b(failure, CS); |
| 3513 | 3510 |
| 3514 NOT_IN_PRODUCT(LoadAllocationStatsAddress(temp2, cid)); | 3511 NOT_IN_PRODUCT(LoadAllocationStatsAddress(temp2, cid)); |
| 3515 | 3512 |
| 3516 // Successfully allocated the object(s), now update top to point to | 3513 // Successfully allocated the object(s), now update top to point to |
| 3517 // next object start and initialize the object. | 3514 // next object start and initialize the object. |
| 3518 str(end_address, Address(temp1, Heap::TopOffset(space))); | 3515 str(end_address, Address(THR, Thread::top_offset())); |
| 3519 add(instance, instance, Operand(kHeapObjectTag)); | 3516 add(instance, instance, Operand(kHeapObjectTag)); |
| 3520 | 3517 |
| 3521 // Initialize the tags. | 3518 // Initialize the tags. |
| 3522 // instance: new object start as a tagged pointer. | 3519 // instance: new object start as a tagged pointer. |
| 3523 uint32_t tags = 0; | 3520 uint32_t tags = 0; |
| 3524 tags = RawObject::ClassIdTag::update(cid, tags); | 3521 tags = RawObject::ClassIdTag::update(cid, tags); |
| 3525 tags = RawObject::SizeTag::update(instance_size, tags); | 3522 tags = RawObject::SizeTag::update(instance_size, tags); |
| 3526 LoadImmediate(temp1, tags); | 3523 LoadImmediate(temp1, tags); |
| 3527 str(temp1, FieldAddress(instance, Array::tags_offset())); // Store tags. | 3524 str(temp1, FieldAddress(instance, Array::tags_offset())); // Store tags. |
| 3528 | 3525 |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3728 | 3725 |
| 3729 | 3726 |
| 3730 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3727 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
| 3731 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); | 3728 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); |
| 3732 return fpu_reg_names[reg]; | 3729 return fpu_reg_names[reg]; |
| 3733 } | 3730 } |
| 3734 | 3731 |
| 3735 } // namespace dart | 3732 } // namespace dart |
| 3736 | 3733 |
| 3737 #endif // defined TARGET_ARCH_ARM | 3734 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |