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" | 5 #include "vm/globals.h" |
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 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1490 } | 1490 } |
1491 | 1491 |
1492 | 1492 |
1493 void Assembler::orl(Register dst, const Address& address) { | 1493 void Assembler::orl(Register dst, const Address& address) { |
1494 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 1494 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
1495 EmitUint8(0x0B); | 1495 EmitUint8(0x0B); |
1496 EmitOperand(dst, address); | 1496 EmitOperand(dst, address); |
1497 } | 1497 } |
1498 | 1498 |
1499 | 1499 |
| 1500 void Assembler::orl(const Address& address, Register reg) { |
| 1501 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
| 1502 EmitUint8(0x09); |
| 1503 EmitOperand(reg, address); |
| 1504 } |
| 1505 |
| 1506 |
1500 void Assembler::xorl(Register dst, Register src) { | 1507 void Assembler::xorl(Register dst, Register src) { |
1501 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 1508 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
1502 EmitUint8(0x33); | 1509 EmitUint8(0x33); |
1503 EmitOperand(dst, Operand(src)); | 1510 EmitOperand(dst, Operand(src)); |
1504 } | 1511 } |
1505 | 1512 |
1506 | 1513 |
1507 void Assembler::xorl(Register dst, const Immediate& imm) { | 1514 void Assembler::xorl(Register dst, const Immediate& imm) { |
1508 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 1515 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
1509 EmitComplex(6, Operand(dst), imm); | 1516 EmitComplex(6, Operand(dst), imm); |
(...skipping 1401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2911 // If the object is not a Smi, use the original object to load the cid. | 2918 // If the object is not a Smi, use the original object to load the cid. |
2912 // Otherwise, the dummy object is used, and the result is kSmiCid. | 2919 // Otherwise, the dummy object is used, and the result is kSmiCid. |
2913 cmovne(result, object); | 2920 cmovne(result, object); |
2914 LoadClassId(result, result); | 2921 LoadClassId(result, result); |
2915 | 2922 |
2916 // Tag the result. | 2923 // Tag the result. |
2917 SmiTag(result); | 2924 SmiTag(result); |
2918 } | 2925 } |
2919 | 2926 |
2920 | 2927 |
| 2928 void Assembler::ComputeRange(Register result, |
| 2929 Register value, |
| 2930 Register lo_temp, |
| 2931 Register hi_temp, |
| 2932 Label* not_mint) { |
| 2933 Label done; |
| 2934 movl(result, value); |
| 2935 shrl(result, Immediate(kBitsPerWord - 1)); // Sign bit. |
| 2936 testl(value, Immediate(kSmiTagMask)); |
| 2937 j(ZERO, &done, Assembler::kNearJump); |
| 2938 CompareClassId(value, kMintCid, result); |
| 2939 j(NOT_EQUAL, not_mint); |
| 2940 movl(lo_temp, FieldAddress(value, Mint::value_offset())); |
| 2941 movl(hi_temp, FieldAddress(value, Mint::value_offset() + kWordSize)); |
| 2942 movl(result, Immediate(ICData::kInt32RangeBit)); |
| 2943 subl(result, hi_temp); // 10 (positive int32), 11 (negative int32) |
| 2944 sarl(lo_temp, Immediate(kBitsPerWord - 1)); |
| 2945 cmpl(lo_temp, hi_temp); |
| 2946 j(EQUAL, &done, Assembler::kNearJump); |
| 2947 movl(result, Immediate(ICData::kUint32RangeBit)); // Uint32 |
| 2948 cmpl(hi_temp, Immediate(0)); |
| 2949 j(EQUAL, &done, Assembler::kNearJump); |
| 2950 movl(result, Immediate(ICData::kInt64RangeBit)); // Int64 |
| 2951 Bind(&done); |
| 2952 } |
| 2953 |
| 2954 |
| 2955 void Assembler::UpdateRangeFeedback(Register value, |
| 2956 intptr_t index, |
| 2957 Register ic_data, |
| 2958 Register scratch1, |
| 2959 Register scratch2, |
| 2960 Register scratch3, |
| 2961 Label* miss) { |
| 2962 ASSERT(ICData::IsValidRangeFeedbackIndex(index)); |
| 2963 ComputeRange(scratch1, value, scratch2, scratch3, miss); |
| 2964 if (index != 0) { |
| 2965 shll(scratch1, Immediate(ICData::kBitsPerRangeFeedback * index)); |
| 2966 } |
| 2967 orl(FieldAddress(ic_data, ICData::range_feedback_offset()), scratch1); |
| 2968 } |
| 2969 |
| 2970 |
2921 Address Assembler::ElementAddressForIntIndex(bool is_external, | 2971 Address Assembler::ElementAddressForIntIndex(bool is_external, |
2922 intptr_t cid, | 2972 intptr_t cid, |
2923 intptr_t index_scale, | 2973 intptr_t index_scale, |
2924 Register array, | 2974 Register array, |
2925 intptr_t index) { | 2975 intptr_t index) { |
2926 if (is_external) { | 2976 if (is_external) { |
2927 return Address(array, index * index_scale); | 2977 return Address(array, index * index_scale); |
2928 } else { | 2978 } else { |
2929 const int64_t disp = static_cast<int64_t>(index) * index_scale + | 2979 const int64_t disp = static_cast<int64_t>(index) * index_scale + |
2930 Instance::DataOffsetFor(cid); | 2980 Instance::DataOffsetFor(cid); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2986 | 3036 |
2987 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3037 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
2988 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 3038 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); |
2989 return xmm_reg_names[reg]; | 3039 return xmm_reg_names[reg]; |
2990 } | 3040 } |
2991 | 3041 |
2992 | 3042 |
2993 } // namespace dart | 3043 } // namespace dart |
2994 | 3044 |
2995 #endif // defined TARGET_ARCH_IA32 | 3045 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |