Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(337)

Side by Side Diff: src/gdbjit.h

Issue 5965011: Basic GDB JIT Interface integration. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: minor formatting cleanup Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 #ifndef V8_GDBJIT_H_
29 #define V8_GDBJIT_H_
30
31 #ifdef ENABLE_GDBJIT_INTERFACE
Erik Corry 2011/01/04 14:21:48 A few lines here on which gdb versions, OSs etc. t
Vyacheslav Egorov (Chromium) 2011/01/18 16:10:42 Done.
32 #include "v8.h"
33 #include "factory.h"
34
35 namespace v8 {
36 namespace internal {
37
38 #define CODE_TAGS_LIST(V) \
39 V(LOAD_IC) \
40 V(KEYED_LOAD_IC) \
41 V(STORE_IC) \
42 V(KEYED_STORE_IC) \
43 V(CALL_IC) \
44 V(CALL_INITIALIZE) \
45 V(CALL_PRE_MONOMORPHIC) \
46 V(CALL_NORMAL) \
47 V(CALL_MEGAMORPHIC) \
48 V(CALL_MISS) \
49 V(STUB) \
50 V(BUILTIN) \
51 V(SCRIPT) \
52 V(EVAL)
53
54 class GDBJITLineInfo : public Malloced {
55 public:
56 GDBJITLineInfo()
57 : pc_info_(10) { }
58
59 void SetPosition(intptr_t pc, int pos, bool is_statement) {
Erik Corry 2011/01/04 14:21:48 What is pos, a line number? The names of the func
Vyacheslav Egorov (Chromium) 2011/01/18 16:10:42 pos is used in common V8 sense --- position in str
60 AddPCInfo(PCInfo(pc, pos, is_statement));
61 }
62
63 struct PCInfo {
64 PCInfo(intptr_t pc, int pos, bool is_statement)
65 : pc_(pc), pos_(pos), is_statement_(is_statement) { }
66
67 intptr_t pc_;
68 int pos_;
69 bool is_statement_;
70 };
71
72 List<PCInfo>* pc_info() {
Erik Corry 2011/01/04 14:21:48 Lower case names are reserved for getters. Doing
Vyacheslav Egorov (Chromium) 2011/01/18 16:10:42 Done.
73 pc_info_.Sort(ComparePCInfo);
74 return &pc_info_;
75 }
76
77 private:
78 static int ComparePCInfo(const PCInfo* a, const PCInfo* b) {
79 if (a->pc_ == b->pc_ && a->is_statement_ != b->is_statement_) {
80 return b->is_statement_ ? +1 : -1;
81 }
82 return a->pc_ - b->pc_;
Erik Corry 2011/01/04 14:21:48 Subtracting two 64 bit values and returning the an
Vyacheslav Egorov (Chromium) 2011/01/18 16:10:42 Done.
83 }
84
85 void AddPCInfo(const PCInfo& pc_info) {
86 pc_info_.Add(pc_info);
87 }
88
89 List<PCInfo> pc_info_;
90 };
91
Erik Corry 2011/01/04 14:21:48 There should be two blank lines here.
Vyacheslav Egorov (Chromium) 2011/01/18 16:10:42 Done.
92 class GDBJITInterface: public AllStatic {
93 public:
94 enum CodeTag {
95 #define V(x) x,
96 CODE_TAGS_LIST(V)
97 #undef V
98 TAG_COUNT
99 };
100
101 static const char* Tag2String(CodeTag tag) {
102 switch (tag) {
103 #define V(x) case x: return #x;
104 CODE_TAGS_LIST(V)
105 #undef V
106 default:
107 return NULL;
108 }
109 }
110
111 static void AddCode(const char* name,
112 Code* code,
113 Script* script = NULL);
114
115 static void AddCode(Handle<String> name,
116 Handle<Script> script,
117 Handle<Code> code);
118
119 static void AddCode(CodeTag tag, String* name, Code* code);
120
121 static void AddCode(CodeTag tag, const char* name, Code* code);
122
123 static void AddCode(CodeTag tag, Code* code);
124
125 static void RemoveCode(Code* code);
126
127 static void RegisterDetailedLineInfo(Code* code, GDBJITLineInfo* line_info);
128 };
129
130 #define GDBJIT(action) GDBJITInterface::action
131
132 } } // namespace v8::internal
133 #else
134 #define GDBJIT(action) ((void) 0)
135 #endif
136
137 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698