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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 EnsureSpace ensure_space(this); | 479 EnsureSpace ensure_space(this); |
480 last_pc_ = pc_; | 480 last_pc_ = pc_; |
481 // Opcode: FF /2 r64 | 481 // Opcode: FF /2 r64 |
482 if (adr.code() > 7) { | 482 if (adr.code() > 7) { |
483 emit_rex_64(adr); | 483 emit_rex_64(adr); |
484 } | 484 } |
485 emit(0xFF); | 485 emit(0xFF); |
486 emit_modrm(0x2, adr); | 486 emit_modrm(0x2, adr); |
487 } | 487 } |
488 | 488 |
489 | |
490 void Assembler::cpuid() { | 489 void Assembler::cpuid() { |
491 ASSERT(CpuFeatures::IsEnabled(CpuFeatures::CPUID)); | 490 ASSERT(CpuFeatures::IsEnabled(CpuFeatures::CPUID)); |
492 EnsureSpace ensure_space(this); | 491 EnsureSpace ensure_space(this); |
493 last_pc_ = pc_; | 492 last_pc_ = pc_; |
494 emit(0x0F); | 493 emit(0x0F); |
495 emit(0xA2); | 494 emit(0xA2); |
496 } | 495 } |
497 | 496 |
498 | 497 |
| 498 void Assembler::call(const Operand& op) { |
| 499 EnsureSpace ensure_space(this); |
| 500 last_pc_ = pc_; |
| 501 // Opcode: FF /2 m64 |
| 502 emit_rex_64(op); |
| 503 emit(0xFF); |
| 504 emit_operand(2, op); |
| 505 } |
| 506 |
| 507 |
499 void Assembler::cqo() { | 508 void Assembler::cqo() { |
500 EnsureSpace ensure_space(this); | 509 EnsureSpace ensure_space(this); |
501 last_pc_ = pc_; | 510 last_pc_ = pc_; |
502 emit_rex_64(); | 511 emit_rex_64(); |
503 emit(0x99); | 512 emit(0x99); |
504 } | 513 } |
505 | 514 |
506 | 515 |
507 void Assembler::dec(Register dst) { | 516 void Assembler::dec(Register dst) { |
508 EnsureSpace ensure_space(this); | 517 EnsureSpace ensure_space(this); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 | 688 |
680 void Assembler::lea(Register dst, const Operand& src) { | 689 void Assembler::lea(Register dst, const Operand& src) { |
681 EnsureSpace ensure_space(this); | 690 EnsureSpace ensure_space(this); |
682 last_pc_ = pc_; | 691 last_pc_ = pc_; |
683 emit_rex_64(dst, src); | 692 emit_rex_64(dst, src); |
684 emit(0x8D); | 693 emit(0x8D); |
685 emit_operand(dst, src); | 694 emit_operand(dst, src); |
686 } | 695 } |
687 | 696 |
688 | 697 |
| 698 void Assembler::load_rax(void* value, RelocInfo::Mode mode) { |
| 699 EnsureSpace ensure_space(this); |
| 700 last_pc_ = pc_; |
| 701 emit(0x48); // REX.W |
| 702 emit(0xA1); |
| 703 emitq(reinterpret_cast<uintptr_t>(value), mode); |
| 704 } |
| 705 |
| 706 |
| 707 void Assembler::load_rax(ExternalReference ref) { |
| 708 load_rax(ref.address(), RelocInfo::EXTERNAL_REFERENCE); |
| 709 } |
| 710 |
| 711 |
689 void Assembler::leave() { | 712 void Assembler::leave() { |
690 EnsureSpace ensure_space(this); | 713 EnsureSpace ensure_space(this); |
691 last_pc_ = pc_; | 714 last_pc_ = pc_; |
692 emit(0xC9); | 715 emit(0xC9); |
693 } | 716 } |
694 | 717 |
695 | 718 |
696 void Assembler::movb(Register dst, const Operand& src) { | 719 void Assembler::movb(Register dst, const Operand& src) { |
697 EnsureSpace ensure_space(this); | 720 EnsureSpace ensure_space(this); |
698 last_pc_ = pc_; | 721 last_pc_ = pc_; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 void Assembler::movq(Register dst, Immediate value) { | 799 void Assembler::movq(Register dst, Immediate value) { |
777 EnsureSpace ensure_space(this); | 800 EnsureSpace ensure_space(this); |
778 last_pc_ = pc_; | 801 last_pc_ = pc_; |
779 emit_rex_64(dst); | 802 emit_rex_64(dst); |
780 emit(0xC7); | 803 emit(0xC7); |
781 emit_modrm(0x0, dst); | 804 emit_modrm(0x0, dst); |
782 emit(value); // Only 32-bit immediates are possible, not 8-bit immediates. | 805 emit(value); // Only 32-bit immediates are possible, not 8-bit immediates. |
783 } | 806 } |
784 | 807 |
785 | 808 |
| 809 void Assembler::movq(const Operand& dst, Register src) { |
| 810 EnsureSpace ensure_space(this); |
| 811 last_pc_ = pc_; |
| 812 emit_rex_64(src, dst); |
| 813 emit(0x89); |
| 814 emit_operand(src, dst); |
| 815 } |
| 816 |
| 817 |
| 818 void Assembler::movq(Register dst, void* value, RelocInfo::Mode rmode) { |
| 819 EnsureSpace ensure_space(this); |
| 820 last_pc_ = pc_; |
| 821 emit_rex_64(dst); |
| 822 emit(0xB8 | (dst.code() & 0x7)); |
| 823 emitq(reinterpret_cast<uintptr_t>(value), rmode); |
| 824 } |
| 825 |
| 826 |
786 void Assembler::movq(Register dst, int64_t value, RelocInfo::Mode rmode) { | 827 void Assembler::movq(Register dst, int64_t value, RelocInfo::Mode rmode) { |
787 EnsureSpace ensure_space(this); | 828 EnsureSpace ensure_space(this); |
788 last_pc_ = pc_; | 829 last_pc_ = pc_; |
789 emit_rex_64(dst); | 830 emit_rex_64(dst); |
790 emit(0xB8 | (dst.code() & 0x7)); // Not a ModR/M byte. | 831 emit(0xB8 | (dst.code() & 0x7)); // Not a ModR/M byte. |
791 emitq(value, rmode); | 832 emitq(value, rmode); |
792 } | 833 } |
793 | 834 |
794 | 835 |
795 void Assembler::movq(const Operand& dst, Register src) { | 836 void Assembler::movq(Register dst, ExternalReference ref) { |
796 EnsureSpace ensure_space(this); | 837 EnsureSpace ensure_space(this); |
797 last_pc_ = pc_; | 838 last_pc_ = pc_; |
798 emit_rex_64(src, dst); | 839 emit_rex_64(dst); |
799 emit(0x89); | 840 emit(0xB8 | (dst.code() & 0x7)); |
800 emit_operand(src, dst); | 841 emitq(reinterpret_cast<uintptr_t>(ref.address()), |
| 842 RelocInfo::EXTERNAL_REFERENCE); |
801 } | 843 } |
802 | 844 |
803 | 845 |
804 void Assembler::mul(Register src) { | 846 void Assembler::mul(Register src) { |
805 EnsureSpace ensure_space(this); | 847 EnsureSpace ensure_space(this); |
806 last_pc_ = pc_; | 848 last_pc_ = pc_; |
807 emit_rex_64(src); | 849 emit_rex_64(src); |
808 emit(0xF7); | 850 emit(0xF7); |
809 emit_modrm(0x4, src); | 851 emit_modrm(0x4, src); |
810 } | 852 } |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 emit_rex_64(other); | 1106 emit_rex_64(other); |
1065 emit(0x90 | (other.code() & 0x7)); | 1107 emit(0x90 | (other.code() & 0x7)); |
1066 } else { | 1108 } else { |
1067 emit_rex_64(src, dst); | 1109 emit_rex_64(src, dst); |
1068 emit(0x87); | 1110 emit(0x87); |
1069 emit_modrm(src, dst); | 1111 emit_modrm(src, dst); |
1070 } | 1112 } |
1071 } | 1113 } |
1072 | 1114 |
1073 | 1115 |
| 1116 void Assembler::store_rax(void* dst, RelocInfo::Mode mode) { |
| 1117 EnsureSpace ensure_space(this); |
| 1118 last_pc_ = pc_; |
| 1119 emit(0x48); // REX.W |
| 1120 emit(0xA3); |
| 1121 emitq(reinterpret_cast<uintptr_t>(dst), mode); |
| 1122 } |
| 1123 |
| 1124 |
| 1125 void Assembler::store_rax(ExternalReference ref) { |
| 1126 store_rax(ref.address(), RelocInfo::EXTERNAL_REFERENCE); |
| 1127 } |
| 1128 |
| 1129 |
1074 void Assembler::testb(Register reg, Immediate mask) { | 1130 void Assembler::testb(Register reg, Immediate mask) { |
1075 EnsureSpace ensure_space(this); | 1131 EnsureSpace ensure_space(this); |
1076 last_pc_ = pc_; | 1132 last_pc_ = pc_; |
1077 if (reg.is(rax)) { | 1133 if (reg.is(rax)) { |
1078 emit(0xA8); | 1134 emit(0xA8); |
1079 emit(mask); | 1135 emit(mask); |
1080 } else { | 1136 } else { |
1081 if (reg.code() > 3) { | 1137 if (reg.code() > 3) { |
1082 // Register is not one of al, bl, cl, dl. Its encoding needs REX. | 1138 // Register is not one of al, bl, cl, dl. Its encoding needs REX. |
1083 emit_rex_32(reg); | 1139 emit_rex_32(reg); |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1482 UNIMPLEMENTED(); | 1538 UNIMPLEMENTED(); |
1483 return NULL; | 1539 return NULL; |
1484 } | 1540 } |
1485 | 1541 |
1486 byte* JavaScriptFrame::GetCallerStackPointer() const { | 1542 byte* JavaScriptFrame::GetCallerStackPointer() const { |
1487 UNIMPLEMENTED(); | 1543 UNIMPLEMENTED(); |
1488 return NULL; | 1544 return NULL; |
1489 } | 1545 } |
1490 | 1546 |
1491 } } // namespace v8::internal | 1547 } } // namespace v8::internal |
OLD | NEW |