| 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 3658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3669 SmiUntag(object); | 3669 SmiUntag(object); |
| 3670 j(NOT_CARRY, is_smi, kNearJump); | 3670 j(NOT_CARRY, is_smi, kNearJump); |
| 3671 // Load cid: can't use LoadClassId, object is untagged. Use TIMES_2 scale | 3671 // Load cid: can't use LoadClassId, object is untagged. Use TIMES_2 scale |
| 3672 // factor in the addressing mode to compensate for this. | 3672 // factor in the addressing mode to compensate for this. |
| 3673 movl(TMP, Address(object, TIMES_2, class_id_offset)); | 3673 movl(TMP, Address(object, TIMES_2, class_id_offset)); |
| 3674 cmpl(TMP, Immediate(class_id)); | 3674 cmpl(TMP, Immediate(class_id)); |
| 3675 } | 3675 } |
| 3676 | 3676 |
| 3677 | 3677 |
| 3678 void Assembler::LoadClassIdMayBeSmi(Register result, Register object) { | 3678 void Assembler::LoadClassIdMayBeSmi(Register result, Register object) { |
| 3679 ASSERT(result != object); | 3679 Label smi, join; |
| 3680 | 3680 |
| 3681 // Load up a null object. We only need it so we can use LoadClassId on it in | |
| 3682 // the case that object is a Smi. | |
| 3683 LoadObject(result, Object::null_object()); | |
| 3684 // Check if the object is a Smi. | |
| 3685 testq(object, Immediate(kSmiTagMask)); | 3681 testq(object, Immediate(kSmiTagMask)); |
| 3686 // If the object *is* a Smi, use the null object instead. | 3682 j(EQUAL, &smi, Assembler::kNearJump); |
| 3687 cmoveq(object, result); | |
| 3688 // Loads either the cid of the object if it isn't a Smi, or the cid of null | |
| 3689 // if it is a Smi, which will be ignored. | |
| 3690 LoadClassId(result, object); | 3683 LoadClassId(result, object); |
| 3684 jmp(&join, Assembler::kNearJump); |
| 3691 | 3685 |
| 3692 movq(TMP, Immediate(kSmiCid)); | 3686 Bind(&smi); |
| 3693 // If object is a Smi, move the Smi cid into result. o/w leave alone. | 3687 movq(result, Immediate(kSmiCid)); |
| 3694 cmoveq(result, TMP); | 3688 |
| 3689 Bind(&join); |
| 3695 } | 3690 } |
| 3696 | 3691 |
| 3697 | 3692 |
| 3698 void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) { | 3693 void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) { |
| 3699 LoadClassIdMayBeSmi(result, object); | 3694 Label smi, join; |
| 3700 // Finally, tag the result. | 3695 |
| 3696 testq(object, Immediate(kSmiTagMask)); |
| 3697 j(EQUAL, &smi, Assembler::kNearJump); |
| 3698 LoadClassId(result, object); |
| 3701 SmiTag(result); | 3699 SmiTag(result); |
| 3700 jmp(&join, Assembler::kNearJump); |
| 3701 |
| 3702 Bind(&smi); |
| 3703 movq(result, Immediate(Smi::RawValue(kSmiCid))); |
| 3704 |
| 3705 Bind(&join); |
| 3702 } | 3706 } |
| 3703 | 3707 |
| 3704 | 3708 |
| 3705 Address Assembler::ElementAddressForIntIndex(bool is_external, | 3709 Address Assembler::ElementAddressForIntIndex(bool is_external, |
| 3706 intptr_t cid, | 3710 intptr_t cid, |
| 3707 intptr_t index_scale, | 3711 intptr_t index_scale, |
| 3708 Register array, | 3712 Register array, |
| 3709 intptr_t index) { | 3713 intptr_t index) { |
| 3710 if (is_external) { | 3714 if (is_external) { |
| 3711 return Address(array, index * index_scale); | 3715 return Address(array, index * index_scale); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3772 | 3776 |
| 3773 | 3777 |
| 3774 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3778 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
| 3775 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 3779 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); |
| 3776 return xmm_reg_names[reg]; | 3780 return xmm_reg_names[reg]; |
| 3777 } | 3781 } |
| 3778 | 3782 |
| 3779 } // namespace dart | 3783 } // namespace dart |
| 3780 | 3784 |
| 3781 #endif // defined TARGET_ARCH_X64 | 3785 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |