| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/x64/assembler-x64.h" | 5 #include "src/x64/assembler-x64.h" |
| 6 | 6 |
| 7 #include <cstring> | 7 #include <cstring> |
| 8 | 8 |
| 9 #if V8_TARGET_ARCH_X64 | 9 #if V8_TARGET_ARCH_X64 |
| 10 | 10 |
| (...skipping 2085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2096 } else { | 2096 } else { |
| 2097 emit_optional_rex_32(reg, op); | 2097 emit_optional_rex_32(reg, op); |
| 2098 } | 2098 } |
| 2099 emit(0x84); | 2099 emit(0x84); |
| 2100 emit_operand(reg, op); | 2100 emit_operand(reg, op); |
| 2101 } | 2101 } |
| 2102 | 2102 |
| 2103 void Assembler::testw(Register dst, Register src) { | 2103 void Assembler::testw(Register dst, Register src) { |
| 2104 EnsureSpace ensure_space(this); | 2104 EnsureSpace ensure_space(this); |
| 2105 emit(0x66); | 2105 emit(0x66); |
| 2106 if (src.low_bits() == 4) { | 2106 if (!dst.is_byte_register() || !src.is_byte_register()) { |
| 2107 emit_rex_32(src, dst); | 2107 // Register is not one of al, bl, cl, dl. Its encoding needs REX. |
| 2108 emit_rex_32(dst, src); |
| 2108 } | 2109 } |
| 2109 emit(0x85); | 2110 emit(0x85); |
| 2110 emit_modrm(src, dst); | 2111 emit_modrm(dst, src); |
| 2111 } | 2112 } |
| 2112 | 2113 |
| 2113 void Assembler::testw(Register reg, Immediate mask) { | 2114 void Assembler::testw(Register reg, Immediate mask) { |
| 2114 DCHECK(is_int16(mask.value_) || is_uint16(mask.value_)); | 2115 DCHECK(is_int16(mask.value_) || is_uint16(mask.value_)); |
| 2115 EnsureSpace ensure_space(this); | 2116 EnsureSpace ensure_space(this); |
| 2116 emit(0x66); | 2117 emit(0x66); |
| 2117 if (reg.is(rax)) { | 2118 if (reg.is(rax)) { |
| 2118 emit(0xA9); | 2119 emit(0xA9); |
| 2119 emitw(mask.value_); | 2120 emitw(mask.value_); |
| 2120 } else { | 2121 } else { |
| 2121 if (reg.low_bits() == 4) { | 2122 if (!reg.is_byte_register()) { |
| 2122 emit_rex_32(reg); | 2123 emit_rex_32(reg); |
| 2123 } | 2124 } |
| 2124 emit(0xF7); | 2125 emit(0xF7); |
| 2125 emit_modrm(0x0, reg); | 2126 emit_modrm(0x0, reg); |
| 2126 emitw(mask.value_); | 2127 emitw(mask.value_); |
| 2127 } | 2128 } |
| 2128 } | 2129 } |
| 2129 | 2130 |
| 2130 void Assembler::testw(const Operand& op, Immediate mask) { | 2131 void Assembler::testw(const Operand& op, Immediate mask) { |
| 2131 DCHECK(is_int16(mask.value_) || is_uint16(mask.value_)); | 2132 DCHECK(is_int16(mask.value_) || is_uint16(mask.value_)); |
| (...skipping 2624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4756 | 4757 |
| 4757 bool RelocInfo::IsInConstantPool() { | 4758 bool RelocInfo::IsInConstantPool() { |
| 4758 return false; | 4759 return false; |
| 4759 } | 4760 } |
| 4760 | 4761 |
| 4761 | 4762 |
| 4762 } // namespace internal | 4763 } // namespace internal |
| 4763 } // namespace v8 | 4764 } // namespace v8 |
| 4764 | 4765 |
| 4765 #endif // V8_TARGET_ARCH_X64 | 4766 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |