| 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 // |
| 11 // Basic implementation of GDB JIT Interface client. | 11 // Basic implementation of GDB JIT Interface client. |
| 12 // GBD JIT Interface is supported in GDB 7.0 and above. | 12 // GBD JIT Interface is supported in GDB 7.0 and above. |
| 13 // Currently on x64 and ia32 architectures and Linux OS are supported. | 13 // Currently on x64 and ia32 architectures and Linux OS are supported. |
| 14 // | 14 // |
| 15 | 15 |
| 16 #ifdef ENABLE_GDB_JIT_INTERFACE | 16 #ifdef ENABLE_GDB_JIT_INTERFACE |
| 17 #include "src/v8.h" | 17 #include "src/v8.h" |
| 18 | 18 |
| 19 #include "src/factory.h" | 19 #include "src/factory.h" |
| 20 | 20 |
| 21 namespace v8 { | 21 namespace v8 { |
| 22 namespace internal { | 22 namespace internal { |
| 23 | 23 |
| 24 class CompilationInfo; | 24 class CompilationInfo; |
| 25 | 25 |
| 26 #define CODE_TAGS_LIST(V) \ | |
| 27 V(LOAD_IC) \ | |
| 28 V(KEYED_LOAD_IC) \ | |
| 29 V(STORE_IC) \ | |
| 30 V(KEYED_STORE_IC) \ | |
| 31 V(STUB) \ | |
| 32 V(BUILTIN) \ | |
| 33 V(SCRIPT) \ | |
| 34 V(EVAL) \ | |
| 35 V(FUNCTION) | |
| 36 | |
| 37 class GDBJITInterface: public AllStatic { | 26 class GDBJITInterface: public AllStatic { |
| 38 public: | 27 public: |
| 39 enum CodeTag { | 28 enum CodeTag { NON_FUNCTION, FUNCTION }; |
| 40 #define V(x) x, | |
| 41 CODE_TAGS_LIST(V) | |
| 42 #undef V | |
| 43 TAG_COUNT | |
| 44 }; | |
| 45 | |
| 46 static const char* Tag2String(CodeTag tag) { | |
| 47 switch (tag) { | |
| 48 #define V(x) case x: return #x; | |
| 49 CODE_TAGS_LIST(V) | |
| 50 #undef V | |
| 51 default: | |
| 52 return NULL; | |
| 53 } | |
| 54 } | |
| 55 | 29 |
| 56 // Main entry point into GDB JIT realized as a JitCodeEventHandler. | 30 // Main entry point into GDB JIT realized as a JitCodeEventHandler. |
| 57 static void EventHandler(const v8::JitCodeEvent* event); | 31 static void EventHandler(const v8::JitCodeEvent* event); |
| 58 | 32 |
| 59 static void AddCode(const char* name, | |
| 60 Code* code, | |
| 61 CodeTag tag, | |
| 62 Script* script, | |
| 63 CompilationInfo* info); | |
| 64 | |
| 65 static void AddCode(Handle<Name> name, | 33 static void AddCode(Handle<Name> name, |
| 66 Handle<Script> script, | 34 Handle<Script> script, |
| 67 Handle<Code> code, | 35 Handle<Code> code, |
| 68 CompilationInfo* info); | 36 CompilationInfo* info); |
| 69 | 37 |
| 70 static void AddCode(CodeTag tag, Name* name, Code* code); | 38 static void RemoveCodeRange(Address start, Address end); |
| 71 | 39 |
| 72 static void AddCode(CodeTag tag, const char* name, Code* code); | 40 private: |
| 73 | 41 static void AddCode(const char* name, Code* code, CodeTag tag, Script* script, |
| 74 static void AddCode(CodeTag tag, Code* code); | 42 CompilationInfo* info); |
| 75 | 43 |
| 76 static void RemoveCode(Code* code); | 44 static void RemoveCode(Code* code); |
| 77 | |
| 78 static void RemoveCodeRange(Address start, Address end); | |
| 79 }; | 45 }; |
| 80 | 46 |
| 81 #define GDBJIT(action) GDBJITInterface::action | 47 #define GDBJIT(action) GDBJITInterface::action |
| 82 | 48 |
| 83 } } // namespace v8::internal | 49 } } // namespace v8::internal |
| 84 #else | 50 #else |
| 85 #define GDBJIT(action) ((void) 0) | 51 #define GDBJIT(action) ((void) 0) |
| 86 #endif | 52 #endif |
| 87 | 53 |
| 88 #endif | 54 #endif |
| OLD | NEW |