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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 pc_ += sizeof(uint32_t); | 48 pc_ += sizeof(uint32_t); |
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 void Assembler::emitw(uint16_t x) { |
| 59 Memory::uint16_at(pc_) = x; |
| 60 pc_ += sizeof(uint16_t); |
| 61 } |
| 62 |
| 63 |
58 // High bit of reg goes to REX.R, high bit of rm_reg goes to REX.B. | 64 // High bit of reg goes to REX.R, high bit of rm_reg goes to REX.B. |
59 // REX.W is set. REX.X is cleared. | 65 // REX.W is set. REX.X is cleared. |
60 void Assembler::emit_rex_64(Register reg, Register rm_reg) { | 66 void Assembler::emit_rex_64(Register reg, Register rm_reg) { |
61 emit(0x48 | (reg.code() & 0x8) >> 1 | rm_reg.code() >> 3); | 67 emit(0x48 | (reg.code() & 0x8) >> 1 | rm_reg.code() >> 3); |
62 } | 68 } |
63 | 69 |
64 | 70 |
65 // The high bit of reg is used for REX.R, the high bit of op's base | 71 // 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 | 72 // 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. | 73 // is used for REX.X. REX.W is set. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // The high bit of reg is used for REX.R, the high bit of op's base | 117 // The high bit of reg is used for REX.R, the high bit of op's base |
112 // register is used for REX.B, and the high bit of op's index register | 118 // register is used for REX.B, and the high bit of op's index register |
113 // is used for REX.X. REX.W is cleared. If no REX bits are set, nothing | 119 // is used for REX.X. REX.W is cleared. If no REX bits are set, nothing |
114 // is emitted. | 120 // is emitted. |
115 void Assembler::emit_optional_rex_32(Register reg, const Operand& op) { | 121 void Assembler::emit_optional_rex_32(Register reg, const Operand& op) { |
116 byte rex_bits = (reg.code() & 0x8) >> 1 | op.rex_; | 122 byte rex_bits = (reg.code() & 0x8) >> 1 | op.rex_; |
117 if (rex_bits) emit(0x40 | rex_bits); | 123 if (rex_bits) emit(0x40 | rex_bits); |
118 } | 124 } |
119 | 125 |
120 | 126 |
121 void Assembler::set_target_address_at(byte* location, byte* value) { | 127 Address Assembler::target_address_at(Address pc) { |
122 UNIMPLEMENTED(); | 128 return Memory::Address_at(pc); |
123 } | 129 } |
124 | 130 |
125 | 131 |
126 byte* Assembler::target_address_at(byte* location) { | 132 void Assembler::set_target_address_at(Address pc, Address target) { |
127 UNIMPLEMENTED(); | 133 Memory::Address_at(pc) = target; |
128 return NULL; | 134 CPU::FlushICache(pc, sizeof(intptr_t)); |
129 } | 135 } |
130 | 136 |
131 | 137 |
132 // ----------------------------------------------------------------------------- | 138 // ----------------------------------------------------------------------------- |
133 // Implementation of RelocInfo | 139 // Implementation of RelocInfo |
134 | 140 |
135 // The modes possibly affected by apply must be in kApplyMask. | 141 // The modes possibly affected by apply must be in kApplyMask. |
136 void RelocInfo::apply(int delta) { | 142 void RelocInfo::apply(int delta) { |
137 if (rmode_ == RUNTIME_ENTRY || IsCodeTarget(rmode_)) { | 143 if (rmode_ == RUNTIME_ENTRY || IsCodeTarget(rmode_)) { |
138 intptr_t* p = reinterpret_cast<intptr_t*>(pc_); | 144 intptr_t* p = reinterpret_cast<intptr_t*>(pc_); |
(...skipping 20 matching lines...) Expand all Loading... |
159 Address RelocInfo::target_address_address() { | 165 Address RelocInfo::target_address_address() { |
160 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 166 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); |
161 return reinterpret_cast<Address>(pc_); | 167 return reinterpret_cast<Address>(pc_); |
162 } | 168 } |
163 | 169 |
164 | 170 |
165 void RelocInfo::set_target_address(Address target) { | 171 void RelocInfo::set_target_address(Address target) { |
166 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 172 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); |
167 Assembler::set_target_address_at(pc_, target); | 173 Assembler::set_target_address_at(pc_, target); |
168 } | 174 } |
| 175 |
| 176 |
169 Object* RelocInfo::target_object() { | 177 Object* RelocInfo::target_object() { |
170 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 178 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
171 return *reinterpret_cast<Object**>(pc_); | 179 return *reinterpret_cast<Object**>(pc_); |
172 } | 180 } |
173 | 181 |
174 | 182 |
175 Object** RelocInfo::target_object_address() { | 183 Object** RelocInfo::target_object_address() { |
176 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 184 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
177 return reinterpret_cast<Object**>(pc_); | 185 return reinterpret_cast<Object**>(pc_); |
178 } | 186 } |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 ASSERT(len_ == 1 || len_ == 2); | 289 ASSERT(len_ == 1 || len_ == 2); |
282 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); | 290 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); |
283 *p = disp; | 291 *p = disp; |
284 len_ += sizeof(int32_t); | 292 len_ += sizeof(int32_t); |
285 } | 293 } |
286 | 294 |
287 | 295 |
288 } } // namespace v8::internal | 296 } } // namespace v8::internal |
289 | 297 |
290 #endif // V8_X64_ASSEMBLER_X64_INL_H_ | 298 #endif // V8_X64_ASSEMBLER_X64_INL_H_ |
OLD | NEW |