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 3655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3666 } | 3666 } |
3667 | 3667 |
3668 | 3668 |
3669 void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) { | 3669 void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) { |
3670 LoadClassIdMayBeSmi(result, object); | 3670 LoadClassIdMayBeSmi(result, object); |
3671 // Finally, tag the result. | 3671 // Finally, tag the result. |
3672 SmiTag(result); | 3672 SmiTag(result); |
3673 } | 3673 } |
3674 | 3674 |
3675 | 3675 |
3676 void Assembler::ComputeRange(Register result, Register value, Label* not_mint) { | |
3677 Label done, not_smi; | |
3678 testl(value, Immediate(kSmiTagMask)); | |
3679 j(NOT_ZERO, ¬_smi, Assembler::kNearJump); | |
3680 | |
3681 sarq(value, Immediate(32)); // Take the tag into account. | |
3682 movq(result, Immediate(ICData::kUint32RangeBit)); // Uint32 | |
3683 cmpq(value, Immediate(1)); | |
3684 j(EQUAL, &done, Assembler::kNearJump); | |
3685 | |
3686 movq(result, Immediate(ICData::kInt32RangeBit)); | |
3687 subq(result, value); // 10 (positive int32), 11 (negative int32) | |
3688 negq(value); | |
3689 cmpq(value, Immediate(1)); | |
3690 j(BELOW_EQUAL, &done); | |
3691 | |
3692 // On 64-bit we don't need to track sign of smis outside of the Int32 range. | |
3693 // Just pretend they are all signed. | |
3694 movq(result, Immediate(ICData::kSignedRangeBit)); | |
3695 jmp(&done); | |
3696 | |
3697 Bind(¬_smi); | |
3698 CompareClassId(value, kMintCid); | |
3699 j(NOT_EQUAL, not_mint); | |
3700 movq(result, Immediate(ICData::kInt64RangeBit)); | |
3701 | |
3702 Bind(&done); | |
3703 } | |
3704 | |
3705 | |
3706 void Assembler::UpdateRangeFeedback(Register value, | |
3707 intptr_t index, | |
3708 Register ic_data, | |
3709 Register scratch, | |
3710 Label* miss) { | |
3711 ASSERT(ICData::IsValidRangeFeedbackIndex(index)); | |
3712 ComputeRange(scratch, value, miss); | |
3713 shll(scratch, Immediate(ICData::RangeFeedbackShift(index))); | |
3714 orl(FieldAddress(ic_data, ICData::state_bits_offset()), scratch); | |
3715 } | |
3716 | |
3717 | |
3718 Address Assembler::ElementAddressForIntIndex(bool is_external, | 3676 Address Assembler::ElementAddressForIntIndex(bool is_external, |
3719 intptr_t cid, | 3677 intptr_t cid, |
3720 intptr_t index_scale, | 3678 intptr_t index_scale, |
3721 Register array, | 3679 Register array, |
3722 intptr_t index) { | 3680 intptr_t index) { |
3723 if (is_external) { | 3681 if (is_external) { |
3724 return Address(array, index * index_scale); | 3682 return Address(array, index * index_scale); |
3725 } else { | 3683 } else { |
3726 const int64_t disp = static_cast<int64_t>(index) * index_scale + | 3684 const int64_t disp = static_cast<int64_t>(index) * index_scale + |
3727 Instance::DataOffsetFor(cid); | 3685 Instance::DataOffsetFor(cid); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3784 | 3742 |
3785 | 3743 |
3786 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3744 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
3787 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 3745 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); |
3788 return xmm_reg_names[reg]; | 3746 return xmm_reg_names[reg]; |
3789 } | 3747 } |
3790 | 3748 |
3791 } // namespace dart | 3749 } // namespace dart |
3792 | 3750 |
3793 #endif // defined TARGET_ARCH_X64 | 3751 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |