| 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_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 3658 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3669   SmiUntag(object); | 3669   SmiUntag(object); | 
| 3670   j(NOT_CARRY, is_smi, kNearJump); | 3670   j(NOT_CARRY, is_smi, kNearJump); | 
| 3671   // Load cid: can't use LoadClassId, object is untagged. Use TIMES_2 scale | 3671   // Load cid: can't use LoadClassId, object is untagged. Use TIMES_2 scale | 
| 3672   // factor in the addressing mode to compensate for this. | 3672   // factor in the addressing mode to compensate for this. | 
| 3673   movl(TMP, Address(object, TIMES_2, class_id_offset)); | 3673   movl(TMP, Address(object, TIMES_2, class_id_offset)); | 
| 3674   cmpl(TMP, Immediate(class_id)); | 3674   cmpl(TMP, Immediate(class_id)); | 
| 3675 } | 3675 } | 
| 3676 | 3676 | 
| 3677 | 3677 | 
| 3678 void Assembler::LoadClassIdMayBeSmi(Register result, Register object) { | 3678 void Assembler::LoadClassIdMayBeSmi(Register result, Register object) { | 
| 3679   Label smi; | 3679   ASSERT(result != object); | 
| 3680 | 3680 | 
| 3681   if (result == object) { | 3681   // Load up a null object. We only need it so we can use LoadClassId on it in | 
| 3682     Label join; | 3682   // the case that object is a Smi. | 
|  | 3683   LoadObject(result, Object::null_object()); | 
|  | 3684   // Check if the object is a Smi. | 
|  | 3685   testq(object, Immediate(kSmiTagMask)); | 
|  | 3686   // If the object *is* a Smi, use the null object instead. | 
|  | 3687   cmoveq(object, result); | 
|  | 3688   // Loads either the cid of the object if it isn't a Smi, or the cid of null | 
|  | 3689   // if it is a Smi, which will be ignored. | 
|  | 3690   LoadClassId(result, object); | 
| 3683 | 3691 | 
| 3684     testq(object, Immediate(kSmiTagMask)); | 3692   movq(TMP, Immediate(kSmiCid)); | 
| 3685     j(EQUAL, &smi, Assembler::kNearJump); | 3693   // If object is a Smi, move the Smi cid into result. o/w leave alone. | 
| 3686     LoadClassId(result, object); | 3694   cmoveq(result, TMP); | 
| 3687     jmp(&join, Assembler::kNearJump); |  | 
| 3688 |  | 
| 3689     Bind(&smi); |  | 
| 3690     movq(result, Immediate(kSmiCid)); |  | 
| 3691 |  | 
| 3692     Bind(&join); |  | 
| 3693   } else { |  | 
| 3694     testq(object, Immediate(kSmiTagMask)); |  | 
| 3695     movq(result, Immediate(kSmiCid)); |  | 
| 3696     j(EQUAL, &smi, Assembler::kNearJump); |  | 
| 3697     LoadClassId(result, object); |  | 
| 3698 |  | 
| 3699     Bind(&smi); |  | 
| 3700   } |  | 
| 3701 } | 3695 } | 
| 3702 | 3696 | 
| 3703 | 3697 | 
| 3704 void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) { | 3698 void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) { | 
| 3705   Label smi; | 3699   LoadClassIdMayBeSmi(result, object); | 
| 3706 | 3700   // Finally, tag the result. | 
| 3707   if (result == object) { | 3701   SmiTag(result); | 
| 3708     Label join; |  | 
| 3709 |  | 
| 3710     testq(object, Immediate(kSmiTagMask)); |  | 
| 3711     j(EQUAL, &smi, Assembler::kNearJump); |  | 
| 3712     LoadClassId(result, object); |  | 
| 3713     SmiTag(result); |  | 
| 3714     jmp(&join, Assembler::kNearJump); |  | 
| 3715 |  | 
| 3716     Bind(&smi); |  | 
| 3717     movq(result, Immediate(Smi::RawValue(kSmiCid))); |  | 
| 3718 |  | 
| 3719     Bind(&join); |  | 
| 3720   } else { |  | 
| 3721     testq(object, Immediate(kSmiTagMask)); |  | 
| 3722     movq(result, Immediate(kSmiCid)); |  | 
| 3723     j(EQUAL, &smi, Assembler::kNearJump); |  | 
| 3724     LoadClassId(result, object); |  | 
| 3725 |  | 
| 3726     Bind(&smi); |  | 
| 3727     SmiTag(result); |  | 
| 3728   } |  | 
| 3729 } | 3702 } | 
| 3730 | 3703 | 
| 3731 | 3704 | 
| 3732 Address Assembler::ElementAddressForIntIndex(bool is_external, | 3705 Address Assembler::ElementAddressForIntIndex(bool is_external, | 
| 3733                                              intptr_t cid, | 3706                                              intptr_t cid, | 
| 3734                                              intptr_t index_scale, | 3707                                              intptr_t index_scale, | 
| 3735                                              Register array, | 3708                                              Register array, | 
| 3736                                              intptr_t index) { | 3709                                              intptr_t index) { | 
| 3737   if (is_external) { | 3710   if (is_external) { | 
| 3738     return Address(array, index * index_scale); | 3711     return Address(array, index * index_scale); | 
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3799 | 3772 | 
| 3800 | 3773 | 
| 3801 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3774 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 
| 3802   ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 3775   ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 
| 3803   return xmm_reg_names[reg]; | 3776   return xmm_reg_names[reg]; | 
| 3804 } | 3777 } | 
| 3805 | 3778 | 
| 3806 }  // namespace dart | 3779 }  // namespace dart | 
| 3807 | 3780 | 
| 3808 #endif  // defined TARGET_ARCH_X64 | 3781 #endif  // defined TARGET_ARCH_X64 | 
| OLD | NEW | 
|---|