| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 } | 140 } |
| 141 } | 141 } |
| 142 | 142 |
| 143 // Comments. | 143 // Comments. |
| 144 for (int i = 0; i < comments.length(); i++) { | 144 for (int i = 0; i < comments.length(); i++) { |
| 145 out.AddFormatted(" %s", comments[i]); | 145 out.AddFormatted(" %s", comments[i]); |
| 146 DumpBuffer(os, &out); | 146 DumpBuffer(os, &out); |
| 147 } | 147 } |
| 148 | 148 |
| 149 // Instruction address and instruction offset. | 149 // Instruction address and instruction offset. |
| 150 out.AddFormatted("%p %4td ", prev_pc, prev_pc - begin); | 150 out.AddFormatted("%p %4d ", prev_pc, prev_pc - begin); |
| 151 | 151 |
| 152 // Instruction. | 152 // Instruction. |
| 153 out.AddFormatted("%s", decode_buffer.start()); | 153 out.AddFormatted("%s", decode_buffer.start()); |
| 154 | 154 |
| 155 // 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. |
| 156 for (int i = 0; i < pcs.length(); i++) { | 156 for (int i = 0; i < pcs.length(); i++) { |
| 157 // Put together the reloc info | 157 // Put together the reloc info |
| 158 RelocInfo relocinfo(isolate, pcs[i], rmodes[i], datas[i], | 158 RelocInfo relocinfo(isolate, pcs[i], rmodes[i], datas[i], |
| 159 converter.code()); | 159 converter.code()); |
| 160 | 160 |
| 161 // Indent the printing of the reloc info. | 161 // Indent the printing of the reloc info. |
| 162 if (i == 0) { | 162 if (i == 0) { |
| 163 // The first reloc info is printed after the disassembled instruction. | 163 // The first reloc info is printed after the disassembled instruction. |
| 164 out.AddPadding(' ', kRelocInfoPosition - out.position()); | 164 out.AddPadding(' ', kRelocInfoPosition - out.position()); |
| 165 } else { | 165 } else { |
| 166 // Additional reloc infos are printed on separate lines. | 166 // Additional reloc infos are printed on separate lines. |
| 167 DumpBuffer(os, &out); | 167 DumpBuffer(os, &out); |
| 168 out.AddPadding(' ', kRelocInfoPosition); | 168 out.AddPadding(' ', kRelocInfoPosition); |
| 169 } | 169 } |
| 170 | 170 |
| 171 RelocInfo::Mode rmode = relocinfo.rmode(); | 171 RelocInfo::Mode rmode = relocinfo.rmode(); |
| 172 if (RelocInfo::IsPosition(rmode)) { | 172 if (RelocInfo::IsPosition(rmode)) { |
| 173 if (RelocInfo::IsStatementPosition(rmode)) { | 173 if (RelocInfo::IsStatementPosition(rmode)) { |
| 174 out.AddFormatted(" ;; debug: statement %" V8PRIdPTR, | 174 out.AddFormatted(" ;; debug: statement %d", relocinfo.data()); |
| 175 relocinfo.data()); | |
| 176 } else { | 175 } else { |
| 177 out.AddFormatted(" ;; debug: position %" V8PRIdPTR, | 176 out.AddFormatted(" ;; debug: position %d", relocinfo.data()); |
| 178 relocinfo.data()); | |
| 179 } | 177 } |
| 180 } else if (rmode == RelocInfo::DEOPT_REASON) { | 178 } else if (rmode == RelocInfo::DEOPT_REASON) { |
| 181 Deoptimizer::DeoptReason reason = | 179 Deoptimizer::DeoptReason reason = |
| 182 static_cast<Deoptimizer::DeoptReason>(relocinfo.data()); | 180 static_cast<Deoptimizer::DeoptReason>(relocinfo.data()); |
| 183 out.AddFormatted(" ;; debug: deopt reason '%s'", | 181 out.AddFormatted(" ;; debug: deopt reason '%s'", |
| 184 Deoptimizer::GetDeoptReason(reason)); | 182 Deoptimizer::GetDeoptReason(reason)); |
| 185 } else if (rmode == RelocInfo::EMBEDDED_OBJECT) { | 183 } else if (rmode == RelocInfo::EMBEDDED_OBJECT) { |
| 186 HeapStringAllocator allocator; | 184 HeapStringAllocator allocator; |
| 187 StringStream accumulator(&allocator); | 185 StringStream accumulator(&allocator); |
| 188 relocinfo.target_object()->ShortPrint(&accumulator); | 186 relocinfo.target_object()->ShortPrint(&accumulator); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 | 277 |
| 280 int Disassembler::Decode(Isolate* isolate, std::ostream* os, byte* begin, | 278 int Disassembler::Decode(Isolate* isolate, std::ostream* os, byte* begin, |
| 281 byte* end, Code* code) { | 279 byte* end, Code* code) { |
| 282 return 0; | 280 return 0; |
| 283 } | 281 } |
| 284 | 282 |
| 285 #endif // ENABLE_DISASSEMBLER | 283 #endif // ENABLE_DISASSEMBLER |
| 286 | 284 |
| 287 } // namespace internal | 285 } // namespace internal |
| 288 } // namespace v8 | 286 } // namespace v8 |
| OLD | NEW |