Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: src/disassembler.cc

Issue 13811020: Use PrintF instead of fprintf. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/disasm-arm.cc ('k') | src/flags.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « src/arm/disasm-arm.cc ('k') | src/flags.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698