| 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 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 }; | 837 }; |
| 838 | 838 |
| 839 | 839 |
| 840 class PositionsRecorder BASE_EMBEDDED { | 840 class PositionsRecorder BASE_EMBEDDED { |
| 841 public: | 841 public: |
| 842 explicit PositionsRecorder(Assembler* assembler) | 842 explicit PositionsRecorder(Assembler* assembler) |
| 843 : assembler_(assembler) { | 843 : assembler_(assembler) { |
| 844 #ifdef ENABLE_GDB_JIT_INTERFACE | 844 #ifdef ENABLE_GDB_JIT_INTERFACE |
| 845 gdbjit_lineinfo_ = NULL; | 845 gdbjit_lineinfo_ = NULL; |
| 846 #endif | 846 #endif |
| 847 jit_handler_data_ = NULL; |
| 847 } | 848 } |
| 848 | 849 |
| 849 #ifdef ENABLE_GDB_JIT_INTERFACE | 850 #ifdef ENABLE_GDB_JIT_INTERFACE |
| 850 ~PositionsRecorder() { | 851 ~PositionsRecorder() { |
| 851 delete gdbjit_lineinfo_; | 852 delete gdbjit_lineinfo_; |
| 852 } | 853 } |
| 853 | 854 |
| 854 void StartGDBJITLineInfoRecording() { | 855 void StartGDBJITLineInfoRecording() { |
| 855 if (FLAG_gdbjit) { | 856 if (FLAG_gdbjit) { |
| 856 gdbjit_lineinfo_ = new GDBJITLineInfo(); | 857 gdbjit_lineinfo_ = new GDBJITLineInfo(); |
| 857 } | 858 } |
| 858 } | 859 } |
| 859 | 860 |
| 860 GDBJITLineInfo* DetachGDBJITLineInfo() { | 861 GDBJITLineInfo* DetachGDBJITLineInfo() { |
| 861 GDBJITLineInfo* lineinfo = gdbjit_lineinfo_; | 862 GDBJITLineInfo* lineinfo = gdbjit_lineinfo_; |
| 862 gdbjit_lineinfo_ = NULL; // To prevent deallocation in destructor. | 863 gdbjit_lineinfo_ = NULL; // To prevent deallocation in destructor. |
| 863 return lineinfo; | 864 return lineinfo; |
| 864 } | 865 } |
| 865 #endif | 866 #endif |
| 867 void AttachJITHandlerData(void* user_data) { |
| 868 jit_handler_data_ = user_data; |
| 869 } |
| 866 | 870 |
| 871 void* DetachJITHandlerData() { |
| 872 void* old_data = jit_handler_data_; |
| 873 jit_handler_data_ = NULL; |
| 874 return old_data; |
| 875 } |
| 867 // Set current position to pos. | 876 // Set current position to pos. |
| 868 void RecordPosition(int pos); | 877 void RecordPosition(int pos); |
| 869 | 878 |
| 870 // Set current statement position to pos. | 879 // Set current statement position to pos. |
| 871 void RecordStatementPosition(int pos); | 880 void RecordStatementPosition(int pos); |
| 872 | 881 |
| 873 // Write recorded positions to relocation information. | 882 // Write recorded positions to relocation information. |
| 874 bool WriteRecordedPositions(); | 883 bool WriteRecordedPositions(); |
| 875 | 884 |
| 876 int current_position() const { return state_.current_position; } | 885 int current_position() const { return state_.current_position; } |
| 877 | 886 |
| 878 int current_statement_position() const { | 887 int current_statement_position() const { |
| 879 return state_.current_statement_position; | 888 return state_.current_statement_position; |
| 880 } | 889 } |
| 881 | 890 |
| 882 private: | 891 private: |
| 883 Assembler* assembler_; | 892 Assembler* assembler_; |
| 884 PositionState state_; | 893 PositionState state_; |
| 885 #ifdef ENABLE_GDB_JIT_INTERFACE | 894 #ifdef ENABLE_GDB_JIT_INTERFACE |
| 886 GDBJITLineInfo* gdbjit_lineinfo_; | 895 GDBJITLineInfo* gdbjit_lineinfo_; |
| 887 #endif | 896 #endif |
| 888 | 897 |
| 898 // Currently jit_handler_data_ is used to store JITHandler-specific data |
| 899 // over the lifetime of a PositionsRecorder |
| 900 void* jit_handler_data_; |
| 889 friend class PreservePositionScope; | 901 friend class PreservePositionScope; |
| 890 | 902 |
| 891 DISALLOW_COPY_AND_ASSIGN(PositionsRecorder); | 903 DISALLOW_COPY_AND_ASSIGN(PositionsRecorder); |
| 892 }; | 904 }; |
| 893 | 905 |
| 894 | 906 |
| 895 class PreservePositionScope BASE_EMBEDDED { | 907 class PreservePositionScope BASE_EMBEDDED { |
| 896 public: | 908 public: |
| 897 explicit PreservePositionScope(PositionsRecorder* positions_recorder) | 909 explicit PreservePositionScope(PositionsRecorder* positions_recorder) |
| 898 : positions_recorder_(positions_recorder), | 910 : positions_recorder_(positions_recorder), |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 public: | 983 public: |
| 972 NullCallWrapper() { } | 984 NullCallWrapper() { } |
| 973 virtual ~NullCallWrapper() { } | 985 virtual ~NullCallWrapper() { } |
| 974 virtual void BeforeCall(int call_size) const { } | 986 virtual void BeforeCall(int call_size) const { } |
| 975 virtual void AfterCall() const { } | 987 virtual void AfterCall() const { } |
| 976 }; | 988 }; |
| 977 | 989 |
| 978 } } // namespace v8::internal | 990 } } // namespace v8::internal |
| 979 | 991 |
| 980 #endif // V8_ASSEMBLER_H_ | 992 #endif // V8_ASSEMBLER_H_ |
| OLD | NEW |