| OLD | NEW |
| 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
| 2 // All Rights Reserved. | 2 // All Rights Reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions | 5 // modification, are permitted provided that the following conditions |
| 6 // are met: | 6 // are met: |
| 7 // | 7 // |
| 8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
| 9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
| 10 // | 10 // |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 | 538 |
| 539 | 539 |
| 540 void Assembler::pop(const Operand& dst) { | 540 void Assembler::pop(const Operand& dst) { |
| 541 EnsureSpace ensure_space(this); | 541 EnsureSpace ensure_space(this); |
| 542 last_pc_ = pc_; | 542 last_pc_ = pc_; |
| 543 EMIT(0x8F); | 543 EMIT(0x8F); |
| 544 emit_operand(eax, dst); | 544 emit_operand(eax, dst); |
| 545 } | 545 } |
| 546 | 546 |
| 547 | 547 |
| 548 void Assembler::enter(const Immediate& size) { |
| 549 EnsureSpace ensure_space(this); |
| 550 last_pc_ = pc_; |
| 551 EMIT(0xC8); |
| 552 emit_w(size); |
| 553 EMIT(0); |
| 554 } |
| 555 |
| 556 |
| 557 void Assembler::leave() { |
| 558 EnsureSpace ensure_space(this); |
| 559 last_pc_ = pc_; |
| 560 EMIT(0xC9); |
| 561 } |
| 562 |
| 563 |
| 548 void Assembler::mov_b(Register dst, const Operand& src) { | 564 void Assembler::mov_b(Register dst, const Operand& src) { |
| 549 EnsureSpace ensure_space(this); | 565 EnsureSpace ensure_space(this); |
| 550 last_pc_ = pc_; | 566 last_pc_ = pc_; |
| 551 EMIT(0x8A); | 567 EMIT(0x8A); |
| 552 emit_operand(dst, src); | 568 emit_operand(dst, src); |
| 553 } | 569 } |
| 554 | 570 |
| 555 | 571 |
| 556 void Assembler::mov_b(const Operand& dst, int8_t imm8) { | 572 void Assembler::mov_b(const Operand& dst, int8_t imm8) { |
| 557 EnsureSpace ensure_space(this); | 573 EnsureSpace ensure_space(this); |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 } | 838 } |
| 823 | 839 |
| 824 | 840 |
| 825 void Assembler::cmp(const Operand& op, const Immediate& imm) { | 841 void Assembler::cmp(const Operand& op, const Immediate& imm) { |
| 826 EnsureSpace ensure_space(this); | 842 EnsureSpace ensure_space(this); |
| 827 last_pc_ = pc_; | 843 last_pc_ = pc_; |
| 828 emit_arith(7, op, imm); | 844 emit_arith(7, op, imm); |
| 829 } | 845 } |
| 830 | 846 |
| 831 | 847 |
| 848 void Assembler::rep_cmpsb() { |
| 849 EnsureSpace ensure_space(this); |
| 850 last_pc_ = pc_; |
| 851 EMIT(0xFC); // CLD to ensure forward operation |
| 852 EMIT(0xF3); // REP |
| 853 EMIT(0xA6); // CMPSB |
| 854 } |
| 855 |
| 856 void Assembler::rep_cmpsw() { |
| 857 EnsureSpace ensure_space(this); |
| 858 last_pc_ = pc_; |
| 859 EMIT(0xFC); // CLD to ensure forward operation |
| 860 EMIT(0xF3); // REP |
| 861 EMIT(0xA7); // CMPSW |
| 862 } |
| 863 |
| 864 |
| 832 void Assembler::dec_b(Register dst) { | 865 void Assembler::dec_b(Register dst) { |
| 833 EnsureSpace ensure_space(this); | 866 EnsureSpace ensure_space(this); |
| 834 last_pc_ = pc_; | 867 last_pc_ = pc_; |
| 835 EMIT(0xFE); | 868 EMIT(0xFE); |
| 836 EMIT(0xC8 | dst.code()); | 869 EMIT(0xC8 | dst.code()); |
| 837 } | 870 } |
| 838 | 871 |
| 839 | 872 |
| 840 void Assembler::dec(Register dst) { | 873 void Assembler::dec(Register dst) { |
| 841 EnsureSpace ensure_space(this); | 874 EnsureSpace ensure_space(this); |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1163 } | 1196 } |
| 1164 | 1197 |
| 1165 | 1198 |
| 1166 void Assembler::xor_(const Operand& dst, const Immediate& x) { | 1199 void Assembler::xor_(const Operand& dst, const Immediate& x) { |
| 1167 EnsureSpace ensure_space(this); | 1200 EnsureSpace ensure_space(this); |
| 1168 last_pc_ = pc_; | 1201 last_pc_ = pc_; |
| 1169 emit_arith(6, dst, x); | 1202 emit_arith(6, dst, x); |
| 1170 } | 1203 } |
| 1171 | 1204 |
| 1172 | 1205 |
| 1206 void Assembler::bt(const Operand& dst, Register src) { |
| 1207 EnsureSpace ensure_space(this); |
| 1208 last_pc_ = pc_; |
| 1209 EMIT(0x0F); |
| 1210 EMIT(0xA3); |
| 1211 emit_operand(src, dst); |
| 1212 } |
| 1213 |
| 1214 |
| 1173 void Assembler::bts(const Operand& dst, Register src) { | 1215 void Assembler::bts(const Operand& dst, Register src) { |
| 1174 EnsureSpace ensure_space(this); | 1216 EnsureSpace ensure_space(this); |
| 1175 last_pc_ = pc_; | 1217 last_pc_ = pc_; |
| 1176 EMIT(0x0F); | 1218 EMIT(0x0F); |
| 1177 EMIT(0xAB); | 1219 EMIT(0xAB); |
| 1178 emit_operand(src, dst); | 1220 emit_operand(src, dst); |
| 1179 } | 1221 } |
| 1180 | 1222 |
| 1181 | 1223 |
| 1182 void Assembler::hlt() { | 1224 void Assembler::hlt() { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 if (imm16 == 0) { | 1258 if (imm16 == 0) { |
| 1217 EMIT(0xC3); | 1259 EMIT(0xC3); |
| 1218 } else { | 1260 } else { |
| 1219 EMIT(0xC2); | 1261 EMIT(0xC2); |
| 1220 EMIT(imm16 & 0xFF); | 1262 EMIT(imm16 & 0xFF); |
| 1221 EMIT((imm16 >> 8) & 0xFF); | 1263 EMIT((imm16 >> 8) & 0xFF); |
| 1222 } | 1264 } |
| 1223 } | 1265 } |
| 1224 | 1266 |
| 1225 | 1267 |
| 1226 void Assembler::leave() { | |
| 1227 EnsureSpace ensure_space(this); | |
| 1228 last_pc_ = pc_; | |
| 1229 EMIT(0xC9); | |
| 1230 } | |
| 1231 | |
| 1232 | |
| 1233 // Labels refer to positions in the (to be) generated code. | 1268 // Labels refer to positions in the (to be) generated code. |
| 1234 // There are bound, linked, and unused labels. | 1269 // There are bound, linked, and unused labels. |
| 1235 // | 1270 // |
| 1236 // Bound labels refer to known positions in the already | 1271 // Bound labels refer to known positions in the already |
| 1237 // generated code. pos() is the position the label refers to. | 1272 // generated code. pos() is the position the label refers to. |
| 1238 // | 1273 // |
| 1239 // Linked labels refer to unknown positions in the code | 1274 // Linked labels refer to unknown positions in the code |
| 1240 // to be generated; pos() is the position of the 32bit | 1275 // to be generated; pos() is the position of the 32bit |
| 1241 // Displacement of the last instruction using the label. | 1276 // Displacement of the last instruction using the label. |
| 1242 | 1277 |
| (...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2063 ASSERT(bound_label.is_bound()); | 2098 ASSERT(bound_label.is_bound()); |
| 2064 ASSERT(0 <= position); | 2099 ASSERT(0 <= position); |
| 2065 ASSERT(position + static_cast<int>(sizeof(uint32_t)) <= pc_offset()); | 2100 ASSERT(position + static_cast<int>(sizeof(uint32_t)) <= pc_offset()); |
| 2066 ASSERT(long_at(position) == 0); // only initialize once! | 2101 ASSERT(long_at(position) == 0); // only initialize once! |
| 2067 | 2102 |
| 2068 uint32_t label_loc = reinterpret_cast<uint32_t>(addr_at(bound_label.pos())); | 2103 uint32_t label_loc = reinterpret_cast<uint32_t>(addr_at(bound_label.pos())); |
| 2069 long_at_put(position, label_loc); | 2104 long_at_put(position, label_loc); |
| 2070 } | 2105 } |
| 2071 | 2106 |
| 2072 } } // namespace v8::internal | 2107 } } // namespace v8::internal |
| OLD | NEW |