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

Side by Side Diff: src/disassembler.cc

Issue 1869433004: Fix printf formats (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address review comments. Created 4 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
« no previous file with comments | « src/crankshaft/lithium-codegen.h ('k') | src/global-handles.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 // 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
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 %4d ", prev_pc, prev_pc - begin); 150 out.AddFormatted("%p %4td ", 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 %d", relocinfo.data()); 174 out.AddFormatted(" ;; debug: statement %" V8PRIdPTR,
175 relocinfo.data());
175 } else { 176 } else {
176 out.AddFormatted(" ;; debug: position %d", relocinfo.data()); 177 out.AddFormatted(" ;; debug: position %" V8PRIdPTR,
178 relocinfo.data());
177 } 179 }
178 } else if (rmode == RelocInfo::DEOPT_REASON) { 180 } else if (rmode == RelocInfo::DEOPT_REASON) {
179 Deoptimizer::DeoptReason reason = 181 Deoptimizer::DeoptReason reason =
180 static_cast<Deoptimizer::DeoptReason>(relocinfo.data()); 182 static_cast<Deoptimizer::DeoptReason>(relocinfo.data());
181 out.AddFormatted(" ;; debug: deopt reason '%s'", 183 out.AddFormatted(" ;; debug: deopt reason '%s'",
182 Deoptimizer::GetDeoptReason(reason)); 184 Deoptimizer::GetDeoptReason(reason));
183 } else if (rmode == RelocInfo::EMBEDDED_OBJECT) { 185 } else if (rmode == RelocInfo::EMBEDDED_OBJECT) {
184 HeapStringAllocator allocator; 186 HeapStringAllocator allocator;
185 StringStream accumulator(&allocator); 187 StringStream accumulator(&allocator);
186 relocinfo.target_object()->ShortPrint(&accumulator); 188 relocinfo.target_object()->ShortPrint(&accumulator);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 279
278 int Disassembler::Decode(Isolate* isolate, std::ostream* os, byte* begin, 280 int Disassembler::Decode(Isolate* isolate, std::ostream* os, byte* begin,
279 byte* end, Code* code) { 281 byte* end, Code* code) {
280 return 0; 282 return 0;
281 } 283 }
282 284
283 #endif // ENABLE_DISASSEMBLER 285 #endif // ENABLE_DISASSEMBLER
284 286
285 } // namespace internal 287 } // namespace internal
286 } // namespace v8 288 } // namespace v8
OLDNEW
« no previous file with comments | « src/crankshaft/lithium-codegen.h ('k') | src/global-handles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698