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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 | 272 |
273 void Operand::set_modrm(int mod, Register rm) { | 273 void Operand::set_modrm(int mod, Register rm) { |
274 ASSERT((mod & -4) == 0); | 274 ASSERT((mod & -4) == 0); |
275 buf_[0] = mod << 6 | rm.code(); | 275 buf_[0] = mod << 6 | rm.code(); |
276 len_ = 1; | 276 len_ = 1; |
277 } | 277 } |
278 | 278 |
279 | 279 |
280 void Operand::set_dispr(int32_t disp, RelocInfo::Mode rmode) { | 280 void Operand::set_dispr(int32_t disp, RelocInfo::Mode rmode) { |
281 ASSERT(len_ == 1 || len_ == 2); | 281 ASSERT(len_ == 1 || len_ == 2); |
282 *reinterpret_cast<int32_t*>(&buf_[len_]) = disp; | 282 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); |
| 283 *p = disp; |
283 len_ += sizeof(int32_t); | 284 len_ += sizeof(int32_t); |
284 rmode_ = rmode; | 285 rmode_ = rmode; |
285 } | 286 } |
286 | 287 |
287 Operand::Operand(Register reg) { | 288 Operand::Operand(Register reg) { |
288 // reg | 289 // reg |
289 set_modrm(3, reg); | 290 set_modrm(3, reg); |
290 } | 291 } |
291 | 292 |
292 | 293 |
293 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { | 294 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { |
294 // [disp/r] | 295 // [disp/r] |
295 set_modrm(0, ebp); | 296 set_modrm(0, ebp); |
296 set_dispr(disp, rmode); | 297 set_dispr(disp, rmode); |
297 } | 298 } |
298 | 299 |
299 } } // namespace v8::internal | 300 } } // namespace v8::internal |
300 | 301 |
301 #endif // V8_ASSEMBLER_IA32_INL_H_ | 302 #endif // V8_ASSEMBLER_IA32_INL_H_ |
OLD | NEW |