OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 #include "src/disassembler.h" | 5 #include "src/disassembler.h" |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 EmbeddedVector<char, 128> v8_buffer_; | 30 EmbeddedVector<char, 128> v8_buffer_; |
31 }; | 31 }; |
32 | 32 |
33 | 33 |
34 const char* V8NameConverter::NameOfAddress(byte* pc) const { | 34 const char* V8NameConverter::NameOfAddress(byte* pc) const { |
35 const char* name = | 35 const char* name = |
36 code_ == NULL ? NULL : code_->GetIsolate()->builtins()->Lookup(pc); | 36 code_ == NULL ? NULL : code_->GetIsolate()->builtins()->Lookup(pc); |
37 | 37 |
38 if (name != NULL) { | 38 if (name != NULL) { |
39 SNPrintF(v8_buffer_, "%s (%p)", name, pc); | 39 SNPrintF(v8_buffer_, "%s (%p)", name, static_cast<void*>(pc)); |
40 return v8_buffer_.start(); | 40 return v8_buffer_.start(); |
41 } | 41 } |
42 | 42 |
43 if (code_ != NULL) { | 43 if (code_ != NULL) { |
44 int offs = static_cast<int>(pc - code_->instruction_start()); | 44 int offs = static_cast<int>(pc - code_->instruction_start()); |
45 // print as code offset, if it seems reasonable | 45 // print as code offset, if it seems reasonable |
46 if (0 <= offs && offs < code_->instruction_size()) { | 46 if (0 <= offs && offs < code_->instruction_size()) { |
47 SNPrintF(v8_buffer_, "%d (%p)", offs, pc); | 47 SNPrintF(v8_buffer_, "%d (%p)", offs, static_cast<void*>(pc)); |
48 return v8_buffer_.start(); | 48 return v8_buffer_.start(); |
49 } | 49 } |
50 } | 50 } |
51 | 51 |
52 return disasm::NameConverter::NameOfAddress(pc); | 52 return disasm::NameConverter::NameOfAddress(pc); |
53 } | 53 } |
54 | 54 |
55 | 55 |
56 const char* V8NameConverter::NameInCode(byte* addr) const { | 56 const char* V8NameConverter::NameInCode(byte* addr) const { |
57 // The V8NameConverter is used for well known code, so we can "safely" | 57 // The V8NameConverter is used for well known code, so we can "safely" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 } | 139 } |
140 } | 140 } |
141 | 141 |
142 // Comments. | 142 // Comments. |
143 for (int i = 0; i < comments.length(); i++) { | 143 for (int i = 0; i < comments.length(); i++) { |
144 out.AddFormatted(" %s", comments[i]); | 144 out.AddFormatted(" %s", comments[i]); |
145 DumpBuffer(os, &out); | 145 DumpBuffer(os, &out); |
146 } | 146 } |
147 | 147 |
148 // Instruction address and instruction offset. | 148 // Instruction address and instruction offset. |
149 out.AddFormatted("%p %4" V8PRIdPTRDIFF " ", prev_pc, prev_pc - begin); | 149 out.AddFormatted("%p %4" V8PRIdPTRDIFF " ", static_cast<void*>(prev_pc), |
| 150 prev_pc - begin); |
150 | 151 |
151 // Instruction. | 152 // Instruction. |
152 out.AddFormatted("%s", decode_buffer.start()); | 153 out.AddFormatted("%s", decode_buffer.start()); |
153 | 154 |
154 // Print all the reloc info for this instruction which are not comments. | 155 // Print all the reloc info for this instruction which are not comments. |
155 for (int i = 0; i < pcs.length(); i++) { | 156 for (int i = 0; i < pcs.length(); i++) { |
156 // Put together the reloc info | 157 // Put together the reloc info |
157 RelocInfo relocinfo(isolate, pcs[i], rmodes[i], datas[i], | 158 RelocInfo relocinfo(isolate, pcs[i], rmodes[i], datas[i], |
158 converter.code()); | 159 converter.code()); |
159 | 160 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 | 282 |
282 int Disassembler::Decode(Isolate* isolate, std::ostream* os, byte* begin, | 283 int Disassembler::Decode(Isolate* isolate, std::ostream* os, byte* begin, |
283 byte* end, Code* code) { | 284 byte* end, Code* code) { |
284 return 0; | 285 return 0; |
285 } | 286 } |
286 | 287 |
287 #endif // ENABLE_DISASSEMBLER | 288 #endif // ENABLE_DISASSEMBLER |
288 | 289 |
289 } // namespace internal | 290 } // namespace internal |
290 } // namespace v8 | 291 } // namespace v8 |
OLD | NEW |