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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 "xmm10", | 208 "xmm10", |
209 "xmm11", | 209 "xmm11", |
210 "xmm12", | 210 "xmm12", |
211 "xmm13", | 211 "xmm13", |
212 "xmm14", | 212 "xmm14", |
213 "xmm15" | 213 "xmm15" |
214 }; | 214 }; |
215 return names[index]; | 215 return names[index]; |
216 } | 216 } |
217 | 217 |
| 218 static XMMRegister from_code(int code) { |
| 219 ASSERT(code >= 0); |
| 220 ASSERT(code < kNumRegisters); |
| 221 XMMRegister r = { code }; |
| 222 return r; |
| 223 } |
218 bool is_valid() const { return 0 <= code_ && code_ < kNumRegisters; } | 224 bool is_valid() const { return 0 <= code_ && code_ < kNumRegisters; } |
219 bool is(XMMRegister reg) const { return code_ == reg.code_; } | 225 bool is(XMMRegister reg) const { return code_ == reg.code_; } |
220 int code() const { | 226 int code() const { |
221 ASSERT(is_valid()); | 227 ASSERT(is_valid()); |
222 return code_; | 228 return code_; |
223 } | 229 } |
224 | 230 |
225 // Return the high bit of the register code as a 0 or 1. Used often | 231 // Return the high bit of the register code as a 0 or 1. Used often |
226 // when constructing the REX prefix byte. | 232 // when constructing the REX prefix byte. |
227 int high_bit() const { | 233 int high_bit() const { |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 } | 734 } |
729 | 735 |
730 void addl(Register dst, const Operand& src) { | 736 void addl(Register dst, const Operand& src) { |
731 arithmetic_op_32(0x03, dst, src); | 737 arithmetic_op_32(0x03, dst, src); |
732 } | 738 } |
733 | 739 |
734 void addl(const Operand& dst, Immediate src) { | 740 void addl(const Operand& dst, Immediate src) { |
735 immediate_arithmetic_op_32(0x0, dst, src); | 741 immediate_arithmetic_op_32(0x0, dst, src); |
736 } | 742 } |
737 | 743 |
| 744 void addl(const Operand& dst, Register src) { |
| 745 arithmetic_op_32(0x01, src, dst); |
| 746 } |
| 747 |
738 void addq(Register dst, Register src) { | 748 void addq(Register dst, Register src) { |
739 arithmetic_op(0x03, dst, src); | 749 arithmetic_op(0x03, dst, src); |
740 } | 750 } |
741 | 751 |
742 void addq(Register dst, const Operand& src) { | 752 void addq(Register dst, const Operand& src) { |
743 arithmetic_op(0x03, dst, src); | 753 arithmetic_op(0x03, dst, src); |
744 } | 754 } |
745 | 755 |
746 void addq(const Operand& dst, Register src) { | 756 void addq(const Operand& dst, Register src) { |
747 arithmetic_op(0x01, src, dst); | 757 arithmetic_op(0x01, src, dst); |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1387 inline int available_space() const { | 1397 inline int available_space() const { |
1388 return static_cast<int>(reloc_info_writer.pos() - pc_); | 1398 return static_cast<int>(reloc_info_writer.pos() - pc_); |
1389 } | 1399 } |
1390 | 1400 |
1391 static bool IsNop(Address addr) { return *addr == 0x90; } | 1401 static bool IsNop(Address addr) { return *addr == 0x90; } |
1392 | 1402 |
1393 // Avoid overflows for displacements etc. | 1403 // Avoid overflows for displacements etc. |
1394 static const int kMaximalBufferSize = 512*MB; | 1404 static const int kMaximalBufferSize = 512*MB; |
1395 static const int kMinimalBufferSize = 4*KB; | 1405 static const int kMinimalBufferSize = 4*KB; |
1396 | 1406 |
| 1407 byte byte_at(int pos) { return buffer_[pos]; } |
| 1408 void set_byte_at(int pos, byte value) { buffer_[pos] = value; } |
| 1409 |
1397 protected: | 1410 protected: |
1398 bool emit_debug_code() const { return emit_debug_code_; } | 1411 bool emit_debug_code() const { return emit_debug_code_; } |
1399 | 1412 |
1400 private: | 1413 private: |
1401 byte* addr_at(int pos) { return buffer_ + pos; } | 1414 byte* addr_at(int pos) { return buffer_ + pos; } |
1402 byte byte_at(int pos) { return buffer_[pos]; } | |
1403 void set_byte_at(int pos, byte value) { buffer_[pos] = value; } | |
1404 uint32_t long_at(int pos) { | 1415 uint32_t long_at(int pos) { |
1405 return *reinterpret_cast<uint32_t*>(addr_at(pos)); | 1416 return *reinterpret_cast<uint32_t*>(addr_at(pos)); |
1406 } | 1417 } |
1407 void long_at_put(int pos, uint32_t x) { | 1418 void long_at_put(int pos, uint32_t x) { |
1408 *reinterpret_cast<uint32_t*>(addr_at(pos)) = x; | 1419 *reinterpret_cast<uint32_t*>(addr_at(pos)) = x; |
1409 } | 1420 } |
1410 | 1421 |
1411 // code emission | 1422 // code emission |
1412 void GrowBuffer(); | 1423 void GrowBuffer(); |
1413 | 1424 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1630 private: | 1641 private: |
1631 Assembler* assembler_; | 1642 Assembler* assembler_; |
1632 #ifdef DEBUG | 1643 #ifdef DEBUG |
1633 int space_before_; | 1644 int space_before_; |
1634 #endif | 1645 #endif |
1635 }; | 1646 }; |
1636 | 1647 |
1637 } } // namespace v8::internal | 1648 } } // namespace v8::internal |
1638 | 1649 |
1639 #endif // V8_X64_ASSEMBLER_X64_H_ | 1650 #endif // V8_X64_ASSEMBLER_X64_H_ |
OLD | NEW |