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 25 matching lines...) Expand all Loading... | |
36 #define V8_ASSEMBLER_H_ | 36 #define V8_ASSEMBLER_H_ |
37 | 37 |
38 #include "v8.h" | 38 #include "v8.h" |
39 | 39 |
40 #include "allocation.h" | 40 #include "allocation.h" |
41 #include "builtins.h" | 41 #include "builtins.h" |
42 #include "gdb-jit.h" | 42 #include "gdb-jit.h" |
43 #include "isolate.h" | 43 #include "isolate.h" |
44 #include "runtime.h" | 44 #include "runtime.h" |
45 #include "token.h" | 45 #include "token.h" |
46 #include "third_party/vtune/vtune-jit.h" | |
46 | 47 |
47 namespace v8 { | 48 namespace v8 { |
48 | 49 |
49 class ApiFunction; | 50 class ApiFunction; |
50 | 51 |
51 namespace internal { | 52 namespace internal { |
52 | 53 |
53 struct StatsCounter; | 54 struct StatsCounter; |
54 const unsigned kNoASTId = -1; | 55 const unsigned kNoASTId = -1; |
55 // ----------------------------------------------------------------------------- | 56 // ----------------------------------------------------------------------------- |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
757 }; | 758 }; |
758 | 759 |
759 | 760 |
760 class PositionsRecorder BASE_EMBEDDED { | 761 class PositionsRecorder BASE_EMBEDDED { |
761 public: | 762 public: |
762 explicit PositionsRecorder(Assembler* assembler) | 763 explicit PositionsRecorder(Assembler* assembler) |
763 : assembler_(assembler) { | 764 : assembler_(assembler) { |
764 #ifdef ENABLE_GDB_JIT_INTERFACE | 765 #ifdef ENABLE_GDB_JIT_INTERFACE |
765 gdbjit_lineinfo_ = NULL; | 766 gdbjit_lineinfo_ = NULL; |
766 #endif | 767 #endif |
768 #ifdef ENABLE_VTUNE_JIT_INTERFACE | |
769 vtunejit_lineinfo_ = NULL; | |
770 #endif | |
771 } | |
772 | |
773 ~PositionsRecorder() { | |
774 #ifdef ENABLE_GDB_JIT_INTERFACE | |
775 delete gdbjit_lineinfo_; | |
776 #endif | |
777 #ifdef ENABLE_VTUNE_JIT_INTERFACE | |
778 delete vtunejit_lineinfo_; | |
779 #endif | |
767 } | 780 } |
768 | 781 |
769 #ifdef ENABLE_GDB_JIT_INTERFACE | 782 #ifdef ENABLE_GDB_JIT_INTERFACE |
770 ~PositionsRecorder() { | |
771 delete gdbjit_lineinfo_; | |
772 } | |
773 | |
774 void StartGDBJITLineInfoRecording() { | 783 void StartGDBJITLineInfoRecording() { |
775 if (FLAG_gdbjit) { | 784 if (FLAG_gdbjit) { |
776 gdbjit_lineinfo_ = new GDBJITLineInfo(); | 785 gdbjit_lineinfo_ = new GDBJITLineInfo(); |
777 } | 786 } |
778 } | 787 } |
779 | 788 |
780 GDBJITLineInfo* DetachGDBJITLineInfo() { | 789 GDBJITLineInfo* DetachGDBJITLineInfo() { |
781 GDBJITLineInfo* lineinfo = gdbjit_lineinfo_; | 790 GDBJITLineInfo* lineinfo = gdbjit_lineinfo_; |
782 gdbjit_lineinfo_ = NULL; // To prevent deallocation in destructor. | 791 gdbjit_lineinfo_ = NULL; // To prevent deallocation in destructor. |
783 return lineinfo; | 792 return lineinfo; |
784 } | 793 } |
785 #endif | 794 #endif |
786 | 795 |
796 #ifdef ENABLE_VTUNE_JIT_INTERFACE | |
797 void StartVtuneJITLineInfoRecording() { | |
798 vtunejit_lineinfo_ = new VtuneJITLineInfo(); | |
799 } | |
800 | |
801 VtuneJITLineInfo* DetachVtuneJITLineInfo() { | |
802 VtuneJITLineInfo* lineinfo = vtunejit_lineinfo_; | |
803 vtunejit_lineinfo_ = NULL; | |
804 return lineinfo; | |
805 } | |
806 #endif | |
807 | |
787 // Set current position to pos. | 808 // Set current position to pos. |
788 void RecordPosition(int pos); | 809 void RecordPosition(int pos); |
789 | 810 |
790 // Set current statement position to pos. | 811 // Set current statement position to pos. |
791 void RecordStatementPosition(int pos); | 812 void RecordStatementPosition(int pos); |
792 | 813 |
793 // Write recorded positions to relocation information. | 814 // Write recorded positions to relocation information. |
794 bool WriteRecordedPositions(); | 815 bool WriteRecordedPositions(); |
795 | 816 |
796 int current_position() const { return state_.current_position; } | 817 int current_position() const { return state_.current_position; } |
797 | 818 |
798 int current_statement_position() const { | 819 int current_statement_position() const { |
799 return state_.current_statement_position; | 820 return state_.current_statement_position; |
800 } | 821 } |
801 | 822 |
802 private: | 823 private: |
803 Assembler* assembler_; | 824 Assembler* assembler_; |
804 PositionState state_; | 825 PositionState state_; |
805 #ifdef ENABLE_GDB_JIT_INTERFACE | 826 #ifdef ENABLE_GDB_JIT_INTERFACE |
806 GDBJITLineInfo* gdbjit_lineinfo_; | 827 GDBJITLineInfo* gdbjit_lineinfo_; |
807 #endif | 828 #endif |
829 #ifdef ENABLE_VTUNE_JIT_INTERFACE | |
830 VtuneJITLineInfo* vtunejit_lineinfo_; | |
danno
2012/08/02 12:38:11
Generalize to jit_code_event_line_info_
| |
831 #endif | |
808 | 832 |
809 friend class PreservePositionScope; | 833 friend class PreservePositionScope; |
810 | 834 |
811 DISALLOW_COPY_AND_ASSIGN(PositionsRecorder); | 835 DISALLOW_COPY_AND_ASSIGN(PositionsRecorder); |
812 }; | 836 }; |
813 | 837 |
814 | 838 |
815 class PreservePositionScope BASE_EMBEDDED { | 839 class PreservePositionScope BASE_EMBEDDED { |
816 public: | 840 public: |
817 explicit PreservePositionScope(PositionsRecorder* positions_recorder) | 841 explicit PreservePositionScope(PositionsRecorder* positions_recorder) |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
891 public: | 915 public: |
892 NullCallWrapper() { } | 916 NullCallWrapper() { } |
893 virtual ~NullCallWrapper() { } | 917 virtual ~NullCallWrapper() { } |
894 virtual void BeforeCall(int call_size) const { } | 918 virtual void BeforeCall(int call_size) const { } |
895 virtual void AfterCall() const { } | 919 virtual void AfterCall() const { } |
896 }; | 920 }; |
897 | 921 |
898 } } // namespace v8::internal | 922 } } // namespace v8::internal |
899 | 923 |
900 #endif // V8_ASSEMBLER_H_ | 924 #endif // V8_ASSEMBLER_H_ |
OLD | NEW |