OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1023 void Assembler::imull(Register dst, Register src) { | 1023 void Assembler::imull(Register dst, Register src) { |
1024 EnsureSpace ensure_space(this); | 1024 EnsureSpace ensure_space(this); |
1025 last_pc_ = pc_; | 1025 last_pc_ = pc_; |
1026 emit_optional_rex_32(dst, src); | 1026 emit_optional_rex_32(dst, src); |
1027 emit(0x0F); | 1027 emit(0x0F); |
1028 emit(0xAF); | 1028 emit(0xAF); |
1029 emit_modrm(dst, src); | 1029 emit_modrm(dst, src); |
1030 } | 1030 } |
1031 | 1031 |
1032 | 1032 |
| 1033 void Assembler::imull(Register dst, Register src, Immediate imm) { |
| 1034 EnsureSpace ensure_space(this); |
| 1035 last_pc_ = pc_; |
| 1036 emit_optional_rex_32(dst, src); |
| 1037 if (is_int8(imm.value_)) { |
| 1038 emit(0x6B); |
| 1039 emit_modrm(dst, src); |
| 1040 emit(imm.value_); |
| 1041 } else { |
| 1042 emit(0x69); |
| 1043 emit_modrm(dst, src); |
| 1044 emitl(imm.value_); |
| 1045 } |
| 1046 } |
| 1047 |
| 1048 |
1033 void Assembler::incq(Register dst) { | 1049 void Assembler::incq(Register dst) { |
1034 EnsureSpace ensure_space(this); | 1050 EnsureSpace ensure_space(this); |
1035 last_pc_ = pc_; | 1051 last_pc_ = pc_; |
1036 emit_rex_64(dst); | 1052 emit_rex_64(dst); |
1037 emit(0xFF); | 1053 emit(0xFF); |
1038 emit_modrm(0x0, dst); | 1054 emit_modrm(0x0, dst); |
1039 } | 1055 } |
1040 | 1056 |
1041 | 1057 |
1042 void Assembler::incq(const Operand& dst) { | 1058 void Assembler::incq(const Operand& dst) { |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1183 | 1199 |
1184 void Assembler::lea(Register dst, const Operand& src) { | 1200 void Assembler::lea(Register dst, const Operand& src) { |
1185 EnsureSpace ensure_space(this); | 1201 EnsureSpace ensure_space(this); |
1186 last_pc_ = pc_; | 1202 last_pc_ = pc_; |
1187 emit_rex_64(dst, src); | 1203 emit_rex_64(dst, src); |
1188 emit(0x8D); | 1204 emit(0x8D); |
1189 emit_operand(dst, src); | 1205 emit_operand(dst, src); |
1190 } | 1206 } |
1191 | 1207 |
1192 | 1208 |
| 1209 void Assembler::leal(Register dst, const Operand& src) { |
| 1210 EnsureSpace ensure_space(this); |
| 1211 last_pc_ = pc_; |
| 1212 emit_optional_rex_32(dst, src); |
| 1213 emit(0x8D); |
| 1214 emit_operand(dst, src); |
| 1215 } |
| 1216 |
| 1217 |
1193 void Assembler::load_rax(void* value, RelocInfo::Mode mode) { | 1218 void Assembler::load_rax(void* value, RelocInfo::Mode mode) { |
1194 EnsureSpace ensure_space(this); | 1219 EnsureSpace ensure_space(this); |
1195 last_pc_ = pc_; | 1220 last_pc_ = pc_; |
1196 emit(0x48); // REX.W | 1221 emit(0x48); // REX.W |
1197 emit(0xA1); | 1222 emit(0xA1); |
1198 emitq(reinterpret_cast<uintptr_t>(value), mode); | 1223 emitq(reinterpret_cast<uintptr_t>(value), mode); |
1199 } | 1224 } |
1200 | 1225 |
1201 | 1226 |
1202 void Assembler::load_rax(ExternalReference ref) { | 1227 void Assembler::load_rax(ExternalReference ref) { |
1203 load_rax(ref.address(), RelocInfo::EXTERNAL_REFERENCE); | 1228 load_rax(ref.address(), RelocInfo::EXTERNAL_REFERENCE); |
1204 } | 1229 } |
1205 | 1230 |
1206 | 1231 |
1207 void Assembler::leave() { | 1232 void Assembler::leave() { |
1208 EnsureSpace ensure_space(this); | 1233 EnsureSpace ensure_space(this); |
1209 last_pc_ = pc_; | 1234 last_pc_ = pc_; |
1210 emit(0xC9); | 1235 emit(0xC9); |
1211 } | 1236 } |
1212 | 1237 |
1213 | 1238 |
1214 void Assembler::movb(Register dst, const Operand& src) { | 1239 void Assembler::movb(Register dst, const Operand& src) { |
1215 EnsureSpace ensure_space(this); | 1240 EnsureSpace ensure_space(this); |
1216 last_pc_ = pc_; | 1241 last_pc_ = pc_; |
1217 emit_rex_32(dst, src); | 1242 emit_rex_32(dst, src); |
1218 emit(0x8A); | 1243 emit(0x8A); |
1219 emit_operand(dst, src); | 1244 emit_operand(dst, src); |
1220 } | 1245 } |
1221 | 1246 |
| 1247 |
1222 void Assembler::movb(Register dst, Immediate imm) { | 1248 void Assembler::movb(Register dst, Immediate imm) { |
1223 EnsureSpace ensure_space(this); | 1249 EnsureSpace ensure_space(this); |
1224 last_pc_ = pc_; | 1250 last_pc_ = pc_; |
1225 emit_rex_32(dst); | 1251 emit_rex_32(dst); |
1226 emit(0xC6); | 1252 emit(0xC6); |
1227 emit_modrm(0x0, dst); | 1253 emit_modrm(0x0, dst); |
1228 emit(imm.value_); | 1254 emit(imm.value_); |
1229 } | 1255 } |
1230 | 1256 |
| 1257 |
1231 void Assembler::movb(const Operand& dst, Register src) { | 1258 void Assembler::movb(const Operand& dst, Register src) { |
1232 EnsureSpace ensure_space(this); | 1259 EnsureSpace ensure_space(this); |
1233 last_pc_ = pc_; | 1260 last_pc_ = pc_; |
1234 emit_rex_32(src, dst); | 1261 emit_rex_32(src, dst); |
1235 emit(0x88); | 1262 emit(0x88); |
1236 emit_operand(src, dst); | 1263 emit_operand(src, dst); |
1237 } | 1264 } |
1238 | 1265 |
| 1266 |
1239 void Assembler::movw(const Operand& dst, Register src) { | 1267 void Assembler::movw(const Operand& dst, Register src) { |
1240 EnsureSpace ensure_space(this); | 1268 EnsureSpace ensure_space(this); |
1241 last_pc_ = pc_; | 1269 last_pc_ = pc_; |
1242 emit(0x66); | 1270 emit(0x66); |
1243 emit_optional_rex_32(src, dst); | 1271 emit_optional_rex_32(src, dst); |
1244 emit(0x89); | 1272 emit(0x89); |
1245 emit_operand(src, dst); | 1273 emit_operand(src, dst); |
1246 } | 1274 } |
1247 | 1275 |
| 1276 |
1248 void Assembler::movl(Register dst, const Operand& src) { | 1277 void Assembler::movl(Register dst, const Operand& src) { |
1249 EnsureSpace ensure_space(this); | 1278 EnsureSpace ensure_space(this); |
1250 last_pc_ = pc_; | 1279 last_pc_ = pc_; |
1251 emit_optional_rex_32(dst, src); | 1280 emit_optional_rex_32(dst, src); |
1252 emit(0x8B); | 1281 emit(0x8B); |
1253 emit_operand(dst, src); | 1282 emit_operand(dst, src); |
1254 } | 1283 } |
1255 | 1284 |
1256 | 1285 |
1257 void Assembler::movl(Register dst, Register src) { | 1286 void Assembler::movl(Register dst, Register src) { |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1593 | 1622 |
1594 void Assembler::not_(const Operand& dst) { | 1623 void Assembler::not_(const Operand& dst) { |
1595 EnsureSpace ensure_space(this); | 1624 EnsureSpace ensure_space(this); |
1596 last_pc_ = pc_; | 1625 last_pc_ = pc_; |
1597 emit_rex_64(dst); | 1626 emit_rex_64(dst); |
1598 emit(0xF7); | 1627 emit(0xF7); |
1599 emit_operand(2, dst); | 1628 emit_operand(2, dst); |
1600 } | 1629 } |
1601 | 1630 |
1602 | 1631 |
| 1632 void Assembler::notl(Register dst) { |
| 1633 EnsureSpace ensure_space(this); |
| 1634 last_pc_ = pc_; |
| 1635 emit_optional_rex_32(dst); |
| 1636 emit(0xF7); |
| 1637 emit_modrm(0x2, dst); |
| 1638 } |
| 1639 |
| 1640 |
1603 void Assembler::nop(int n) { | 1641 void Assembler::nop(int n) { |
1604 // The recommended muti-byte sequences of NOP instructions from the Intel 64 | 1642 // The recommended muti-byte sequences of NOP instructions from the Intel 64 |
1605 // and IA-32 Architectures Software Developer's Manual. | 1643 // and IA-32 Architectures Software Developer's Manual. |
1606 // | 1644 // |
1607 // Length Assembly Byte Sequence | 1645 // Length Assembly Byte Sequence |
1608 // 2 bytes 66 NOP 66 90H | 1646 // 2 bytes 66 NOP 66 90H |
1609 // 3 bytes NOP DWORD ptr [EAX] 0F 1F 00H | 1647 // 3 bytes NOP DWORD ptr [EAX] 0F 1F 00H |
1610 // 4 bytes NOP DWORD ptr [EAX + 00H] 0F 1F 40 00H | 1648 // 4 bytes NOP DWORD ptr [EAX + 00H] 0F 1F 40 00H |
1611 // 5 bytes NOP DWORD ptr [EAX + EAX*1 + 00H] 0F 1F 44 00 00H | 1649 // 5 bytes NOP DWORD ptr [EAX + EAX*1 + 00H] 0F 1F 44 00 00H |
1612 // 6 bytes 66 NOP DWORD ptr [EAX + EAX*1 + 00H] 66 0F 1F 44 00 00H | 1650 // 6 bytes 66 NOP DWORD ptr [EAX + EAX*1 + 00H] 66 0F 1F 44 00 00H |
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2588 written_position_ = current_position_; | 2626 written_position_ = current_position_; |
2589 } | 2627 } |
2590 } | 2628 } |
2591 | 2629 |
2592 | 2630 |
2593 const int RelocInfo::kApplyMask = RelocInfo::kCodeTargetMask | | 2631 const int RelocInfo::kApplyMask = RelocInfo::kCodeTargetMask | |
2594 1 << RelocInfo::INTERNAL_REFERENCE | | 2632 1 << RelocInfo::INTERNAL_REFERENCE | |
2595 1 << RelocInfo::JS_RETURN; | 2633 1 << RelocInfo::JS_RETURN; |
2596 | 2634 |
2597 } } // namespace v8::internal | 2635 } } // namespace v8::internal |
OLD | NEW |