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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 ASSERT((mod & -4) == 0); | 253 ASSERT((mod & -4) == 0); |
254 buf_[0] = (mod << 6) | (rm.code() & 0x7); | 254 buf_[0] = (mod << 6) | (rm.code() & 0x7); |
255 // Set REX.B to the high bit of rm.code(). | 255 // Set REX.B to the high bit of rm.code(). |
256 rex_ |= (rm.code() >> 3); | 256 rex_ |= (rm.code() >> 3); |
257 } | 257 } |
258 | 258 |
259 | 259 |
260 void Operand::set_sib(ScaleFactor scale, Register index, Register base) { | 260 void Operand::set_sib(ScaleFactor scale, Register index, Register base) { |
261 ASSERT(len_ == 1); | 261 ASSERT(len_ == 1); |
262 ASSERT(is_uint2(scale)); | 262 ASSERT(is_uint2(scale)); |
263 // Use SIB with no index register only for base rsp or r12. | 263 // Use SIB with no index register only for base rsp or r12. Otherwise we |
| 264 // would skip the SIB byte entirely. |
264 ASSERT(!index.is(rsp) || base.is(rsp) || base.is(r12)); | 265 ASSERT(!index.is(rsp) || base.is(rsp) || base.is(r12)); |
265 buf_[1] = scale << 6 | (index.code() & 0x7) << 3 | (base.code() & 0x7); | 266 buf_[1] = scale << 6 | (index.code() & 0x7) << 3 | (base.code() & 0x7); |
266 rex_ |= (index.code() >> 3) << 1 | base.code() >> 3; | 267 rex_ |= (index.code() >> 3) << 1 | base.code() >> 3; |
267 len_ = 2; | 268 len_ = 2; |
268 } | 269 } |
269 | 270 |
270 void Operand::set_disp8(int disp) { | 271 void Operand::set_disp8(int disp) { |
271 ASSERT(is_int8(disp)); | 272 ASSERT(is_int8(disp)); |
272 ASSERT(len_ == 1 || len_ == 2); | 273 ASSERT(len_ == 1 || len_ == 2); |
273 int8_t* p = reinterpret_cast<int8_t*>(&buf_[len_]); | 274 int8_t* p = reinterpret_cast<int8_t*>(&buf_[len_]); |
274 *p = disp; | 275 *p = disp; |
275 len_ += sizeof(int8_t); | 276 len_ += sizeof(int8_t); |
276 } | 277 } |
277 | 278 |
278 void Operand::set_disp32(int disp) { | 279 void Operand::set_disp32(int disp) { |
279 ASSERT(len_ == 1 || len_ == 2); | 280 ASSERT(len_ == 1 || len_ == 2); |
280 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); | 281 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); |
281 *p = disp; | 282 *p = disp; |
282 len_ += sizeof(int32_t); | 283 len_ += sizeof(int32_t); |
283 } | 284 } |
284 | 285 |
285 | 286 |
286 } } // namespace v8::internal | 287 } } // namespace v8::internal |
287 | 288 |
288 #endif // V8_X64_ASSEMBLER_X64_INL_H_ | 289 #endif // V8_X64_ASSEMBLER_X64_INL_H_ |
OLD | NEW |