OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 const char* V8NameConverter::NameOfAddress(byte* pc) const { | 67 const char* V8NameConverter::NameOfAddress(byte* pc) const { |
68 static v8::internal::EmbeddedVector<char, 128> buffer; | 68 static v8::internal::EmbeddedVector<char, 128> buffer; |
69 | 69 |
70 const char* name = Builtins::Lookup(pc); | 70 const char* name = Builtins::Lookup(pc); |
71 if (name != NULL) { | 71 if (name != NULL) { |
72 OS::SNPrintF(buffer, "%s (%p)", name, pc); | 72 OS::SNPrintF(buffer, "%s (%p)", name, pc); |
73 return buffer.start(); | 73 return buffer.start(); |
74 } | 74 } |
75 | 75 |
76 if (code_ != NULL) { | 76 if (code_ != NULL) { |
77 int offs = pc - code_->instruction_start(); | 77 int offs = static_cast<int>(pc - code_->instruction_start()); |
78 // print as code offset, if it seems reasonable | 78 // print as code offset, if it seems reasonable |
79 if (0 <= offs && offs < code_->instruction_size()) { | 79 if (0 <= offs && offs < code_->instruction_size()) { |
80 OS::SNPrintF(buffer, "%d (%p)", offs, pc); | 80 OS::SNPrintF(buffer, "%d (%p)", offs, pc); |
81 return buffer.start(); | 81 return buffer.start(); |
82 } | 82 } |
83 } | 83 } |
84 | 84 |
85 return disasm::NameConverter::NameOfAddress(pc); | 85 return disasm::NameConverter::NameOfAddress(pc); |
86 } | 86 } |
87 | 87 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 } else { | 282 } else { |
283 out.AddFormatted(" ;; %s", RelocInfo::RelocModeName(rmode)); | 283 out.AddFormatted(" ;; %s", RelocInfo::RelocModeName(rmode)); |
284 } | 284 } |
285 } | 285 } |
286 out.AddString("\n"); | 286 out.AddString("\n"); |
287 DumpBuffer(f, out.Finalize()); | 287 DumpBuffer(f, out.Finalize()); |
288 out.Reset(); | 288 out.Reset(); |
289 } | 289 } |
290 | 290 |
291 delete it; | 291 delete it; |
292 return pc - begin; | 292 return static_cast<int>(pc - begin); |
293 } | 293 } |
294 | 294 |
295 | 295 |
296 int Disassembler::Decode(FILE* f, byte* begin, byte* end) { | 296 int Disassembler::Decode(FILE* f, byte* begin, byte* end) { |
297 V8NameConverter defaultConverter(NULL); | 297 V8NameConverter defaultConverter(NULL); |
298 return DecodeIt(f, defaultConverter, begin, end); | 298 return DecodeIt(f, defaultConverter, begin, end); |
299 } | 299 } |
300 | 300 |
301 | 301 |
302 // Called by Code::CodePrint. | 302 // Called by Code::CodePrint. |
303 void Disassembler::Decode(FILE* f, Code* code) { | 303 void Disassembler::Decode(FILE* f, Code* code) { |
304 byte* begin = Code::cast(code)->instruction_start(); | 304 byte* begin = Code::cast(code)->instruction_start(); |
305 byte* end = begin + Code::cast(code)->instruction_size(); | 305 byte* end = begin + Code::cast(code)->instruction_size(); |
306 V8NameConverter v8NameConverter(code); | 306 V8NameConverter v8NameConverter(code); |
307 DecodeIt(f, v8NameConverter, begin, end); | 307 DecodeIt(f, v8NameConverter, begin, end); |
308 } | 308 } |
309 | 309 |
310 #else // ENABLE_DISASSEMBLER | 310 #else // ENABLE_DISASSEMBLER |
311 | 311 |
312 void Disassembler::Dump(FILE* f, byte* begin, byte* end) {} | 312 void Disassembler::Dump(FILE* f, byte* begin, byte* end) {} |
313 int Disassembler::Decode(FILE* f, byte* begin, byte* end) { return 0; } | 313 int Disassembler::Decode(FILE* f, byte* begin, byte* end) { return 0; } |
314 void Disassembler::Decode(FILE* f, Code* code) {} | 314 void Disassembler::Decode(FILE* f, Code* code) {} |
315 | 315 |
316 #endif // ENABLE_DISASSEMBLER | 316 #endif // ENABLE_DISASSEMBLER |
317 | 317 |
318 } } // namespace v8::internal | 318 } } // namespace v8::internal |
OLD | NEW |