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 2743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2754 | 2754 |
2755 | 2755 |
2756 void Assembler::CompareClassId(Register object, | 2756 void Assembler::CompareClassId(Register object, |
2757 intptr_t class_id, | 2757 intptr_t class_id, |
2758 Register scratch) { | 2758 Register scratch) { |
2759 LoadClassId(scratch, object); | 2759 LoadClassId(scratch, object); |
2760 cmpl(scratch, Immediate(class_id)); | 2760 cmpl(scratch, Immediate(class_id)); |
2761 } | 2761 } |
2762 | 2762 |
2763 | 2763 |
| 2764 void Assembler::SmiUntagOrCheckClass(Register object, |
| 2765 intptr_t class_id, |
| 2766 Register scratch, |
| 2767 Label* is_smi) { |
| 2768 ASSERT(kSmiTagShift == 1); |
| 2769 ASSERT(RawObject::kClassIdTagPos == 16); |
| 2770 ASSERT(RawObject::kClassIdTagSize == 16); |
| 2771 const intptr_t class_id_offset = Object::tags_offset() + |
| 2772 RawObject::kClassIdTagPos / kBitsPerByte; |
| 2773 |
| 2774 // Untag optimistically. Tag bit is shifted into the CARRY. |
| 2775 SmiUntag(object); |
| 2776 j(NOT_CARRY, is_smi, kNearJump); |
| 2777 // Load cid: can't use LoadClassId, object is untagged. Use TIMES_2 scale |
| 2778 // factor in the addressing mode to compensate for this. |
| 2779 movzxw(scratch, Address(object, TIMES_2, class_id_offset)); |
| 2780 cmpl(scratch, Immediate(class_id)); |
| 2781 } |
| 2782 |
| 2783 |
2764 void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) { | 2784 void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) { |
2765 ASSERT(result != object); | 2785 ASSERT(result != object); |
2766 static const intptr_t kSmiCidSource = kSmiCid << RawObject::kClassIdTagPos; | 2786 static const intptr_t kSmiCidSource = kSmiCid << RawObject::kClassIdTagPos; |
2767 | 2787 |
2768 // Make a dummy "Object" whose cid is kSmiCid. | 2788 // Make a dummy "Object" whose cid is kSmiCid. |
2769 movl(result, Immediate(reinterpret_cast<int32_t>(&kSmiCidSource) + 1)); | 2789 movl(result, Immediate(reinterpret_cast<int32_t>(&kSmiCidSource) + 1)); |
2770 | 2790 |
2771 // Check if object (in tmp) is a Smi. | 2791 // Check if object (in tmp) is a Smi. |
2772 testl(object, Immediate(kSmiTagMask)); | 2792 testl(object, Immediate(kSmiTagMask)); |
2773 | 2793 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2849 | 2869 |
2850 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 2870 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
2851 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 2871 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); |
2852 return xmm_reg_names[reg]; | 2872 return xmm_reg_names[reg]; |
2853 } | 2873 } |
2854 | 2874 |
2855 | 2875 |
2856 } // namespace dart | 2876 } // namespace dart |
2857 | 2877 |
2858 #endif // defined TARGET_ARCH_IA32 | 2878 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |