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 3369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3380 if (FLAG_inline_alloc) { | 3380 if (FLAG_inline_alloc) { |
3381 ASSERT(instance_reg != temp_reg); | 3381 ASSERT(instance_reg != temp_reg); |
3382 ASSERT(temp_reg != IP); | 3382 ASSERT(temp_reg != IP); |
3383 const intptr_t instance_size = cls.instance_size(); | 3383 const intptr_t instance_size = cls.instance_size(); |
3384 ASSERT(instance_size != 0); | 3384 ASSERT(instance_size != 0); |
3385 Heap* heap = Isolate::Current()->heap(); | 3385 Heap* heap = Isolate::Current()->heap(); |
3386 Heap::Space space = heap->SpaceForAllocation(cls.id()); | 3386 Heap::Space space = heap->SpaceForAllocation(cls.id()); |
3387 const uword top_address = heap->TopAddress(space); | 3387 const uword top_address = heap->TopAddress(space); |
3388 LoadImmediate(temp_reg, top_address); | 3388 LoadImmediate(temp_reg, top_address); |
3389 ldr(instance_reg, Address(temp_reg)); | 3389 ldr(instance_reg, Address(temp_reg)); |
3390 AddImmediate(instance_reg, instance_size); | 3390 // TODO(koda): Protect against unsigned overflow here. |
| 3391 AddImmediateSetFlags(instance_reg, instance_reg, instance_size); |
3391 | 3392 |
3392 // instance_reg: potential next object start. | 3393 // instance_reg: potential next object start. |
3393 const uword end_address = heap->EndAddress(space); | 3394 const uword end_address = heap->EndAddress(space); |
3394 ASSERT(top_address < end_address); | 3395 ASSERT(top_address < end_address); |
3395 // Could use ldm to load (top, end), but no benefit seen experimentally. | 3396 // Could use ldm to load (top, end), but no benefit seen experimentally. |
3396 ldr(IP, Address(temp_reg, end_address - top_address)); | 3397 ldr(IP, Address(temp_reg, end_address - top_address)); |
3397 cmp(IP, Operand(instance_reg)); | 3398 cmp(IP, Operand(instance_reg)); |
3398 // fail if heap end unsigned less than or equal to instance_reg. | 3399 // fail if heap end unsigned less than or equal to instance_reg. |
3399 b(failure, LS); | 3400 b(failure, LS); |
3400 | 3401 |
(...skipping 26 matching lines...) Expand all Loading... |
3427 Register instance, | 3428 Register instance, |
3428 Register end_address, | 3429 Register end_address, |
3429 Register temp1, | 3430 Register temp1, |
3430 Register temp2) { | 3431 Register temp2) { |
3431 if (FLAG_inline_alloc) { | 3432 if (FLAG_inline_alloc) { |
3432 Isolate* isolate = Isolate::Current(); | 3433 Isolate* isolate = Isolate::Current(); |
3433 Heap* heap = isolate->heap(); | 3434 Heap* heap = isolate->heap(); |
3434 Heap::Space space = heap->SpaceForAllocation(cid); | 3435 Heap::Space space = heap->SpaceForAllocation(cid); |
3435 LoadImmediate(temp1, heap->TopAddress(space)); | 3436 LoadImmediate(temp1, heap->TopAddress(space)); |
3436 ldr(instance, Address(temp1, 0)); // Potential new object start. | 3437 ldr(instance, Address(temp1, 0)); // Potential new object start. |
3437 AddImmediate(end_address, instance, instance_size); | 3438 AddImmediateSetFlags(end_address, instance, instance_size); |
3438 b(failure, VS); | 3439 b(failure, CS); // Branch if unsigned overflow. |
3439 | 3440 |
3440 // Check if the allocation fits into the remaining space. | 3441 // Check if the allocation fits into the remaining space. |
3441 // instance: potential new object start. | 3442 // instance: potential new object start. |
3442 // end_address: potential next object start. | 3443 // end_address: potential next object start. |
3443 LoadImmediate(temp2, heap->EndAddress(space)); | 3444 LoadImmediate(temp2, heap->EndAddress(space)); |
3444 ldr(temp2, Address(temp2, 0)); | 3445 ldr(temp2, Address(temp2, 0)); |
3445 cmp(end_address, Operand(temp2)); | 3446 cmp(end_address, Operand(temp2)); |
3446 b(failure, CS); | 3447 b(failure, CS); |
3447 | 3448 |
3448 LoadAllocationStatsAddress(temp2, cid, space); | 3449 LoadAllocationStatsAddress(temp2, cid, space); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3576 | 3577 |
3577 | 3578 |
3578 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3579 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
3579 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); | 3580 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); |
3580 return fpu_reg_names[reg]; | 3581 return fpu_reg_names[reg]; |
3581 } | 3582 } |
3582 | 3583 |
3583 } // namespace dart | 3584 } // namespace dart |
3584 | 3585 |
3585 #endif // defined TARGET_ARCH_ARM | 3586 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |