OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #ifdef ENABLE_DISASSEMBLER | 43 #ifdef ENABLE_DISASSEMBLER |
44 | 44 |
45 void Disassembler::Dump(FILE* f, byte* begin, byte* end) { | 45 void Disassembler::Dump(FILE* f, byte* begin, byte* end) { |
46 for (byte* pc = begin; pc < end; pc++) { | 46 for (byte* pc = begin; pc < end; pc++) { |
47 if (f == NULL) { | 47 if (f == NULL) { |
48 PrintF("%" V8PRIxPTR " %4" V8PRIdPTR " %02x\n", | 48 PrintF("%" V8PRIxPTR " %4" V8PRIdPTR " %02x\n", |
49 reinterpret_cast<intptr_t>(pc), | 49 reinterpret_cast<intptr_t>(pc), |
50 pc - begin, | 50 pc - begin, |
51 *pc); | 51 *pc); |
52 } else { | 52 } else { |
53 fprintf(f, "%" V8PRIxPTR " %4" V8PRIdPTR " %02x\n", | 53 PrintF(f, "%" V8PRIxPTR " %4" V8PRIdPTR " %02x\n", |
54 reinterpret_cast<uintptr_t>(pc), pc - begin, *pc); | 54 reinterpret_cast<uintptr_t>(pc), pc - begin, *pc); |
55 } | 55 } |
56 } | 56 } |
57 } | 57 } |
58 | 58 |
59 | 59 |
60 class V8NameConverter: public disasm::NameConverter { | 60 class V8NameConverter: public disasm::NameConverter { |
61 public: | 61 public: |
62 explicit V8NameConverter(Code* code) : code_(code) {} | 62 explicit V8NameConverter(Code* code) : code_(code) {} |
63 virtual const char* NameOfAddress(byte* pc) const; | 63 virtual const char* NameOfAddress(byte* pc) const; |
64 virtual const char* NameInCode(byte* addr) const; | 64 virtual const char* NameInCode(byte* addr) const; |
(...skipping 29 matching lines...) Expand all Loading... |
94 // The V8NameConverter is used for well known code, so we can "safely" | 94 // The V8NameConverter is used for well known code, so we can "safely" |
95 // dereference pointers in generated code. | 95 // dereference pointers in generated code. |
96 return (code_ != NULL) ? reinterpret_cast<const char*>(addr) : ""; | 96 return (code_ != NULL) ? reinterpret_cast<const char*>(addr) : ""; |
97 } | 97 } |
98 | 98 |
99 | 99 |
100 static void DumpBuffer(FILE* f, StringBuilder* out) { | 100 static void DumpBuffer(FILE* f, StringBuilder* out) { |
101 if (f == NULL) { | 101 if (f == NULL) { |
102 PrintF("%s\n", out->Finalize()); | 102 PrintF("%s\n", out->Finalize()); |
103 } else { | 103 } else { |
104 fprintf(f, "%s\n", out->Finalize()); | 104 PrintF(f, "%s\n", out->Finalize()); |
105 } | 105 } |
106 out->Reset(); | 106 out->Reset(); |
107 } | 107 } |
108 | 108 |
109 | 109 |
110 | 110 |
111 static const int kOutBufferSize = 2048 + String::kMaxShortPrintLength; | 111 static const int kOutBufferSize = 2048 + String::kMaxShortPrintLength; |
112 static const int kRelocInfoPosition = 57; | 112 static const int kRelocInfoPosition = 57; |
113 | 113 |
114 static int DecodeIt(Isolate* isolate, | 114 static int DecodeIt(Isolate* isolate, |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 | 353 |
354 void Disassembler::Dump(FILE* f, byte* begin, byte* end) {} | 354 void Disassembler::Dump(FILE* f, byte* begin, byte* end) {} |
355 int Disassembler::Decode(Isolate* isolate, FILE* f, byte* begin, byte* end) { | 355 int Disassembler::Decode(Isolate* isolate, FILE* f, byte* begin, byte* end) { |
356 return 0; | 356 return 0; |
357 } | 357 } |
358 void Disassembler::Decode(FILE* f, Code* code) {} | 358 void Disassembler::Decode(FILE* f, Code* code) {} |
359 | 359 |
360 #endif // ENABLE_DISASSEMBLER | 360 #endif // ENABLE_DISASSEMBLER |
361 | 361 |
362 } } // namespace v8::internal | 362 } } // namespace v8::internal |
OLD | NEW |