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_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 2921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2932 } | 2932 } |
2933 | 2933 |
2934 | 2934 |
2935 void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) { | 2935 void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) { |
2936 LoadClassIdMayBeSmi(result, object); | 2936 LoadClassIdMayBeSmi(result, object); |
2937 // Tag the result. | 2937 // Tag the result. |
2938 SmiTag(result); | 2938 SmiTag(result); |
2939 } | 2939 } |
2940 | 2940 |
2941 | 2941 |
2942 void Assembler::ComputeRange(Register result, | |
2943 Register value, | |
2944 Register lo_temp, | |
2945 Register hi_temp, | |
2946 Label* not_mint) { | |
2947 Label done; | |
2948 movl(result, value); | |
2949 shrl(result, Immediate(kBitsPerWord - 1)); // Sign bit. | |
2950 testl(value, Immediate(kSmiTagMask)); | |
2951 j(ZERO, &done, Assembler::kNearJump); | |
2952 CompareClassId(value, kMintCid, result); | |
2953 j(NOT_EQUAL, not_mint); | |
2954 movl(lo_temp, FieldAddress(value, Mint::value_offset())); | |
2955 movl(hi_temp, FieldAddress(value, Mint::value_offset() + kWordSize)); | |
2956 movl(result, Immediate(ICData::kInt32RangeBit)); | |
2957 subl(result, hi_temp); // 10 (positive int32), 11 (negative int32) | |
2958 sarl(lo_temp, Immediate(kBitsPerWord - 1)); | |
2959 cmpl(lo_temp, hi_temp); | |
2960 j(EQUAL, &done, Assembler::kNearJump); | |
2961 movl(result, Immediate(ICData::kUint32RangeBit)); // Uint32 | |
2962 cmpl(hi_temp, Immediate(0)); | |
2963 j(EQUAL, &done, Assembler::kNearJump); | |
2964 movl(result, Immediate(ICData::kInt64RangeBit)); // Int64 | |
2965 Bind(&done); | |
2966 } | |
2967 | |
2968 | |
2969 void Assembler::UpdateRangeFeedback(Register value, | |
2970 intptr_t index, | |
2971 Register ic_data, | |
2972 Register scratch1, | |
2973 Register scratch2, | |
2974 Register scratch3, | |
2975 Label* miss) { | |
2976 ASSERT(ICData::IsValidRangeFeedbackIndex(index)); | |
2977 ComputeRange(scratch1, value, scratch2, scratch3, miss); | |
2978 shll(scratch1, Immediate(ICData::RangeFeedbackShift(index))); | |
2979 orl(FieldAddress(ic_data, ICData::state_bits_offset()), scratch1); | |
2980 } | |
2981 | |
2982 | |
2983 Address Assembler::ElementAddressForIntIndex(bool is_external, | 2942 Address Assembler::ElementAddressForIntIndex(bool is_external, |
2984 intptr_t cid, | 2943 intptr_t cid, |
2985 intptr_t index_scale, | 2944 intptr_t index_scale, |
2986 Register array, | 2945 Register array, |
2987 intptr_t index) { | 2946 intptr_t index) { |
2988 if (is_external) { | 2947 if (is_external) { |
2989 return Address(array, index * index_scale); | 2948 return Address(array, index * index_scale); |
2990 } else { | 2949 } else { |
2991 const int64_t disp = static_cast<int64_t>(index) * index_scale + | 2950 const int64_t disp = static_cast<int64_t>(index) * index_scale + |
2992 Instance::DataOffsetFor(cid); | 2951 Instance::DataOffsetFor(cid); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3048 | 3007 |
3049 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3008 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
3050 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 3009 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); |
3051 return xmm_reg_names[reg]; | 3010 return xmm_reg_names[reg]; |
3052 } | 3011 } |
3053 | 3012 |
3054 | 3013 |
3055 } // namespace dart | 3014 } // namespace dart |
3056 | 3015 |
3057 #endif // defined TARGET_ARCH_IA32 | 3016 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |