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_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 3414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3425 LoadClassById(result, TMP); | 3425 LoadClassById(result, TMP); |
3426 } | 3426 } |
3427 | 3427 |
3428 | 3428 |
3429 void Assembler::CompareClassId(Register object, intptr_t class_id) { | 3429 void Assembler::CompareClassId(Register object, intptr_t class_id) { |
3430 LoadClassId(TMP, object); | 3430 LoadClassId(TMP, object); |
3431 cmpl(TMP, Immediate(class_id)); | 3431 cmpl(TMP, Immediate(class_id)); |
3432 } | 3432 } |
3433 | 3433 |
3434 | 3434 |
| 3435 void Assembler::SmiUntagOrCheckClass(Register object, |
| 3436 intptr_t class_id, |
| 3437 Label* is_smi) { |
| 3438 ASSERT(kSmiTagShift == 1); |
| 3439 ASSERT(RawObject::kClassIdTagPos == 16); |
| 3440 ASSERT(RawObject::kClassIdTagSize == 16); |
| 3441 const intptr_t class_id_offset = Object::tags_offset() + |
| 3442 RawObject::kClassIdTagPos / kBitsPerByte; |
| 3443 |
| 3444 // Untag optimistically. Tag bit is shifted into the CARRY. |
| 3445 SmiUntag(object); |
| 3446 j(NOT_CARRY, is_smi, kNearJump); |
| 3447 // Load cid: can't use LoadClassId, object is untagged. Use TIMES_2 scale |
| 3448 // factor in the addressing mode to compensate for this. |
| 3449 movzxw(TMP, Address(object, TIMES_2, class_id_offset)); |
| 3450 cmpl(TMP, Immediate(class_id)); |
| 3451 } |
| 3452 |
| 3453 |
3435 void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) { | 3454 void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) { |
3436 ASSERT(result != object); | 3455 ASSERT(result != object); |
3437 | 3456 |
3438 // Load up a null object. We only need it so we can use LoadClassId on it in | 3457 // Load up a null object. We only need it so we can use LoadClassId on it in |
3439 // the case that object is a Smi. | 3458 // the case that object is a Smi. |
3440 LoadObject(result, Object::null_object(), PP); | 3459 LoadObject(result, Object::null_object(), PP); |
3441 // Check if the object is a Smi. | 3460 // Check if the object is a Smi. |
3442 testq(object, Immediate(kSmiTagMask)); | 3461 testq(object, Immediate(kSmiTagMask)); |
3443 // If the object *is* a Smi, use the null object instead. | 3462 // If the object *is* a Smi, use the null object instead. |
3444 cmoveq(object, result); | 3463 cmoveq(object, result); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3523 | 3542 |
3524 | 3543 |
3525 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3544 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
3526 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 3545 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); |
3527 return xmm_reg_names[reg]; | 3546 return xmm_reg_names[reg]; |
3528 } | 3547 } |
3529 | 3548 |
3530 } // namespace dart | 3549 } // namespace dart |
3531 | 3550 |
3532 #endif // defined TARGET_ARCH_X64 | 3551 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |