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 2999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3010 // Untag optimistically. Tag bit is shifted into the CARRY. | 3010 // Untag optimistically. Tag bit is shifted into the CARRY. |
3011 SmiUntag(object); | 3011 SmiUntag(object); |
3012 j(NOT_CARRY, is_smi, kNearJump); | 3012 j(NOT_CARRY, is_smi, kNearJump); |
3013 // Load cid: can't use LoadClassId, object is untagged. Use TIMES_2 scale | 3013 // Load cid: can't use LoadClassId, object is untagged. Use TIMES_2 scale |
3014 // factor in the addressing mode to compensate for this. | 3014 // factor in the addressing mode to compensate for this. |
3015 movzxw(scratch, Address(object, TIMES_2, class_id_offset)); | 3015 movzxw(scratch, Address(object, TIMES_2, class_id_offset)); |
3016 cmpl(scratch, Immediate(class_id)); | 3016 cmpl(scratch, Immediate(class_id)); |
3017 } | 3017 } |
3018 | 3018 |
3019 | 3019 |
3020 void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) { | 3020 void Assembler::LoadClassIdMayBeSmi(Register result, Register object) { |
3021 ASSERT(result != object); | 3021 ASSERT(result != object); |
3022 static const intptr_t kSmiCidSource = kSmiCid << RawObject::kClassIdTagPos; | 3022 static const intptr_t kSmiCidSource = kSmiCid << RawObject::kClassIdTagPos; |
3023 | 3023 |
3024 // Make a dummy "Object" whose cid is kSmiCid. | 3024 // Make a dummy "Object" whose cid is kSmiCid. |
3025 movl(result, Immediate(reinterpret_cast<int32_t>(&kSmiCidSource) + 1)); | 3025 movl(result, Immediate(reinterpret_cast<int32_t>(&kSmiCidSource) + 1)); |
3026 | 3026 |
3027 // Check if object (in tmp) is a Smi. | 3027 // Check if object (in tmp) is a Smi. |
3028 testl(object, Immediate(kSmiTagMask)); | 3028 testl(object, Immediate(kSmiTagMask)); |
3029 | 3029 |
3030 // If the object is not a Smi, use the original object to load the cid. | 3030 // If the object is not a Smi, use the original object to load the cid. |
3031 // Otherwise, the dummy object is used, and the result is kSmiCid. | 3031 // Otherwise, the dummy object is used, and the result is kSmiCid. |
3032 cmovne(result, object); | 3032 cmovne(result, object); |
3033 LoadClassId(result, result); | 3033 LoadClassId(result, result); |
| 3034 } |
3034 | 3035 |
| 3036 |
| 3037 void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) { |
| 3038 LoadClassIdMayBeSmi(result, object); |
3035 // Tag the result. | 3039 // Tag the result. |
3036 SmiTag(result); | 3040 SmiTag(result); |
3037 } | 3041 } |
3038 | 3042 |
3039 | 3043 |
3040 void Assembler::ComputeRange(Register result, | 3044 void Assembler::ComputeRange(Register result, |
3041 Register value, | 3045 Register value, |
3042 Register lo_temp, | 3046 Register lo_temp, |
3043 Register hi_temp, | 3047 Register hi_temp, |
3044 Label* not_mint) { | 3048 Label* not_mint) { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3146 | 3150 |
3147 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3151 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
3148 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 3152 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); |
3149 return xmm_reg_names[reg]; | 3153 return xmm_reg_names[reg]; |
3150 } | 3154 } |
3151 | 3155 |
3152 | 3156 |
3153 } // namespace dart | 3157 } // namespace dart |
3154 | 3158 |
3155 #endif // defined TARGET_ARCH_IA32 | 3159 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |