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 1996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2007 if (!reg.is_byte_register()) { | 2007 if (!reg.is_byte_register()) { |
2008 // Register is not one of al, bl, cl, dl. Its encoding needs REX. | 2008 // Register is not one of al, bl, cl, dl. Its encoding needs REX. |
2009 emit_rex_32(reg, op); | 2009 emit_rex_32(reg, op); |
2010 } else { | 2010 } else { |
2011 emit_optional_rex_32(reg, op); | 2011 emit_optional_rex_32(reg, op); |
2012 } | 2012 } |
2013 emit(0x84); | 2013 emit(0x84); |
2014 emit_operand(reg, op); | 2014 emit_operand(reg, op); |
2015 } | 2015 } |
2016 | 2016 |
| 2017 void Assembler::testw(Register dst, Register src) { |
| 2018 EnsureSpace ensure_space(this); |
| 2019 emit(0x66); |
| 2020 if (src.low_bits() == 4) { |
| 2021 emit_rex_32(src, dst); |
| 2022 } |
| 2023 emit(0x85); |
| 2024 emit_modrm(src, dst); |
| 2025 } |
| 2026 |
| 2027 void Assembler::testw(Register reg, Immediate mask) { |
| 2028 DCHECK(is_int16(mask.value_) || is_uint16(mask.value_)); |
| 2029 EnsureSpace ensure_space(this); |
| 2030 emit(0x66); |
| 2031 if (reg.is(rax)) { |
| 2032 emit(0xA9); |
| 2033 emit(mask.value_); |
| 2034 } else { |
| 2035 if (reg.low_bits() == 4) { |
| 2036 emit_rex_32(reg); |
| 2037 } |
| 2038 emit(0xF7); |
| 2039 emit_modrm(0x0, reg); |
| 2040 emit(mask.value_); |
| 2041 } |
| 2042 } |
| 2043 |
| 2044 void Assembler::testw(const Operand& op, Immediate mask) { |
| 2045 DCHECK(is_int16(mask.value_) || is_uint16(mask.value_)); |
| 2046 EnsureSpace ensure_space(this); |
| 2047 emit(0x66); |
| 2048 emit_optional_rex_32(rax, op); |
| 2049 emit(0xF7); |
| 2050 emit_operand(rax, op); |
| 2051 emit(mask.value_); |
| 2052 } |
| 2053 |
| 2054 void Assembler::testw(const Operand& op, Register reg) { |
| 2055 EnsureSpace ensure_space(this); |
| 2056 emit(0x66); |
| 2057 emit_optional_rex_32(reg, op); |
| 2058 emit(0x85); |
| 2059 emit_operand(rax, op); |
| 2060 } |
2017 | 2061 |
2018 void Assembler::emit_test(Register dst, Register src, int size) { | 2062 void Assembler::emit_test(Register dst, Register src, int size) { |
2019 EnsureSpace ensure_space(this); | 2063 EnsureSpace ensure_space(this); |
2020 if (src.low_bits() == 4) { | 2064 if (src.low_bits() == 4) { |
2021 emit_rex(src, dst, size); | 2065 emit_rex(src, dst, size); |
2022 emit(0x85); | 2066 emit(0x85); |
2023 emit_modrm(src, dst); | 2067 emit_modrm(src, dst); |
2024 } else { | 2068 } else { |
2025 emit_rex(dst, src, size); | 2069 emit_rex(dst, src, size); |
2026 emit(0x85); | 2070 emit(0x85); |
(...skipping 2122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4149 | 4193 |
4150 bool RelocInfo::IsInConstantPool() { | 4194 bool RelocInfo::IsInConstantPool() { |
4151 return false; | 4195 return false; |
4152 } | 4196 } |
4153 | 4197 |
4154 | 4198 |
4155 } // namespace internal | 4199 } // namespace internal |
4156 } // namespace v8 | 4200 } // namespace v8 |
4157 | 4201 |
4158 #endif // V8_TARGET_ARCH_X64 | 4202 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |