Chromium Code Reviews| 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 1961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1972 | 1972 |
| 1973 | 1973 |
| 1974 void Assembler::shrd(Register dst, Register src) { | 1974 void Assembler::shrd(Register dst, Register src) { |
| 1975 EnsureSpace ensure_space(this); | 1975 EnsureSpace ensure_space(this); |
| 1976 emit_rex_64(src, dst); | 1976 emit_rex_64(src, dst); |
| 1977 emit(0x0F); | 1977 emit(0x0F); |
| 1978 emit(0xAD); | 1978 emit(0xAD); |
| 1979 emit_modrm(src, dst); | 1979 emit_modrm(src, dst); |
| 1980 } | 1980 } |
| 1981 | 1981 |
| 1982 void Assembler::xchgb(Register reg, const Operand& op) { | 1982 void Assembler::xchgb(Register reg, const Operand& op, bool is_signed) { |
| 1983 EnsureSpace ensure_space(this); | 1983 EnsureSpace ensure_space(this); |
| 1984 if (!reg.is_byte_register()) { | 1984 if (!reg.is_byte_register()) { |
| 1985 // Register is not one of al, bl, cl, dl. Its encoding needs REX. | 1985 // Register is not one of al, bl, cl, dl. Its encoding needs REX. |
| 1986 emit_rex_32(reg, op); | 1986 emit_rex_32(reg, op); |
| 1987 } else { | 1987 } else { |
| 1988 emit_optional_rex_32(reg, op); | 1988 emit_optional_rex_32(reg, op); |
| 1989 } | 1989 } |
| 1990 emit(0x86); | 1990 emit(0x86); |
| 1991 emit_operand(reg, op); | 1991 emit_operand(reg, op); |
| 1992 if (is_signed) { | |
|
binji
2017/01/17 21:45:50
This is the wrong place to put this code; the asse
aseemgarg
2017/01/21 08:40:37
Removed. Moved the move part upstream in code-gene
| |
| 1993 movsxbl(reg, reg); | |
| 1994 } else { | |
| 1995 movzxbl(reg, reg); | |
| 1996 } | |
| 1992 } | 1997 } |
| 1993 | 1998 |
| 1994 void Assembler::xchgw(Register reg, const Operand& op) { | 1999 void Assembler::xchgw(Register reg, const Operand& op, bool is_signed) { |
| 1995 EnsureSpace ensure_space(this); | 2000 EnsureSpace ensure_space(this); |
| 1996 emit(0x66); | 2001 emit(0x66); |
| 1997 emit_optional_rex_32(reg, op); | 2002 emit_optional_rex_32(reg, op); |
| 1998 emit(0x87); | 2003 emit(0x87); |
| 1999 emit_operand(reg, op); | 2004 emit_operand(reg, op); |
| 2005 if (is_signed) { | |
| 2006 movsxwl(reg, reg); | |
| 2007 } else { | |
| 2008 movzxwl(reg, reg); | |
| 2009 } | |
| 2000 } | 2010 } |
| 2001 | 2011 |
| 2002 void Assembler::emit_xchg(Register dst, Register src, int size) { | 2012 void Assembler::emit_xchg(Register dst, Register src, int size) { |
| 2003 EnsureSpace ensure_space(this); | 2013 EnsureSpace ensure_space(this); |
| 2004 if (src.is(rax) || dst.is(rax)) { // Single-byte encoding | 2014 if (src.is(rax) || dst.is(rax)) { // Single-byte encoding |
| 2005 Register other = src.is(rax) ? dst : src; | 2015 Register other = src.is(rax) ? dst : src; |
| 2006 emit_rex(other, size); | 2016 emit_rex(other, size); |
| 2007 emit(0x90 | other.low_bits()); | 2017 emit(0x90 | other.low_bits()); |
| 2008 } else if (dst.low_bits() == 4) { | 2018 } else if (dst.low_bits() == 4) { |
| 2009 emit_rex(dst, src, size); | 2019 emit_rex(dst, src, size); |
| (...skipping 2752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4762 | 4772 |
| 4763 bool RelocInfo::IsInConstantPool() { | 4773 bool RelocInfo::IsInConstantPool() { |
| 4764 return false; | 4774 return false; |
| 4765 } | 4775 } |
| 4766 | 4776 |
| 4767 | 4777 |
| 4768 } // namespace internal | 4778 } // namespace internal |
| 4769 } // namespace v8 | 4779 } // namespace v8 |
| 4770 | 4780 |
| 4771 #endif // V8_TARGET_ARCH_X64 | 4781 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |