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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 rex_ |= rm_reg.high_bit(); | 418 rex_ |= rm_reg.high_bit(); |
419 } | 419 } |
420 | 420 |
421 | 421 |
422 void Operand::set_sib(ScaleFactor scale, Register index, Register base) { | 422 void Operand::set_sib(ScaleFactor scale, Register index, Register base) { |
423 ASSERT(len_ == 1); | 423 ASSERT(len_ == 1); |
424 ASSERT(is_uint2(scale)); | 424 ASSERT(is_uint2(scale)); |
425 // Use SIB with no index register only for base rsp or r12. Otherwise we | 425 // Use SIB with no index register only for base rsp or r12. Otherwise we |
426 // would skip the SIB byte entirely. | 426 // would skip the SIB byte entirely. |
427 ASSERT(!index.is(rsp) || base.is(rsp) || base.is(r12)); | 427 ASSERT(!index.is(rsp) || base.is(rsp) || base.is(r12)); |
428 buf_[1] = scale << 6 | index.low_bits() << 3 | base.low_bits(); | 428 buf_[1] = (scale << 6) | (index.low_bits() << 3) | base.low_bits(); |
429 rex_ |= index.high_bit() << 1 | base.high_bit(); | 429 rex_ |= index.high_bit() << 1 | base.high_bit(); |
430 len_ = 2; | 430 len_ = 2; |
431 } | 431 } |
432 | 432 |
433 void Operand::set_disp8(int disp) { | 433 void Operand::set_disp8(int disp) { |
434 ASSERT(is_int8(disp)); | 434 ASSERT(is_int8(disp)); |
435 ASSERT(len_ == 1 || len_ == 2); | 435 ASSERT(len_ == 1 || len_ == 2); |
436 int8_t* p = reinterpret_cast<int8_t*>(&buf_[len_]); | 436 int8_t* p = reinterpret_cast<int8_t*>(&buf_[len_]); |
437 *p = disp; | 437 *p = disp; |
438 len_ += sizeof(int8_t); | 438 len_ += sizeof(int8_t); |
439 } | 439 } |
440 | 440 |
441 void Operand::set_disp32(int disp) { | 441 void Operand::set_disp32(int disp) { |
442 ASSERT(len_ == 1 || len_ == 2); | 442 ASSERT(len_ == 1 || len_ == 2); |
443 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); | 443 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); |
444 *p = disp; | 444 *p = disp; |
445 len_ += sizeof(int32_t); | 445 len_ += sizeof(int32_t); |
446 } | 446 } |
447 | 447 |
448 | 448 |
449 } } // namespace v8::internal | 449 } } // namespace v8::internal |
450 | 450 |
451 #endif // V8_X64_ASSEMBLER_X64_INL_H_ | 451 #endif // V8_X64_ASSEMBLER_X64_INL_H_ |
OLD | NEW |