Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: runtime/vm/assembler_x64.cc

Issue 1217323002: Intrinsic version of Object.runtimeType (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: more Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 3775 matching lines...) Expand 10 before | Expand all | Expand 10 after
3786 // Untag optimistically. Tag bit is shifted into the CARRY. 3786 // Untag optimistically. Tag bit is shifted into the CARRY.
3787 SmiUntag(object); 3787 SmiUntag(object);
3788 j(NOT_CARRY, is_smi, kNearJump); 3788 j(NOT_CARRY, is_smi, kNearJump);
3789 // Load cid: can't use LoadClassId, object is untagged. Use TIMES_2 scale 3789 // Load cid: can't use LoadClassId, object is untagged. Use TIMES_2 scale
3790 // factor in the addressing mode to compensate for this. 3790 // factor in the addressing mode to compensate for this.
3791 movl(TMP, Address(object, TIMES_2, class_id_offset)); 3791 movl(TMP, Address(object, TIMES_2, class_id_offset));
3792 cmpl(TMP, Immediate(class_id)); 3792 cmpl(TMP, Immediate(class_id));
3793 } 3793 }
3794 3794
3795 3795
3796 void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) { 3796 void Assembler::LoadClassIdMayBeSmi(Register result, Register object) {
3797 ASSERT(result != object); 3797 ASSERT(result != object);
3798 3798
3799 // Load up a null object. We only need it so we can use LoadClassId on it in 3799 // Load up a null object. We only need it so we can use LoadClassId on it in
3800 // the case that object is a Smi. 3800 // the case that object is a Smi.
3801 LoadObject(result, Object::null_object(), PP); 3801 LoadObject(result, Object::null_object(), PP);
3802 // Check if the object is a Smi. 3802 // Check if the object is a Smi.
3803 testq(object, Immediate(kSmiTagMask)); 3803 testq(object, Immediate(kSmiTagMask));
3804 // If the object *is* a Smi, use the null object instead. 3804 // If the object *is* a Smi, use the null object instead.
3805 cmoveq(object, result); 3805 cmoveq(object, result);
3806 // Loads either the cid of the object if it isn't a Smi, or the cid of null 3806 // Loads either the cid of the object if it isn't a Smi, or the cid of null
3807 // if it is a Smi, which will be ignored. 3807 // if it is a Smi, which will be ignored.
3808 LoadClassId(result, object); 3808 LoadClassId(result, object);
3809 3809
3810 movq(object, Immediate(kSmiCid)); 3810 movq(object, Immediate(kSmiCid));
3811 // If object is a Smi, move the Smi cid into result. o/w leave alone. 3811 // If object is a Smi, move the Smi cid into result. o/w leave alone.
3812 cmoveq(result, object); 3812 cmoveq(result, object);
3813 }
3814
3815
3816 void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) {
3817 LoadClassIdMayBeSmi(result, object);
3813 // Finally, tag the result. 3818 // Finally, tag the result.
3814 SmiTag(result); 3819 SmiTag(result);
3815 } 3820 }
3816 3821
3817 3822
3818 void Assembler::ComputeRange(Register result, Register value, Label* not_mint) { 3823 void Assembler::ComputeRange(Register result, Register value, Label* not_mint) {
3819 Label done, not_smi; 3824 Label done, not_smi;
3820 testl(value, Immediate(kSmiTagMask)); 3825 testl(value, Immediate(kSmiTagMask));
3821 j(NOT_ZERO, &not_smi, Assembler::kNearJump); 3826 j(NOT_ZERO, &not_smi, Assembler::kNearJump);
3822 3827
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
3926 3931
3927 3932
3928 const char* Assembler::FpuRegisterName(FpuRegister reg) { 3933 const char* Assembler::FpuRegisterName(FpuRegister reg) {
3929 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); 3934 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters));
3930 return xmm_reg_names[reg]; 3935 return xmm_reg_names[reg];
3931 } 3936 }
3932 3937
3933 } // namespace dart 3938 } // namespace dart
3934 3939
3935 #endif // defined TARGET_ARCH_X64 3940 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698