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 are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 emit(x); | 198 emit(x); |
199 } | 199 } |
200 | 200 |
201 | 201 |
202 void Assembler::emit(const Immediate& x) { | 202 void Assembler::emit(const Immediate& x) { |
203 if (x.rmode_ != RelocInfo::NONE) RecordRelocInfo(x.rmode_); | 203 if (x.rmode_ != RelocInfo::NONE) RecordRelocInfo(x.rmode_); |
204 emit(x.x_); | 204 emit(x.x_); |
205 } | 205 } |
206 | 206 |
207 | 207 |
| 208 void Assembler::emit_w(const Immediate& x) { |
| 209 ASSERT(x.rmode_ == RelocInfo::NONE); |
| 210 uint16_t value = static_cast<uint16_t>(x.x_); |
| 211 reinterpret_cast<uint16_t*>(pc_)[0] = value; |
| 212 pc_ += sizeof(uint16_t); |
| 213 } |
| 214 |
| 215 |
208 Address Assembler::target_address_at(Address pc) { | 216 Address Assembler::target_address_at(Address pc) { |
209 return pc + sizeof(int32_t) + *reinterpret_cast<int32_t*>(pc); | 217 return pc + sizeof(int32_t) + *reinterpret_cast<int32_t*>(pc); |
210 } | 218 } |
211 | 219 |
212 | 220 |
213 void Assembler::set_target_address_at(Address pc, Address target) { | 221 void Assembler::set_target_address_at(Address pc, Address target) { |
214 int32_t* p = reinterpret_cast<int32_t*>(pc); | 222 int32_t* p = reinterpret_cast<int32_t*>(pc); |
215 *p = target - (pc + sizeof(int32_t)); | 223 *p = target - (pc + sizeof(int32_t)); |
216 CPU::FlushICache(p, sizeof(int32_t)); | 224 CPU::FlushICache(p, sizeof(int32_t)); |
217 } | 225 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 265 |
258 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { | 266 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { |
259 // [disp/r] | 267 // [disp/r] |
260 set_modrm(0, ebp); | 268 set_modrm(0, ebp); |
261 set_dispr(disp, rmode); | 269 set_dispr(disp, rmode); |
262 } | 270 } |
263 | 271 |
264 } } // namespace v8::internal | 272 } } // namespace v8::internal |
265 | 273 |
266 #endif // V8_ASSEMBLER_IA32_INL_H_ | 274 #endif // V8_ASSEMBLER_IA32_INL_H_ |
OLD | NEW |