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 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 | 1015 |
1016 int current_statement_position; | 1016 int current_statement_position; |
1017 int written_statement_position; | 1017 int written_statement_position; |
1018 }; | 1018 }; |
1019 | 1019 |
1020 | 1020 |
1021 class PositionsRecorder BASE_EMBEDDED { | 1021 class PositionsRecorder BASE_EMBEDDED { |
1022 public: | 1022 public: |
1023 explicit PositionsRecorder(Assembler* assembler) | 1023 explicit PositionsRecorder(Assembler* assembler) |
1024 : assembler_(assembler) { | 1024 : assembler_(assembler) { |
1025 #ifdef ENABLE_GDB_JIT_INTERFACE | |
1026 gdbjit_lineinfo_ = NULL; | |
1027 #endif | |
1028 jit_handler_data_ = NULL; | 1025 jit_handler_data_ = NULL; |
1029 } | 1026 } |
1030 | 1027 |
1031 #ifdef ENABLE_GDB_JIT_INTERFACE | |
1032 ~PositionsRecorder() { | |
1033 delete gdbjit_lineinfo_; | |
1034 } | |
1035 | |
1036 void StartGDBJITLineInfoRecording() { | |
1037 if (FLAG_gdbjit) { | |
1038 gdbjit_lineinfo_ = new GDBJITLineInfo(); | |
1039 } | |
1040 } | |
1041 | |
1042 GDBJITLineInfo* DetachGDBJITLineInfo() { | |
1043 GDBJITLineInfo* lineinfo = gdbjit_lineinfo_; | |
1044 gdbjit_lineinfo_ = NULL; // To prevent deallocation in destructor. | |
1045 return lineinfo; | |
1046 } | |
1047 #endif | |
1048 void AttachJITHandlerData(void* user_data) { | 1028 void AttachJITHandlerData(void* user_data) { |
1049 jit_handler_data_ = user_data; | 1029 jit_handler_data_ = user_data; |
1050 } | 1030 } |
1051 | 1031 |
1052 void* DetachJITHandlerData() { | 1032 void* DetachJITHandlerData() { |
1053 void* old_data = jit_handler_data_; | 1033 void* old_data = jit_handler_data_; |
1054 jit_handler_data_ = NULL; | 1034 jit_handler_data_ = NULL; |
1055 return old_data; | 1035 return old_data; |
1056 } | 1036 } |
1057 // Set current position to pos. | 1037 // Set current position to pos. |
1058 void RecordPosition(int pos); | 1038 void RecordPosition(int pos); |
1059 | 1039 |
1060 // Set current statement position to pos. | 1040 // Set current statement position to pos. |
1061 void RecordStatementPosition(int pos); | 1041 void RecordStatementPosition(int pos); |
1062 | 1042 |
1063 // Write recorded positions to relocation information. | 1043 // Write recorded positions to relocation information. |
1064 bool WriteRecordedPositions(); | 1044 bool WriteRecordedPositions(); |
1065 | 1045 |
1066 int current_position() const { return state_.current_position; } | 1046 int current_position() const { return state_.current_position; } |
1067 | 1047 |
1068 int current_statement_position() const { | 1048 int current_statement_position() const { |
1069 return state_.current_statement_position; | 1049 return state_.current_statement_position; |
1070 } | 1050 } |
1071 | 1051 |
1072 private: | 1052 private: |
1073 Assembler* assembler_; | 1053 Assembler* assembler_; |
1074 PositionState state_; | 1054 PositionState state_; |
1075 #ifdef ENABLE_GDB_JIT_INTERFACE | |
1076 GDBJITLineInfo* gdbjit_lineinfo_; | |
1077 #endif | |
1078 | 1055 |
1079 // Currently jit_handler_data_ is used to store JITHandler-specific data | 1056 // Currently jit_handler_data_ is used to store JITHandler-specific data |
1080 // over the lifetime of a PositionsRecorder | 1057 // over the lifetime of a PositionsRecorder |
1081 void* jit_handler_data_; | 1058 void* jit_handler_data_; |
1082 friend class PreservePositionScope; | 1059 friend class PreservePositionScope; |
1083 | 1060 |
1084 DISALLOW_COPY_AND_ASSIGN(PositionsRecorder); | 1061 DISALLOW_COPY_AND_ASSIGN(PositionsRecorder); |
1085 }; | 1062 }; |
1086 | 1063 |
1087 | 1064 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1154 | 1131 |
1155 private: | 1132 private: |
1156 int32_t multiplier_; | 1133 int32_t multiplier_; |
1157 int32_t shift_; | 1134 int32_t shift_; |
1158 }; | 1135 }; |
1159 | 1136 |
1160 | 1137 |
1161 } } // namespace v8::internal | 1138 } } // namespace v8::internal |
1162 | 1139 |
1163 #endif // V8_ASSEMBLER_H_ | 1140 #endif // V8_ASSEMBLER_H_ |
OLD | NEW |