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 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1298 void Assembler::leal(Register dst, const Operand& src) { | 1298 void Assembler::leal(Register dst, const Operand& src) { |
1299 EnsureSpace ensure_space(this); | 1299 EnsureSpace ensure_space(this); |
1300 emit_optional_rex_32(dst, src); | 1300 emit_optional_rex_32(dst, src); |
1301 emit(0x8D); | 1301 emit(0x8D); |
1302 emit_operand(dst, src); | 1302 emit_operand(dst, src); |
1303 } | 1303 } |
1304 | 1304 |
1305 | 1305 |
1306 void Assembler::load_rax(void* value, RelocInfo::Mode mode) { | 1306 void Assembler::load_rax(void* value, RelocInfo::Mode mode) { |
1307 EnsureSpace ensure_space(this); | 1307 EnsureSpace ensure_space(this); |
1308 emit(0x48); // REX.W | 1308 if (kPointerSize == kInt64Size) { |
1309 emit(0xA1); | 1309 emit(0x48); // REX.W |
1310 emitp(value, mode); | 1310 emit(0xA1); |
| 1311 emitp(value, mode); |
| 1312 } else { |
| 1313 ASSERT(kPointerSize == kInt32Size); |
| 1314 emit(0xA1); |
| 1315 emitp(value, mode); |
| 1316 // In 64-bit mode, need to zero extend the operand to 8 bytes. |
| 1317 // See 2.2.1.4 in Intel64 and IA32 Architectures Software |
| 1318 // Developer's Manual Volume 2. |
| 1319 emitl(0); |
| 1320 } |
1311 } | 1321 } |
1312 | 1322 |
1313 | 1323 |
1314 void Assembler::load_rax(ExternalReference ref) { | 1324 void Assembler::load_rax(ExternalReference ref) { |
1315 load_rax(ref.address(), RelocInfo::EXTERNAL_REFERENCE); | 1325 load_rax(ref.address(), RelocInfo::EXTERNAL_REFERENCE); |
1316 } | 1326 } |
1317 | 1327 |
1318 | 1328 |
1319 void Assembler::leave() { | 1329 void Assembler::leave() { |
1320 EnsureSpace ensure_space(this); | 1330 EnsureSpace ensure_space(this); |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1881 } else { | 1891 } else { |
1882 emit_optional_rex_32(src, dst); | 1892 emit_optional_rex_32(src, dst); |
1883 emit(0x87); | 1893 emit(0x87); |
1884 emit_modrm(src, dst); | 1894 emit_modrm(src, dst); |
1885 } | 1895 } |
1886 } | 1896 } |
1887 | 1897 |
1888 | 1898 |
1889 void Assembler::store_rax(void* dst, RelocInfo::Mode mode) { | 1899 void Assembler::store_rax(void* dst, RelocInfo::Mode mode) { |
1890 EnsureSpace ensure_space(this); | 1900 EnsureSpace ensure_space(this); |
1891 emit(0x48); // REX.W | 1901 if (kPointerSize == kInt64Size) { |
1892 emit(0xA3); | 1902 emit(0x48); // REX.W |
1893 emitp(dst, mode); | 1903 emit(0xA3); |
| 1904 emitp(dst, mode); |
| 1905 } else { |
| 1906 ASSERT(kPointerSize == kInt32Size); |
| 1907 emit(0xA3); |
| 1908 emitp(dst, mode); |
| 1909 // In 64-bit mode, need to zero extend the operand to 8 bytes. |
| 1910 // See 2.2.1.4 in Intel64 and IA32 Architectures Software |
| 1911 // Developer's Manual Volume 2. |
| 1912 emitl(0); |
| 1913 } |
1894 } | 1914 } |
1895 | 1915 |
1896 | 1916 |
1897 void Assembler::store_rax(ExternalReference ref) { | 1917 void Assembler::store_rax(ExternalReference ref) { |
1898 store_rax(ref.address(), RelocInfo::EXTERNAL_REFERENCE); | 1918 store_rax(ref.address(), RelocInfo::EXTERNAL_REFERENCE); |
1899 } | 1919 } |
1900 | 1920 |
1901 | 1921 |
1902 void Assembler::testb(Register dst, Register src) { | 1922 void Assembler::testb(Register dst, Register src) { |
1903 EnsureSpace ensure_space(this); | 1923 EnsureSpace ensure_space(this); |
(...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3161 bool RelocInfo::IsCodedSpecially() { | 3181 bool RelocInfo::IsCodedSpecially() { |
3162 // The deserializer needs to know whether a pointer is specially coded. Being | 3182 // The deserializer needs to know whether a pointer is specially coded. Being |
3163 // specially coded on x64 means that it is a relative 32 bit address, as used | 3183 // specially coded on x64 means that it is a relative 32 bit address, as used |
3164 // by branch instructions. | 3184 // by branch instructions. |
3165 return (1 << rmode_) & kApplyMask; | 3185 return (1 << rmode_) & kApplyMask; |
3166 } | 3186 } |
3167 | 3187 |
3168 } } // namespace v8::internal | 3188 } } // namespace v8::internal |
3169 | 3189 |
3170 #endif // V8_TARGET_ARCH_X64 | 3190 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |