OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 // Need no displacement. | 306 // Need no displacement. |
307 buf_[0] = (modrm & 0x3f); // Mode 0. | 307 buf_[0] = (modrm & 0x3f); // Mode 0. |
308 len_ = disp_offset; | 308 len_ = disp_offset; |
309 } | 309 } |
310 if (has_sib) { | 310 if (has_sib) { |
311 buf_[1] = operand.buf_[1]; | 311 buf_[1] = operand.buf_[1]; |
312 } | 312 } |
313 } | 313 } |
314 | 314 |
315 | 315 |
| 316 Operand::Operand(Register reg) { |
| 317 len_ = 1; |
| 318 set_modrm(3, reg); |
| 319 } |
| 320 |
| 321 |
316 bool Operand::AddressUsesRegister(Register reg) const { | 322 bool Operand::AddressUsesRegister(Register reg) const { |
317 int code = reg.code(); | 323 int code = reg.code(); |
318 ASSERT((buf_[0] & 0xC0) != 0xC0); // Always a memory operand. | 324 ASSERT((buf_[0] & 0xC0) != 0xC0); // Always a memory operand. |
319 // Start with only low three bits of base register. Initial decoding doesn't | 325 // Start with only low three bits of base register. Initial decoding doesn't |
320 // distinguish on the REX.B bit. | 326 // distinguish on the REX.B bit. |
321 int base_code = buf_[0] & 0x07; | 327 int base_code = buf_[0] & 0x07; |
322 if (base_code == rsp.code()) { | 328 if (base_code == rsp.code()) { |
323 // SIB byte present in buf_[1]. | 329 // SIB byte present in buf_[1]. |
324 // Check the index register from the SIB byte + REX.X prefix. | 330 // Check the index register from the SIB byte + REX.X prefix. |
325 int index_code = ((buf_[1] >> 3) & 0x07) | ((rex_ & 0x02) << 2); | 331 int index_code = ((buf_[1] >> 3) & 0x07) | ((rex_ & 0x02) << 2); |
(...skipping 2715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3041 bool RelocInfo::IsCodedSpecially() { | 3047 bool RelocInfo::IsCodedSpecially() { |
3042 // The deserializer needs to know whether a pointer is specially coded. Being | 3048 // The deserializer needs to know whether a pointer is specially coded. Being |
3043 // specially coded on x64 means that it is a relative 32 bit address, as used | 3049 // specially coded on x64 means that it is a relative 32 bit address, as used |
3044 // by branch instructions. | 3050 // by branch instructions. |
3045 return (1 << rmode_) & kApplyMask; | 3051 return (1 << rmode_) & kApplyMask; |
3046 } | 3052 } |
3047 | 3053 |
3048 } } // namespace v8::internal | 3054 } } // namespace v8::internal |
3049 | 3055 |
3050 #endif // V8_TARGET_ARCH_X64 | 3056 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |