| 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_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 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/heap.h" | 10 #include "vm/heap.h" |
| (...skipping 3505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3516 bool near_jump, | 3516 bool near_jump, |
| 3517 Register instance_reg, | 3517 Register instance_reg, |
| 3518 Register temp) { | 3518 Register temp) { |
| 3519 ASSERT(failure != NULL); | 3519 ASSERT(failure != NULL); |
| 3520 if (FLAG_inline_alloc) { | 3520 if (FLAG_inline_alloc) { |
| 3521 // If this allocation is traced, program will jump to failure path | 3521 // If this allocation is traced, program will jump to failure path |
| 3522 // (i.e. the allocation stub) which will allocate the object and trace the | 3522 // (i.e. the allocation stub) which will allocate the object and trace the |
| 3523 // allocation call site. | 3523 // allocation call site. |
| 3524 MaybeTraceAllocation(cls.id(), failure, near_jump); | 3524 MaybeTraceAllocation(cls.id(), failure, near_jump); |
| 3525 const intptr_t instance_size = cls.instance_size(); | 3525 const intptr_t instance_size = cls.instance_size(); |
| 3526 Heap::Space space = Heap::SpaceForAllocation(cls.id()); | 3526 Heap::Space space = Heap::kNew; |
| 3527 movq(temp, Address(THR, Thread::heap_offset())); | 3527 movq(temp, Address(THR, Thread::heap_offset())); |
| 3528 movq(instance_reg, Address(temp, Heap::TopOffset(space))); | 3528 movq(instance_reg, Address(temp, Heap::TopOffset(space))); |
| 3529 addq(instance_reg, Immediate(instance_size)); | 3529 addq(instance_reg, Immediate(instance_size)); |
| 3530 // instance_reg: potential next object start. | 3530 // instance_reg: potential next object start. |
| 3531 cmpq(instance_reg, Address(temp, Heap::EndOffset(space))); | 3531 cmpq(instance_reg, Address(temp, Heap::EndOffset(space))); |
| 3532 j(ABOVE_EQUAL, failure, near_jump); | 3532 j(ABOVE_EQUAL, failure, near_jump); |
| 3533 // Successfully allocated the object, now update top to point to | 3533 // Successfully allocated the object, now update top to point to |
| 3534 // next object start and store the class in the class field of object. | 3534 // next object start and store the class in the class field of object. |
| 3535 movq(Address(temp, Heap::TopOffset(space)), instance_reg); | 3535 movq(Address(temp, Heap::TopOffset(space)), instance_reg); |
| 3536 UpdateAllocationStats(cls.id(), space); | 3536 UpdateAllocationStats(cls.id(), space); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 3554 bool near_jump, | 3554 bool near_jump, |
| 3555 Register instance, | 3555 Register instance, |
| 3556 Register end_address, | 3556 Register end_address, |
| 3557 Register temp) { | 3557 Register temp) { |
| 3558 ASSERT(failure != NULL); | 3558 ASSERT(failure != NULL); |
| 3559 if (FLAG_inline_alloc) { | 3559 if (FLAG_inline_alloc) { |
| 3560 // If this allocation is traced, program will jump to failure path | 3560 // If this allocation is traced, program will jump to failure path |
| 3561 // (i.e. the allocation stub) which will allocate the object and trace the | 3561 // (i.e. the allocation stub) which will allocate the object and trace the |
| 3562 // allocation call site. | 3562 // allocation call site. |
| 3563 MaybeTraceAllocation(cid, failure, near_jump); | 3563 MaybeTraceAllocation(cid, failure, near_jump); |
| 3564 Heap::Space space = Heap::SpaceForAllocation(cid); | 3564 Heap::Space space = Heap::kNew; |
| 3565 movq(temp, Address(THR, Thread::heap_offset())); | 3565 movq(temp, Address(THR, Thread::heap_offset())); |
| 3566 movq(instance, Address(temp, Heap::TopOffset(space))); | 3566 movq(instance, Address(temp, Heap::TopOffset(space))); |
| 3567 movq(end_address, instance); | 3567 movq(end_address, instance); |
| 3568 | 3568 |
| 3569 addq(end_address, Immediate(instance_size)); | 3569 addq(end_address, Immediate(instance_size)); |
| 3570 j(CARRY, failure); | 3570 j(CARRY, failure); |
| 3571 | 3571 |
| 3572 // Check if the allocation fits into the remaining space. | 3572 // Check if the allocation fits into the remaining space. |
| 3573 // instance: potential new object start. | 3573 // instance: potential new object start. |
| 3574 // end_address: potential next object start. | 3574 // end_address: potential next object start. |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3918 | 3918 |
| 3919 | 3919 |
| 3920 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3920 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
| 3921 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 3921 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); |
| 3922 return xmm_reg_names[reg]; | 3922 return xmm_reg_names[reg]; |
| 3923 } | 3923 } |
| 3924 | 3924 |
| 3925 } // namespace dart | 3925 } // namespace dart |
| 3926 | 3926 |
| 3927 #endif // defined TARGET_ARCH_X64 | 3927 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |