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 3402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3413 bool near_jump, | 3413 bool near_jump, |
3414 Register instance_reg, | 3414 Register instance_reg, |
3415 Register temp) { | 3415 Register temp) { |
3416 ASSERT(failure != NULL); | 3416 ASSERT(failure != NULL); |
3417 if (FLAG_inline_alloc) { | 3417 if (FLAG_inline_alloc) { |
3418 // If this allocation is traced, program will jump to failure path | 3418 // If this allocation is traced, program will jump to failure path |
3419 // (i.e. the allocation stub) which will allocate the object and trace the | 3419 // (i.e. the allocation stub) which will allocate the object and trace the |
3420 // allocation call site. | 3420 // allocation call site. |
3421 NOT_IN_PRODUCT(MaybeTraceAllocation(cls.id(), failure, near_jump)); | 3421 NOT_IN_PRODUCT(MaybeTraceAllocation(cls.id(), failure, near_jump)); |
3422 const intptr_t instance_size = cls.instance_size(); | 3422 const intptr_t instance_size = cls.instance_size(); |
3423 Heap::Space space = Heap::kNew; | 3423 NOT_IN_PRODUCT(Heap::Space space = Heap::kNew); |
3424 movq(temp, Address(THR, Thread::heap_offset())); | 3424 movq(instance_reg, Address(THR, Thread::top_offset())); |
3425 movq(instance_reg, Address(temp, Heap::TopOffset(space))); | |
3426 addq(instance_reg, Immediate(instance_size)); | 3425 addq(instance_reg, Immediate(instance_size)); |
3427 // instance_reg: potential next object start. | 3426 // instance_reg: potential next object start. |
3428 cmpq(instance_reg, Address(temp, Heap::EndOffset(space))); | 3427 cmpq(instance_reg, Address(THR, Thread::end_offset())); |
3429 j(ABOVE_EQUAL, failure, near_jump); | 3428 j(ABOVE_EQUAL, failure, near_jump); |
3430 // Successfully allocated the object, now update top to point to | 3429 // Successfully allocated the object, now update top to point to |
3431 // next object start and store the class in the class field of object. | 3430 // next object start and store the class in the class field of object. |
3432 movq(Address(temp, Heap::TopOffset(space)), instance_reg); | 3431 movq(Address(THR, Thread::top_offset()), instance_reg); |
3433 NOT_IN_PRODUCT(UpdateAllocationStats(cls.id(), space)); | 3432 NOT_IN_PRODUCT(UpdateAllocationStats(cls.id(), space)); |
3434 ASSERT(instance_size >= kHeapObjectTag); | 3433 ASSERT(instance_size >= kHeapObjectTag); |
3435 AddImmediate(instance_reg, Immediate(kHeapObjectTag - instance_size)); | 3434 AddImmediate(instance_reg, Immediate(kHeapObjectTag - instance_size)); |
3436 uint32_t tags = 0; | 3435 uint32_t tags = 0; |
3437 tags = RawObject::SizeTag::update(instance_size, tags); | 3436 tags = RawObject::SizeTag::update(instance_size, tags); |
3438 ASSERT(cls.id() != kIllegalCid); | 3437 ASSERT(cls.id() != kIllegalCid); |
3439 tags = RawObject::ClassIdTag::update(cls.id(), tags); | 3438 tags = RawObject::ClassIdTag::update(cls.id(), tags); |
3440 // Extends the 32 bit tags with zeros, which is the uninitialized | 3439 // Extends the 32 bit tags with zeros, which is the uninitialized |
3441 // hash code. | 3440 // hash code. |
3442 MoveImmediate(FieldAddress(instance_reg, Object::tags_offset()), | 3441 MoveImmediate(FieldAddress(instance_reg, Object::tags_offset()), |
(...skipping 10 matching lines...) Expand all Loading... |
3453 bool near_jump, | 3452 bool near_jump, |
3454 Register instance, | 3453 Register instance, |
3455 Register end_address, | 3454 Register end_address, |
3456 Register temp) { | 3455 Register temp) { |
3457 ASSERT(failure != NULL); | 3456 ASSERT(failure != NULL); |
3458 if (FLAG_inline_alloc) { | 3457 if (FLAG_inline_alloc) { |
3459 // If this allocation is traced, program will jump to failure path | 3458 // If this allocation is traced, program will jump to failure path |
3460 // (i.e. the allocation stub) which will allocate the object and trace the | 3459 // (i.e. the allocation stub) which will allocate the object and trace the |
3461 // allocation call site. | 3460 // allocation call site. |
3462 NOT_IN_PRODUCT(MaybeTraceAllocation(cid, failure, near_jump)); | 3461 NOT_IN_PRODUCT(MaybeTraceAllocation(cid, failure, near_jump)); |
3463 Heap::Space space = Heap::kNew; | 3462 NOT_IN_PRODUCT(Heap::Space space = Heap::kNew); |
3464 movq(temp, Address(THR, Thread::heap_offset())); | 3463 movq(instance, Address(THR, Thread::top_offset())); |
3465 movq(instance, Address(temp, Heap::TopOffset(space))); | |
3466 movq(end_address, instance); | 3464 movq(end_address, instance); |
3467 | 3465 |
3468 addq(end_address, Immediate(instance_size)); | 3466 addq(end_address, Immediate(instance_size)); |
3469 j(CARRY, failure); | 3467 j(CARRY, failure); |
3470 | 3468 |
3471 // Check if the allocation fits into the remaining space. | 3469 // Check if the allocation fits into the remaining space. |
3472 // instance: potential new object start. | 3470 // instance: potential new object start. |
3473 // end_address: potential next object start. | 3471 // end_address: potential next object start. |
3474 cmpq(end_address, Address(temp, Heap::EndOffset(space))); | 3472 cmpq(end_address, Address(THR, Thread::end_offset())); |
3475 j(ABOVE_EQUAL, failure); | 3473 j(ABOVE_EQUAL, failure); |
3476 | 3474 |
3477 // Successfully allocated the object(s), now update top to point to | 3475 // Successfully allocated the object(s), now update top to point to |
3478 // next object start and initialize the object. | 3476 // next object start and initialize the object. |
3479 movq(Address(temp, Heap::TopOffset(space)), end_address); | 3477 movq(Address(THR, Thread::top_offset()), end_address); |
3480 addq(instance, Immediate(kHeapObjectTag)); | 3478 addq(instance, Immediate(kHeapObjectTag)); |
3481 NOT_IN_PRODUCT(UpdateAllocationStatsWithSize(cid, instance_size, space)); | 3479 NOT_IN_PRODUCT(UpdateAllocationStatsWithSize(cid, instance_size, space)); |
3482 | 3480 |
3483 // Initialize the tags. | 3481 // Initialize the tags. |
3484 // instance: new object start as a tagged pointer. | 3482 // instance: new object start as a tagged pointer. |
3485 uint32_t tags = 0; | 3483 uint32_t tags = 0; |
3486 tags = RawObject::ClassIdTag::update(cid, tags); | 3484 tags = RawObject::ClassIdTag::update(cid, tags); |
3487 tags = RawObject::SizeTag::update(instance_size, tags); | 3485 tags = RawObject::SizeTag::update(instance_size, tags); |
3488 // Extends the 32 bit tags with zeros, which is the uninitialized | 3486 // Extends the 32 bit tags with zeros, which is the uninitialized |
3489 // hash code. | 3487 // hash code. |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3805 | 3803 |
3806 | 3804 |
3807 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3805 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
3808 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 3806 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); |
3809 return xmm_reg_names[reg]; | 3807 return xmm_reg_names[reg]; |
3810 } | 3808 } |
3811 | 3809 |
3812 } // namespace dart | 3810 } // namespace dart |
3813 | 3811 |
3814 #endif // defined TARGET_ARCH_X64 | 3812 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |