| 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 26 matching lines...) Expand all Loading... |
| 37 return static_cast<Condition>(cc ^ 1); | 37 return static_cast<Condition>(cc ^ 1); |
| 38 } | 38 } |
| 39 | 39 |
| 40 | 40 |
| 41 // ----------------------------------------------------------------------------- | 41 // ----------------------------------------------------------------------------- |
| 42 // Implementation of Assembler | 42 // Implementation of Assembler |
| 43 | 43 |
| 44 #define EMIT(x) \ | 44 #define EMIT(x) \ |
| 45 *pc_++ = (x) | 45 *pc_++ = (x) |
| 46 | 46 |
| 47 void Assembler::emit(uint32_t x) { | 47 |
| 48 *reinterpret_cast<uint32_t*>(pc_) = x; | 48 void Assembler::emitl(uint32_t x) { |
| 49 Memory::uint32_at(pc_) = x; |
| 49 pc_ += sizeof(uint32_t); | 50 pc_ += sizeof(uint32_t); |
| 50 } | 51 } |
| 51 | 52 |
| 53 |
| 54 void Assembler::emitq(uint64_t x, RelocInfo::Mode rmode) { |
| 55 Memory::uint64_at(pc_) = x; |
| 56 RecordRelocInfo(rmode, x); |
| 57 } |
| 58 |
| 59 |
| 60 // High bit of reg goes to REX.R, high bit of rm_reg goes to REX.B. |
| 61 // REX.W is set. |
| 52 void Assembler::emit_rex_64(Register reg, Register rm_reg) { | 62 void Assembler::emit_rex_64(Register reg, Register rm_reg) { |
| 53 EMIT(0x48 | (reg.code() & 0x8) >> 1 | rm_reg.code() >> 3); | 63 EMIT(0x48 | (reg.code() & 0x8) >> 1 | rm_reg.code() >> 3); |
| 54 } | 64 } |
| 55 | 65 |
| 56 | 66 |
| 67 // The high bit of reg is used for REX.R, the high bit of op's base |
| 68 // register is used for REX.B, and the high bit of op's index register |
| 69 // is used for REX.X. REX.W is set. |
| 57 void Assembler::emit_rex_64(Register reg, const Operand& op) { | 70 void Assembler::emit_rex_64(Register reg, const Operand& op) { |
| 58 EMIT(0x48 | (reg.code() & 0x8) >> 1 | op.rex_); | 71 EMIT(0x48 | (reg.code() & 0x8) >> 1 | op.rex_); |
| 59 } | 72 } |
| 60 | 73 |
| 61 | 74 |
| 62 void Assembler::set_target_address_at(byte* location, byte* value) { | 75 void Assembler::set_target_address_at(byte* location, byte* value) { |
| 63 UNIMPLEMENTED(); | 76 UNIMPLEMENTED(); |
| 64 } | 77 } |
| 65 | 78 |
| 66 | 79 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 ASSERT(len_ == 1 || len_ == 2); | 237 ASSERT(len_ == 1 || len_ == 2); |
| 225 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); | 238 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); |
| 226 *p = disp; | 239 *p = disp; |
| 227 len_ += sizeof(int32_t); | 240 len_ += sizeof(int32_t); |
| 228 } | 241 } |
| 229 | 242 |
| 230 | 243 |
| 231 } } // namespace v8::internal | 244 } } // namespace v8::internal |
| 232 | 245 |
| 233 #endif // V8_X64_ASSEMBLER_X64_INL_H_ | 246 #endif // V8_X64_ASSEMBLER_X64_INL_H_ |
| OLD | NEW |