| 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 3415 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3426     addq(instance_reg, Immediate(instance_size)); | 3426     addq(instance_reg, Immediate(instance_size)); | 
| 3427     // instance_reg: potential next object start. | 3427     // instance_reg: potential next object start. | 
| 3428     cmpq(instance_reg, Address(temp, Heap::EndOffset(space))); | 3428     cmpq(instance_reg, Address(temp, Heap::EndOffset(space))); | 
| 3429     j(ABOVE_EQUAL, failure, near_jump); | 3429     j(ABOVE_EQUAL, failure, near_jump); | 
| 3430     // Successfully allocated the object, now update top to point to | 3430     // Successfully allocated the object, now update top to point to | 
| 3431     // next object start and store the class in the class field of object. | 3431     // next object start and store the class in the class field of object. | 
| 3432     movq(Address(temp, Heap::TopOffset(space)), instance_reg); | 3432     movq(Address(temp, Heap::TopOffset(space)), instance_reg); | 
| 3433     NOT_IN_PRODUCT(UpdateAllocationStats(cls.id(), space)); | 3433     NOT_IN_PRODUCT(UpdateAllocationStats(cls.id(), space)); | 
| 3434     ASSERT(instance_size >= kHeapObjectTag); | 3434     ASSERT(instance_size >= kHeapObjectTag); | 
| 3435     AddImmediate(instance_reg, Immediate(kHeapObjectTag - instance_size)); | 3435     AddImmediate(instance_reg, Immediate(kHeapObjectTag - instance_size)); | 
| 3436     uint32_t tags = 0; | 3436     uword tags = 0; | 
| 3437     tags = RawObject::SizeTag::update(instance_size, tags); | 3437     tags = RawObject::SizeTag::update(instance_size, tags); | 
| 3438     ASSERT(cls.id() != kIllegalCid); | 3438     ASSERT(cls.id() != kIllegalCid); | 
| 3439     tags = RawObject::ClassIdTag::update(cls.id(), tags); | 3439     tags = RawObject::ClassIdTag::update(cls.id(), tags); | 
| 3440     // Extends the 32 bit tags with zeros, which is the uninitialized |  | 
| 3441     // hash code. |  | 
| 3442     MoveImmediate(FieldAddress(instance_reg, Object::tags_offset()), | 3440     MoveImmediate(FieldAddress(instance_reg, Object::tags_offset()), | 
| 3443                   Immediate(tags)); | 3441                   Immediate(tags)); | 
| 3444   } else { | 3442   } else { | 
| 3445     jmp(failure); | 3443     jmp(failure); | 
| 3446   } | 3444   } | 
| 3447 } | 3445 } | 
| 3448 | 3446 | 
| 3449 | 3447 | 
| 3450 void Assembler::TryAllocateArray(intptr_t cid, | 3448 void Assembler::TryAllocateArray(intptr_t cid, | 
| 3451                                  intptr_t instance_size, | 3449                                  intptr_t instance_size, | 
| (...skipping 23 matching lines...) Expand all  Loading... | 
| 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(temp, Heap::TopOffset(space)), 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     uword 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 |  | 
| 3489     // hash code. |  | 
| 3490     movq(FieldAddress(instance, Array::tags_offset()), Immediate(tags)); | 3486     movq(FieldAddress(instance, Array::tags_offset()), Immediate(tags)); | 
| 3491   } else { | 3487   } else { | 
| 3492     jmp(failure); | 3488     jmp(failure); | 
| 3493   } | 3489   } | 
| 3494 } | 3490 } | 
| 3495 | 3491 | 
| 3496 void Assembler::Align(int alignment, intptr_t offset) { | 3492 void Assembler::Align(int alignment, intptr_t offset) { | 
| 3497   ASSERT(Utils::IsPowerOfTwo(alignment)); | 3493   ASSERT(Utils::IsPowerOfTwo(alignment)); | 
| 3498   intptr_t pos = offset + buffer_.GetPosition(); | 3494   intptr_t pos = offset + buffer_.GetPosition(); | 
| 3499   int mod = pos & (alignment - 1); | 3495   int mod = pos & (alignment - 1); | 
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3805 | 3801 | 
| 3806 | 3802 | 
| 3807 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3803 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 
| 3808   ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 3804   ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 
| 3809   return xmm_reg_names[reg]; | 3805   return xmm_reg_names[reg]; | 
| 3810 } | 3806 } | 
| 3811 | 3807 | 
| 3812 }  // namespace dart | 3808 }  // namespace dart | 
| 3813 | 3809 | 
| 3814 #endif  // defined TARGET_ARCH_X64 | 3810 #endif  // defined TARGET_ARCH_X64 | 
| OLD | NEW | 
|---|