OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 // Use 64-bit mode byte registers. | 678 // Use 64-bit mode byte registers. |
679 emit_rex_64(dst); | 679 emit_rex_64(dst); |
680 } | 680 } |
681 ASSERT(is_int8(src.value_) || is_uint8(src.value_)); | 681 ASSERT(is_int8(src.value_) || is_uint8(src.value_)); |
682 emit(0x80); | 682 emit(0x80); |
683 emit_modrm(subcode, dst); | 683 emit_modrm(subcode, dst); |
684 emit(src.value_); | 684 emit(src.value_); |
685 } | 685 } |
686 | 686 |
687 | 687 |
688 void Assembler::shift(Register dst, Immediate shift_amount, int subcode) { | 688 void Assembler::shift(Register dst, |
| 689 Immediate shift_amount, |
| 690 int subcode, |
| 691 int size) { |
689 EnsureSpace ensure_space(this); | 692 EnsureSpace ensure_space(this); |
690 ASSERT(is_uint6(shift_amount.value_)); // illegal shift count | 693 ASSERT(size == kInt64Size ? is_uint6(shift_amount.value_) |
| 694 : is_uint5(shift_amount.value_)); |
691 if (shift_amount.value_ == 1) { | 695 if (shift_amount.value_ == 1) { |
692 emit_rex_64(dst); | 696 emit_rex(dst, size); |
693 emit(0xD1); | 697 emit(0xD1); |
694 emit_modrm(subcode, dst); | 698 emit_modrm(subcode, dst); |
695 } else { | 699 } else { |
696 emit_rex_64(dst); | 700 emit_rex(dst, size); |
697 emit(0xC1); | 701 emit(0xC1); |
698 emit_modrm(subcode, dst); | 702 emit_modrm(subcode, dst); |
699 emit(shift_amount.value_); | 703 emit(shift_amount.value_); |
700 } | 704 } |
701 } | 705 } |
702 | 706 |
703 | 707 |
704 void Assembler::shift(Register dst, int subcode) { | 708 void Assembler::shift(Register dst, int subcode, int size) { |
705 EnsureSpace ensure_space(this); | 709 EnsureSpace ensure_space(this); |
706 emit_rex_64(dst); | 710 emit_rex(dst, size); |
707 emit(0xD3); | 711 emit(0xD3); |
708 emit_modrm(subcode, dst); | 712 emit_modrm(subcode, dst); |
709 } | 713 } |
710 | 714 |
711 | 715 |
712 void Assembler::shift_32(Register dst, int subcode) { | |
713 EnsureSpace ensure_space(this); | |
714 emit_optional_rex_32(dst); | |
715 emit(0xD3); | |
716 emit_modrm(subcode, dst); | |
717 } | |
718 | |
719 | |
720 void Assembler::shift_32(Register dst, Immediate shift_amount, int subcode) { | |
721 EnsureSpace ensure_space(this); | |
722 ASSERT(is_uint5(shift_amount.value_)); // illegal shift count | |
723 if (shift_amount.value_ == 1) { | |
724 emit_optional_rex_32(dst); | |
725 emit(0xD1); | |
726 emit_modrm(subcode, dst); | |
727 } else { | |
728 emit_optional_rex_32(dst); | |
729 emit(0xC1); | |
730 emit_modrm(subcode, dst); | |
731 emit(shift_amount.value_); | |
732 } | |
733 } | |
734 | |
735 | |
736 void Assembler::bt(const Operand& dst, Register src) { | 716 void Assembler::bt(const Operand& dst, Register src) { |
737 EnsureSpace ensure_space(this); | 717 EnsureSpace ensure_space(this); |
738 emit_rex_64(src, dst); | 718 emit_rex_64(src, dst); |
739 emit(0x0F); | 719 emit(0x0F); |
740 emit(0xA3); | 720 emit(0xA3); |
741 emit_operand(src, dst); | 721 emit_operand(src, dst); |
742 } | 722 } |
743 | 723 |
744 | 724 |
745 void Assembler::bts(const Operand& dst, Register src) { | 725 void Assembler::bts(const Operand& dst, Register src) { |
(...skipping 2298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3044 | 3024 |
3045 | 3025 |
3046 bool RelocInfo::IsInConstantPool() { | 3026 bool RelocInfo::IsInConstantPool() { |
3047 return false; | 3027 return false; |
3048 } | 3028 } |
3049 | 3029 |
3050 | 3030 |
3051 } } // namespace v8::internal | 3031 } } // namespace v8::internal |
3052 | 3032 |
3053 #endif // V8_TARGET_ARCH_X64 | 3033 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |