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 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 // Mark address of the ExitJSFrame code. | 840 // Mark address of the ExitJSFrame code. |
841 void RecordJSReturn(); | 841 void RecordJSReturn(); |
842 | 842 |
843 // Mark address of a debug break slot. | 843 // Mark address of a debug break slot. |
844 void RecordDebugBreakSlot(); | 844 void RecordDebugBreakSlot(); |
845 | 845 |
846 // Record a comment relocation entry that can be used by a disassembler. | 846 // Record a comment relocation entry that can be used by a disassembler. |
847 // Use --debug_code to enable. | 847 // Use --debug_code to enable. |
848 void RecordComment(const char* msg); | 848 void RecordComment(const char* msg); |
849 | 849 |
850 void RecordPosition(int pos); | |
851 void RecordStatementPosition(int pos); | |
852 bool WriteRecordedPositions(); | |
853 | |
854 // Writes a single word of data in the code stream. | 850 // Writes a single word of data in the code stream. |
855 // Used for inline tables, e.g., jump-tables. | 851 // Used for inline tables, e.g., jump-tables. |
856 void dd(uint32_t data, RelocInfo::Mode reloc_info); | 852 void dd(uint32_t data, RelocInfo::Mode reloc_info); |
857 | 853 |
858 int pc_offset() const { return pc_ - buffer_; } | 854 int pc_offset() const { return pc_ - buffer_; } |
859 int current_statement_position() const { return current_statement_position_; } | |
860 int current_position() const { return current_position_; } | |
861 | 855 |
862 // Check if there is less than kGap bytes available in the buffer. | 856 // Check if there is less than kGap bytes available in the buffer. |
863 // If this is the case, we need to grow the buffer before emitting | 857 // If this is the case, we need to grow the buffer before emitting |
864 // an instruction or relocation information. | 858 // an instruction or relocation information. |
865 inline bool overflow() const { return pc_ >= reloc_info_writer.pos() - kGap; } | 859 inline bool overflow() const { return pc_ >= reloc_info_writer.pos() - kGap; } |
866 | 860 |
867 // Get the number of bytes available in the buffer. | 861 // Get the number of bytes available in the buffer. |
868 inline int available_space() const { return reloc_info_writer.pos() - pc_; } | 862 inline int available_space() const { return reloc_info_writer.pos() - pc_; } |
869 | 863 |
870 static bool IsNop(Address addr) { return *addr == 0x90; } | 864 static bool IsNop(Address addr) { return *addr == 0x90; } |
871 | 865 |
| 866 PositionsRecorder* positions_recorder() { return &positions_recorder_; } |
| 867 |
872 // Avoid overflows for displacements etc. | 868 // Avoid overflows for displacements etc. |
873 static const int kMaximalBufferSize = 512*MB; | 869 static const int kMaximalBufferSize = 512*MB; |
874 static const int kMinimalBufferSize = 4*KB; | 870 static const int kMinimalBufferSize = 4*KB; |
875 | 871 |
876 protected: | 872 protected: |
877 void movsd(XMMRegister dst, const Operand& src); | 873 void movsd(XMMRegister dst, const Operand& src); |
878 void movsd(const Operand& dst, XMMRegister src); | 874 void movsd(const Operand& dst, XMMRegister src); |
879 | 875 |
880 void emit_sse_operand(XMMRegister reg, const Operand& adr); | 876 void emit_sse_operand(XMMRegister reg, const Operand& adr); |
881 void emit_sse_operand(XMMRegister dst, XMMRegister src); | 877 void emit_sse_operand(XMMRegister dst, XMMRegister src); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 // A previously allocated buffer of kMinimalBufferSize bytes, or NULL. | 936 // A previously allocated buffer of kMinimalBufferSize bytes, or NULL. |
941 static byte* spare_buffer_; | 937 static byte* spare_buffer_; |
942 | 938 |
943 // code generation | 939 // code generation |
944 byte* pc_; // the program counter; moves forward | 940 byte* pc_; // the program counter; moves forward |
945 RelocInfoWriter reloc_info_writer; | 941 RelocInfoWriter reloc_info_writer; |
946 | 942 |
947 // push-pop elimination | 943 // push-pop elimination |
948 byte* last_pc_; | 944 byte* last_pc_; |
949 | 945 |
950 // source position information | 946 PositionsRecorder positions_recorder_; |
951 int current_statement_position_; | 947 |
952 int current_position_; | 948 friend class PositionsRecorder; |
953 int written_statement_position_; | |
954 int written_position_; | |
955 }; | 949 }; |
956 | 950 |
957 | 951 |
958 // Helper class that ensures that there is enough space for generating | 952 // Helper class that ensures that there is enough space for generating |
959 // instructions and relocation information. The constructor makes | 953 // instructions and relocation information. The constructor makes |
960 // sure that there is enough space and (in debug mode) the destructor | 954 // sure that there is enough space and (in debug mode) the destructor |
961 // checks that we did not generate too much. | 955 // checks that we did not generate too much. |
962 class EnsureSpace BASE_EMBEDDED { | 956 class EnsureSpace BASE_EMBEDDED { |
963 public: | 957 public: |
964 explicit EnsureSpace(Assembler* assembler) : assembler_(assembler) { | 958 explicit EnsureSpace(Assembler* assembler) : assembler_(assembler) { |
(...skipping 13 matching lines...) Expand all Loading... |
978 private: | 972 private: |
979 Assembler* assembler_; | 973 Assembler* assembler_; |
980 #ifdef DEBUG | 974 #ifdef DEBUG |
981 int space_before_; | 975 int space_before_; |
982 #endif | 976 #endif |
983 }; | 977 }; |
984 | 978 |
985 } } // namespace v8::internal | 979 } } // namespace v8::internal |
986 | 980 |
987 #endif // V8_IA32_ASSEMBLER_IA32_H_ | 981 #endif // V8_IA32_ASSEMBLER_IA32_H_ |
OLD | NEW |