| 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 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 EnsureSpace ensure_space(this); | 774 EnsureSpace ensure_space(this); |
| 775 last_pc_ = pc_; | 775 last_pc_ = pc_; |
| 776 emit_arith(4, dst, x); | 776 emit_arith(4, dst, x); |
| 777 } | 777 } |
| 778 | 778 |
| 779 | 779 |
| 780 void Assembler::and_(const Operand& dst, Register src) { | 780 void Assembler::and_(const Operand& dst, Register src) { |
| 781 EnsureSpace ensure_space(this); | 781 EnsureSpace ensure_space(this); |
| 782 last_pc_ = pc_; | 782 last_pc_ = pc_; |
| 783 EMIT(0x21); | 783 EMIT(0x21); |
| 784 emit_operand(dst, src); | 784 emit_operand(src, dst); |
| 785 } | 785 } |
| 786 | 786 |
| 787 | 787 |
| 788 void Assembler::cmp(Register reg, int32_t imm32) { | 788 void Assembler::cmp(Register reg, int32_t imm32) { |
| 789 EnsureSpace ensure_space(this); | 789 EnsureSpace ensure_space(this); |
| 790 last_pc_ = pc_; | 790 last_pc_ = pc_; |
| 791 emit_arith(7, Operand(reg), Immediate(imm32)); | 791 emit_arith(7, Operand(reg), Immediate(imm32)); |
| 792 } | 792 } |
| 793 | 793 |
| 794 | 794 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 EnsureSpace ensure_space(this); | 942 EnsureSpace ensure_space(this); |
| 943 last_pc_ = pc_; | 943 last_pc_ = pc_; |
| 944 emit_arith(1, dst, x); | 944 emit_arith(1, dst, x); |
| 945 } | 945 } |
| 946 | 946 |
| 947 | 947 |
| 948 void Assembler::or_(const Operand& dst, Register src) { | 948 void Assembler::or_(const Operand& dst, Register src) { |
| 949 EnsureSpace ensure_space(this); | 949 EnsureSpace ensure_space(this); |
| 950 last_pc_ = pc_; | 950 last_pc_ = pc_; |
| 951 EMIT(0x09); | 951 EMIT(0x09); |
| 952 emit_operand(dst, src); | 952 emit_operand(src, dst); |
| 953 } | 953 } |
| 954 | 954 |
| 955 | 955 |
| 956 void Assembler::rcl(Register dst, uint8_t imm8) { | 956 void Assembler::rcl(Register dst, uint8_t imm8) { |
| 957 EnsureSpace ensure_space(this); | 957 EnsureSpace ensure_space(this); |
| 958 last_pc_ = pc_; | 958 last_pc_ = pc_; |
| 959 ASSERT(is_uint5(imm8)); // illegal shift count | 959 ASSERT(is_uint5(imm8)); // illegal shift count |
| 960 if (imm8 == 1) { | 960 if (imm8 == 1) { |
| 961 EMIT(0xD1); | 961 EMIT(0xD1); |
| 962 EMIT(0xD0 | dst.code()); | 962 EMIT(0xD0 | dst.code()); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1070 last_pc_ = pc_; | 1070 last_pc_ = pc_; |
| 1071 EMIT(0x2B); | 1071 EMIT(0x2B); |
| 1072 emit_operand(dst, src); | 1072 emit_operand(dst, src); |
| 1073 } | 1073 } |
| 1074 | 1074 |
| 1075 | 1075 |
| 1076 void Assembler::sub(const Operand& dst, Register src) { | 1076 void Assembler::sub(const Operand& dst, Register src) { |
| 1077 EnsureSpace ensure_space(this); | 1077 EnsureSpace ensure_space(this); |
| 1078 last_pc_ = pc_; | 1078 last_pc_ = pc_; |
| 1079 EMIT(0x29); | 1079 EMIT(0x29); |
| 1080 emit_operand(dst, src); | 1080 emit_operand(src, dst); |
| 1081 } | 1081 } |
| 1082 | 1082 |
| 1083 | 1083 |
| 1084 void Assembler::test(Register reg, const Immediate& imm) { | 1084 void Assembler::test(Register reg, const Immediate& imm) { |
| 1085 EnsureSpace ensure_space(this); | 1085 EnsureSpace ensure_space(this); |
| 1086 last_pc_ = pc_; | 1086 last_pc_ = pc_; |
| 1087 // Only use test against byte for registers that have a byte | 1087 // Only use test against byte for registers that have a byte |
| 1088 // variant: eax, ebx, ecx, and edx. | 1088 // variant: eax, ebx, ecx, and edx. |
| 1089 if (imm.rmode_ == RelocInfo::NONE && is_uint8(imm.x_) && reg.code() < 4) { | 1089 if (imm.rmode_ == RelocInfo::NONE && is_uint8(imm.x_) && reg.code() < 4) { |
| 1090 uint8_t imm8 = imm.x_; | 1090 uint8_t imm8 = imm.x_; |
| (...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2010 memmove(pc_, adr.buf_, adr.len_); | 2010 memmove(pc_, adr.buf_, adr.len_); |
| 2011 pc_ += adr.len_; | 2011 pc_ += adr.len_; |
| 2012 if (adr.len_ >= sizeof(int32_t) && adr.rmode_ != RelocInfo::NONE) { | 2012 if (adr.len_ >= sizeof(int32_t) && adr.rmode_ != RelocInfo::NONE) { |
| 2013 pc_ -= sizeof(int32_t); // pc_ must be *at* disp32 | 2013 pc_ -= sizeof(int32_t); // pc_ must be *at* disp32 |
| 2014 RecordRelocInfo(adr.rmode_); | 2014 RecordRelocInfo(adr.rmode_); |
| 2015 pc_ += sizeof(int32_t); | 2015 pc_ += sizeof(int32_t); |
| 2016 } | 2016 } |
| 2017 } | 2017 } |
| 2018 | 2018 |
| 2019 | 2019 |
| 2020 void Assembler::emit_operand(const Operand& adr, Register reg) { | |
| 2021 adr.set_reg(reg); | |
| 2022 memmove(pc_, adr.buf_, adr.len_); | |
| 2023 pc_ += adr.len_; | |
| 2024 if (adr.len_ >= sizeof(int32_t) && adr.rmode_ != RelocInfo::NONE) { | |
| 2025 pc_ -= sizeof(int32_t); // pc_ must be *at* disp32 | |
| 2026 RecordRelocInfo(adr.rmode_); | |
| 2027 pc_ += sizeof(int32_t); | |
| 2028 } | |
| 2029 } | |
| 2030 | |
| 2031 | |
| 2032 void Assembler::emit_farith(int b1, int b2, int i) { | 2020 void Assembler::emit_farith(int b1, int b2, int i) { |
| 2033 ASSERT(is_uint8(b1) && is_uint8(b2)); // wrong opcode | 2021 ASSERT(is_uint8(b1) && is_uint8(b2)); // wrong opcode |
| 2034 ASSERT(0 <= i && i < 8); // illegal stack offset | 2022 ASSERT(0 <= i && i < 8); // illegal stack offset |
| 2035 EMIT(b1); | 2023 EMIT(b1); |
| 2036 EMIT(b2 + i); | 2024 EMIT(b2 + i); |
| 2037 } | 2025 } |
| 2038 | 2026 |
| 2039 | 2027 |
| 2040 void Assembler::dd(uint32_t data, RelocInfo::Mode reloc_info) { | 2028 void Assembler::dd(uint32_t data, RelocInfo::Mode reloc_info) { |
| 2041 EnsureSpace ensure_space(this); | 2029 EnsureSpace ensure_space(this); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2060 ASSERT(bound_label.is_bound()); | 2048 ASSERT(bound_label.is_bound()); |
| 2061 ASSERT(0 <= position); | 2049 ASSERT(0 <= position); |
| 2062 ASSERT(position + static_cast<int>(sizeof(uint32_t)) <= pc_offset()); | 2050 ASSERT(position + static_cast<int>(sizeof(uint32_t)) <= pc_offset()); |
| 2063 ASSERT(long_at(position) == 0); // only initialize once! | 2051 ASSERT(long_at(position) == 0); // only initialize once! |
| 2064 | 2052 |
| 2065 uint32_t label_loc = reinterpret_cast<uint32_t>(addr_at(bound_label.pos())); | 2053 uint32_t label_loc = reinterpret_cast<uint32_t>(addr_at(bound_label.pos())); |
| 2066 long_at_put(position, label_loc); | 2054 long_at_put(position, label_loc); |
| 2067 } | 2055 } |
| 2068 | 2056 |
| 2069 } } // namespace v8::internal | 2057 } } // namespace v8::internal |
| OLD | NEW |