| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_GDB_JIT_H_ | 5 #ifndef V8_GDB_JIT_H_ |
| 6 #define V8_GDB_JIT_H_ | 6 #define V8_GDB_JIT_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 | 9 |
| 10 // | 10 // |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 V(LOAD_IC) \ | 27 V(LOAD_IC) \ |
| 28 V(KEYED_LOAD_IC) \ | 28 V(KEYED_LOAD_IC) \ |
| 29 V(STORE_IC) \ | 29 V(STORE_IC) \ |
| 30 V(KEYED_STORE_IC) \ | 30 V(KEYED_STORE_IC) \ |
| 31 V(STUB) \ | 31 V(STUB) \ |
| 32 V(BUILTIN) \ | 32 V(BUILTIN) \ |
| 33 V(SCRIPT) \ | 33 V(SCRIPT) \ |
| 34 V(EVAL) \ | 34 V(EVAL) \ |
| 35 V(FUNCTION) | 35 V(FUNCTION) |
| 36 | 36 |
| 37 class GDBJITLineInfo : public Malloced { | |
| 38 public: | |
| 39 GDBJITLineInfo() | |
| 40 : pc_info_(10) { } | |
| 41 | |
| 42 void SetPosition(intptr_t pc, int pos, bool is_statement) { | |
| 43 AddPCInfo(PCInfo(pc, pos, is_statement)); | |
| 44 } | |
| 45 | |
| 46 struct PCInfo { | |
| 47 PCInfo(intptr_t pc, int pos, bool is_statement) | |
| 48 : pc_(pc), pos_(pos), is_statement_(is_statement) { } | |
| 49 | |
| 50 intptr_t pc_; | |
| 51 int pos_; | |
| 52 bool is_statement_; | |
| 53 }; | |
| 54 | |
| 55 List<PCInfo>* pc_info() { | |
| 56 return &pc_info_; | |
| 57 } | |
| 58 | |
| 59 private: | |
| 60 void AddPCInfo(const PCInfo& pc_info) { | |
| 61 pc_info_.Add(pc_info); | |
| 62 } | |
| 63 | |
| 64 List<PCInfo> pc_info_; | |
| 65 }; | |
| 66 | |
| 67 | |
| 68 class GDBJITInterface: public AllStatic { | 37 class GDBJITInterface: public AllStatic { |
| 69 public: | 38 public: |
| 70 enum CodeTag { | 39 enum CodeTag { |
| 71 #define V(x) x, | 40 #define V(x) x, |
| 72 CODE_TAGS_LIST(V) | 41 CODE_TAGS_LIST(V) |
| 73 #undef V | 42 #undef V |
| 74 TAG_COUNT | 43 TAG_COUNT |
| 75 }; | 44 }; |
| 76 | 45 |
| 77 static const char* Tag2String(CodeTag tag) { | 46 static const char* Tag2String(CodeTag tag) { |
| 78 switch (tag) { | 47 switch (tag) { |
| 79 #define V(x) case x: return #x; | 48 #define V(x) case x: return #x; |
| 80 CODE_TAGS_LIST(V) | 49 CODE_TAGS_LIST(V) |
| 81 #undef V | 50 #undef V |
| 82 default: | 51 default: |
| 83 return NULL; | 52 return NULL; |
| 84 } | 53 } |
| 85 } | 54 } |
| 86 | 55 |
| 56 // Main entry point into GDB JIT realized as a JitCodeEventHandler. |
| 57 static void EventHandler(const v8::JitCodeEvent* event); |
| 58 |
| 87 static void AddCode(const char* name, | 59 static void AddCode(const char* name, |
| 88 Code* code, | 60 Code* code, |
| 89 CodeTag tag, | 61 CodeTag tag, |
| 90 Script* script, | 62 Script* script, |
| 91 CompilationInfo* info); | 63 CompilationInfo* info); |
| 92 | 64 |
| 93 static void AddCode(Handle<Name> name, | 65 static void AddCode(Handle<Name> name, |
| 94 Handle<Script> script, | 66 Handle<Script> script, |
| 95 Handle<Code> code, | 67 Handle<Code> code, |
| 96 CompilationInfo* info); | 68 CompilationInfo* info); |
| 97 | 69 |
| 98 static void AddCode(CodeTag tag, Name* name, Code* code); | 70 static void AddCode(CodeTag tag, Name* name, Code* code); |
| 99 | 71 |
| 100 static void AddCode(CodeTag tag, const char* name, Code* code); | 72 static void AddCode(CodeTag tag, const char* name, Code* code); |
| 101 | 73 |
| 102 static void AddCode(CodeTag tag, Code* code); | 74 static void AddCode(CodeTag tag, Code* code); |
| 103 | 75 |
| 104 static void RemoveCode(Code* code); | 76 static void RemoveCode(Code* code); |
| 105 | 77 |
| 106 static void RemoveCodeRange(Address start, Address end); | 78 static void RemoveCodeRange(Address start, Address end); |
| 107 | |
| 108 static void RegisterDetailedLineInfo(Code* code, GDBJITLineInfo* line_info); | |
| 109 }; | 79 }; |
| 110 | 80 |
| 111 #define GDBJIT(action) GDBJITInterface::action | 81 #define GDBJIT(action) GDBJITInterface::action |
| 112 | 82 |
| 113 } } // namespace v8::internal | 83 } } // namespace v8::internal |
| 114 #else | 84 #else |
| 115 #define GDBJIT(action) ((void) 0) | 85 #define GDBJIT(action) ((void) 0) |
| 116 #endif | 86 #endif |
| 117 | 87 |
| 118 #endif | 88 #endif |
| OLD | NEW |