| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 } | 49 } |
| 50 | 50 |
| 51 | 51 |
| 52 void Assembler::emitq(uint64_t x, RelocInfo::Mode rmode) { | 52 void Assembler::emitq(uint64_t x, RelocInfo::Mode rmode) { |
| 53 Memory::uint64_at(pc_) = x; | 53 Memory::uint64_at(pc_) = x; |
| 54 RecordRelocInfo(rmode, x); | 54 RecordRelocInfo(rmode, x); |
| 55 } | 55 } |
| 56 | 56 |
| 57 | 57 |
| 58 // High bit of reg goes to REX.R, high bit of rm_reg goes to REX.B. | 58 // High bit of reg goes to REX.R, high bit of rm_reg goes to REX.B. |
| 59 // REX.W is set. | 59 // REX.W is set. REX.X is cleared. |
| 60 void Assembler::emit_rex_64(Register reg, Register rm_reg) { | 60 void Assembler::emit_rex_64(Register reg, Register rm_reg) { |
| 61 emit(0x48 | (reg.code() & 0x8) >> 1 | rm_reg.code() >> 3); | 61 emit(0x48 | (reg.code() & 0x8) >> 1 | rm_reg.code() >> 3); |
| 62 } | 62 } |
| 63 | 63 |
| 64 | 64 |
| 65 // The high bit of reg is used for REX.R, the high bit of op's base | 65 // The high bit of reg is used for REX.R, the high bit of op's base |
| 66 // register is used for REX.B, and the high bit of op's index register | 66 // register is used for REX.B, and the high bit of op's index register |
| 67 // is used for REX.X. REX.W is set. | 67 // is used for REX.X. REX.W is set. |
| 68 void Assembler::emit_rex_64(Register reg, const Operand& op) { | 68 void Assembler::emit_rex_64(Register reg, const Operand& op) { |
| 69 emit(0x48 | (reg.code() & 0x8) >> 1 | op.rex_); | 69 emit(0x48 | (reg.code() & 0x8) >> 1 | op.rex_); |
| 70 } | 70 } |
| 71 | 71 |
| 72 | 72 |
| 73 // High bit of reg goes to REX.R, high bit of rm_reg goes to REX.B. |
| 74 // REX.W is set. REX.X is cleared. |
| 75 void Assembler::emit_rex_32(Register reg, Register rm_reg) { |
| 76 emit(0x40 | (reg.code() & 0x8) >> 1 | rm_reg.code() >> 3); |
| 77 } |
| 78 |
| 79 |
| 80 // The high bit of reg is used for REX.R, the high bit of op's base |
| 81 // register is used for REX.B, and the high bit of op's index register |
| 82 // is used for REX.X. REX.W is cleared. |
| 83 void Assembler::emit_rex_32(Register reg, const Operand& op) { |
| 84 emit(0x40 | (reg.code() & 0x8) >> 1 | op.rex_); |
| 85 } |
| 86 |
| 87 |
| 88 // High bit of reg goes to REX.R, high bit of rm_reg goes to REX.B. |
| 89 // REX.W and REX.X are cleared. If no REX bits are set, no byte is emitted. |
| 90 void Assembler::emit_optional_rex_32(Register reg, Register rm_reg) { |
| 91 byte rex_bits = (reg.code() & 0x8) >> 1 | rm_reg.code() >> 3; |
| 92 if (rex_bits) emit(0x40 | rex_bits); |
| 93 } |
| 94 |
| 95 |
| 96 // The high bit of reg is used for REX.R, the high bit of op's base |
| 97 // register is used for REX.B, and the high bit of op's index register |
| 98 // is used for REX.X. REX.W is cleared. If no REX bits are set, nothing |
| 99 // is emitted. |
| 100 void Assembler::emit_optional_rex_32(Register reg, const Operand& op) { |
| 101 byte rex_bits = (reg.code() & 0x8) >> 1 | op.rex_; |
| 102 if (rex_bits) emit(0x40 | rex_bits); |
| 103 } |
| 104 |
| 105 |
| 73 void Assembler::set_target_address_at(byte* location, byte* value) { | 106 void Assembler::set_target_address_at(byte* location, byte* value) { |
| 74 UNIMPLEMENTED(); | 107 UNIMPLEMENTED(); |
| 75 } | 108 } |
| 76 | 109 |
| 77 | 110 |
| 78 byte* Assembler::target_address_at(byte* location) { | 111 byte* Assembler::target_address_at(byte* location) { |
| 79 UNIMPLEMENTED(); | 112 UNIMPLEMENTED(); |
| 80 return NULL; | 113 return NULL; |
| 81 } | 114 } |
| 82 | 115 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 ASSERT(len_ == 1 || len_ == 2); | 266 ASSERT(len_ == 1 || len_ == 2); |
| 234 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); | 267 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); |
| 235 *p = disp; | 268 *p = disp; |
| 236 len_ += sizeof(int32_t); | 269 len_ += sizeof(int32_t); |
| 237 } | 270 } |
| 238 | 271 |
| 239 | 272 |
| 240 } } // namespace v8::internal | 273 } } // namespace v8::internal |
| 241 | 274 |
| 242 #endif // V8_X64_ASSEMBLER_X64_INL_H_ | 275 #endif // V8_X64_ASSEMBLER_X64_INL_H_ |
| OLD | NEW |