| 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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 static const int kCallInstructionLength = 5; | 580 static const int kCallInstructionLength = 5; |
| 581 static const int kJSReturnSequenceLength = 6; | 581 static const int kJSReturnSequenceLength = 6; |
| 582 | 582 |
| 583 // The debug break slot must be able to contain a call instruction. | 583 // The debug break slot must be able to contain a call instruction. |
| 584 static const int kDebugBreakSlotLength = kCallInstructionLength; | 584 static const int kDebugBreakSlotLength = kCallInstructionLength; |
| 585 | 585 |
| 586 // One byte opcode for test eax,0xXXXXXXXX. | 586 // One byte opcode for test eax,0xXXXXXXXX. |
| 587 static const byte kTestEaxByte = 0xA9; | 587 static const byte kTestEaxByte = 0xA9; |
| 588 // One byte opcode for test al, 0xXX. | 588 // One byte opcode for test al, 0xXX. |
| 589 static const byte kTestAlByte = 0xA8; | 589 static const byte kTestAlByte = 0xA8; |
| 590 // One byte opcode for nop. |
| 591 static const byte kNopByte = 0x90; |
| 592 |
| 593 // One byte opcode for a short unconditional jump. |
| 594 static const byte kJmpShortOpcode = 0xEB; |
| 595 // One byte prefix for a short conditional jump. |
| 596 static const byte kJccShortPrefix = 0x70; |
| 597 static const byte kJncShortOpcode = kJccShortPrefix | not_carry; |
| 598 static const byte kJcShortOpcode = kJccShortPrefix | carry; |
| 590 | 599 |
| 591 // --------------------------------------------------------------------------- | 600 // --------------------------------------------------------------------------- |
| 592 // Code generation | 601 // Code generation |
| 593 // | 602 // |
| 594 // - function names correspond one-to-one to ia32 instruction mnemonics | 603 // - function names correspond one-to-one to ia32 instruction mnemonics |
| 595 // - unless specified otherwise, instructions operate on 32bit operands | 604 // - unless specified otherwise, instructions operate on 32bit operands |
| 596 // - instructions on 8bit (byte) operands/registers have a trailing '_b' | 605 // - instructions on 8bit (byte) operands/registers have a trailing '_b' |
| 597 // - instructions on 16bit (word) operands/registers have a trailing '_w' | 606 // - instructions on 16bit (word) operands/registers have a trailing '_w' |
| 598 // - naming conflicts with C++ keywords are resolved via a trailing '_' | 607 // - naming conflicts with C++ keywords are resolved via a trailing '_' |
| 599 | 608 |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 void movdqa(XMMRegister dst, const Operand& src); | 923 void movdqa(XMMRegister dst, const Operand& src); |
| 915 void movdqa(const Operand& dst, XMMRegister src); | 924 void movdqa(const Operand& dst, XMMRegister src); |
| 916 void movdqu(XMMRegister dst, const Operand& src); | 925 void movdqu(XMMRegister dst, const Operand& src); |
| 917 void movdqu(const Operand& dst, XMMRegister src); | 926 void movdqu(const Operand& dst, XMMRegister src); |
| 918 | 927 |
| 919 // Use either movsd or movlpd. | 928 // Use either movsd or movlpd. |
| 920 void movdbl(XMMRegister dst, const Operand& src); | 929 void movdbl(XMMRegister dst, const Operand& src); |
| 921 void movdbl(const Operand& dst, XMMRegister src); | 930 void movdbl(const Operand& dst, XMMRegister src); |
| 922 | 931 |
| 923 void movd(XMMRegister dst, const Operand& src); | 932 void movd(XMMRegister dst, const Operand& src); |
| 933 void movd(const Operand& src, XMMRegister dst); |
| 924 void movsd(XMMRegister dst, XMMRegister src); | 934 void movsd(XMMRegister dst, XMMRegister src); |
| 925 | 935 |
| 926 void pand(XMMRegister dst, XMMRegister src); | 936 void pand(XMMRegister dst, XMMRegister src); |
| 927 void pxor(XMMRegister dst, XMMRegister src); | 937 void pxor(XMMRegister dst, XMMRegister src); |
| 928 void ptest(XMMRegister dst, XMMRegister src); | 938 void ptest(XMMRegister dst, XMMRegister src); |
| 929 | 939 |
| 930 void psllq(XMMRegister reg, int8_t imm8); | 940 void psllq(XMMRegister reg, int8_t shift); |
| 941 void pshufd(XMMRegister dst, XMMRegister src, int8_t shuffle); |
| 942 void pextrd(const Operand& dst, XMMRegister src, int8_t offset); |
| 931 | 943 |
| 932 // Parallel XMM operations. | 944 // Parallel XMM operations. |
| 933 void movntdqa(XMMRegister src, const Operand& dst); | 945 void movntdqa(XMMRegister src, const Operand& dst); |
| 934 void movntdq(const Operand& dst, XMMRegister src); | 946 void movntdq(const Operand& dst, XMMRegister src); |
| 935 // Prefetch src position into cache level. | 947 // Prefetch src position into cache level. |
| 936 // Level 1, 2 or 3 specifies CPU cache level. Level 0 specifies a | 948 // Level 1, 2 or 3 specifies CPU cache level. Level 0 specifies a |
| 937 // non-temporal | 949 // non-temporal |
| 938 void prefetch(const Operand& src, int level); | 950 void prefetch(const Operand& src, int level); |
| 939 // TODO(lrn): Need SFENCE for movnt? | 951 // TODO(lrn): Need SFENCE for movnt? |
| 940 | 952 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 954 // Use --code-comments to enable. | 966 // Use --code-comments to enable. |
| 955 void RecordComment(const char* msg); | 967 void RecordComment(const char* msg); |
| 956 | 968 |
| 957 // Writes a single byte or word of data in the code stream. Used for | 969 // Writes a single byte or word of data in the code stream. Used for |
| 958 // inline tables, e.g., jump-tables. | 970 // inline tables, e.g., jump-tables. |
| 959 void db(uint8_t data); | 971 void db(uint8_t data); |
| 960 void dd(uint32_t data); | 972 void dd(uint32_t data); |
| 961 | 973 |
| 962 int pc_offset() const { return pc_ - buffer_; } | 974 int pc_offset() const { return pc_ - buffer_; } |
| 963 | 975 |
| 976 //dimich |
| 977 byte* buffer() { return buffer_; } |
| 978 |
| 964 // Check if there is less than kGap bytes available in the buffer. | 979 // Check if there is less than kGap bytes available in the buffer. |
| 965 // If this is the case, we need to grow the buffer before emitting | 980 // If this is the case, we need to grow the buffer before emitting |
| 966 // an instruction or relocation information. | 981 // an instruction or relocation information. |
| 967 inline bool overflow() const { return pc_ >= reloc_info_writer.pos() - kGap; } | 982 inline bool overflow() const { return pc_ >= reloc_info_writer.pos() - kGap; } |
| 968 | 983 |
| 969 // Get the number of bytes available in the buffer. | 984 // Get the number of bytes available in the buffer. |
| 970 inline int available_space() const { return reloc_info_writer.pos() - pc_; } | 985 inline int available_space() const { return reloc_info_writer.pos() - pc_; } |
| 971 | 986 |
| 972 static bool IsNop(Address addr) { return *addr == 0x90; } | 987 static bool IsNop(Address addr) { return *addr == 0x90; } |
| 973 | 988 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 private: | 1093 private: |
| 1079 Assembler* assembler_; | 1094 Assembler* assembler_; |
| 1080 #ifdef DEBUG | 1095 #ifdef DEBUG |
| 1081 int space_before_; | 1096 int space_before_; |
| 1082 #endif | 1097 #endif |
| 1083 }; | 1098 }; |
| 1084 | 1099 |
| 1085 } } // namespace v8::internal | 1100 } } // namespace v8::internal |
| 1086 | 1101 |
| 1087 #endif // V8_IA32_ASSEMBLER_IA32_H_ | 1102 #endif // V8_IA32_ASSEMBLER_IA32_H_ |
| OLD | NEW |