| 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/v8.h" | 5 #include "src/v8.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.h" | 9 #include "src/debug.h" |
| 10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 const char* name = code_->GetIsolate()->builtins()->Lookup(pc); | 36 const char* name = code_->GetIsolate()->builtins()->Lookup(pc); |
| 37 if (name != NULL) { | 37 if (name != NULL) { |
| 38 SNPrintF(v8_buffer_, "%s (%p)", name, pc); | 38 SNPrintF(v8_buffer_, "%s (%p)", name, pc); |
| 39 return v8_buffer_.start(); | 39 return v8_buffer_.start(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 if (code_ != NULL) { | 42 if (code_ != NULL) { |
| 43 int offs = static_cast<int>(pc - code_->instruction_start()); | 43 int offs = static_cast<int>(pc - code_->instruction_start()); |
| 44 // print as code offset, if it seems reasonable | 44 // print as code offset, if it seems reasonable |
| 45 if (0 <= offs && offs < code_->instruction_size()) { | 45 if (0 <= offs && offs < code_->instruction_size()) { |
| 46 SNPrintF(v8_buffer_, "%x (%p)", offs, pc); | 46 SNPrintF(v8_buffer_, "%d (%p)", offs, pc); |
| 47 return v8_buffer_.start(); | 47 return v8_buffer_.start(); |
| 48 } | 48 } |
| 49 } | 49 } |
| 50 | 50 |
| 51 return disasm::NameConverter::NameOfAddress(pc); | 51 return disasm::NameConverter::NameOfAddress(pc); |
| 52 } | 52 } |
| 53 | 53 |
| 54 | 54 |
| 55 const char* V8NameConverter::NameInCode(byte* addr) const { | 55 const char* V8NameConverter::NameInCode(byte* addr) const { |
| 56 // The V8NameConverter is used for well known code, so we can "safely" | 56 // The V8NameConverter is used for well known code, so we can "safely" |
| (...skipping 82 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 %4x ", prev_pc, prev_pc - begin); | 149 out.AddFormatted("%p %4d ", prev_pc, prev_pc - begin); |
| 150 | 150 |
| 151 // Instruction. | 151 // Instruction. |
| 152 out.AddFormatted("%s", decode_buffer.start()); | 152 out.AddFormatted("%s", decode_buffer.start()); |
| 153 | 153 |
| 154 // Print all the reloc info for this instruction which are not comments. | 154 // Print all the reloc info for this instruction which are not comments. |
| 155 for (int i = 0; i < pcs.length(); i++) { | 155 for (int i = 0; i < pcs.length(); i++) { |
| 156 // Put together the reloc info | 156 // Put together the reloc info |
| 157 RelocInfo relocinfo(pcs[i], rmodes[i], datas[i], converter.code()); | 157 RelocInfo relocinfo(pcs[i], rmodes[i], datas[i], converter.code()); |
| 158 | 158 |
| 159 // Indent the printing of the reloc info. | 159 // Indent the printing of the reloc info. |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 | 290 |
| 291 int Disassembler::Decode(Isolate* isolate, std::ostream* os, byte* begin, | 291 int Disassembler::Decode(Isolate* isolate, std::ostream* os, byte* begin, |
| 292 byte* end, Code* code) { | 292 byte* end, Code* code) { |
| 293 return 0; | 293 return 0; |
| 294 } | 294 } |
| 295 | 295 |
| 296 #endif // ENABLE_DISASSEMBLER | 296 #endif // ENABLE_DISASSEMBLER |
| 297 | 297 |
| 298 } // namespace internal | 298 } // namespace internal |
| 299 } // namespace v8 | 299 } // namespace v8 |
| OLD | NEW |