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

Side by Side Diff: src/disassembler.cc

Issue 7623014: Output missing comments after the last disassembled instruction. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 4 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 | « no previous file | src/full-codegen.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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 const V8NameConverter& converter, 115 const V8NameConverter& converter,
116 byte* begin, 116 byte* begin,
117 byte* end) { 117 byte* end) {
118 NoHandleAllocation ha; 118 NoHandleAllocation ha;
119 AssertNoAllocation no_alloc; 119 AssertNoAllocation no_alloc;
120 ExternalReferenceEncoder ref_encoder; 120 ExternalReferenceEncoder ref_encoder;
121 Heap* heap = HEAP; 121 Heap* heap = HEAP;
122 122
123 v8::internal::EmbeddedVector<char, 128> decode_buffer; 123 v8::internal::EmbeddedVector<char, 128> decode_buffer;
124 v8::internal::EmbeddedVector<char, kOutBufferSize> out_buffer; 124 v8::internal::EmbeddedVector<char, kOutBufferSize> out_buffer;
125 StringBuilder out(out_buffer.start(), out_buffer.length());
125 byte* pc = begin; 126 byte* pc = begin;
126 disasm::Disassembler d(converter); 127 disasm::Disassembler d(converter);
127 RelocIterator* it = NULL; 128 RelocIterator* it = NULL;
128 if (converter.code() != NULL) { 129 if (converter.code() != NULL) {
129 it = new RelocIterator(converter.code()); 130 it = new RelocIterator(converter.code());
130 } else { 131 } else {
131 // No relocation information when printing code stubs. 132 // No relocation information when printing code stubs.
132 } 133 }
133 int constants = -1; // no constants being decoded at the start 134 int constants = -1; // no constants being decoded at the start
134 135
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 } else { 178 } else {
178 // For other reloc info collect all data. 179 // For other reloc info collect all data.
179 pcs.Add(it->rinfo()->pc()); 180 pcs.Add(it->rinfo()->pc());
180 rmodes.Add(it->rinfo()->rmode()); 181 rmodes.Add(it->rinfo()->rmode());
181 datas.Add(it->rinfo()->data()); 182 datas.Add(it->rinfo()->data());
182 } 183 }
183 it->next(); 184 it->next();
184 } 185 }
185 } 186 }
186 187
187 StringBuilder out(out_buffer.start(), out_buffer.length());
188
189 // Comments. 188 // Comments.
190 for (int i = 0; i < comments.length(); i++) { 189 for (int i = 0; i < comments.length(); i++) {
191 out.AddFormatted(" %s", comments[i]); 190 out.AddFormatted(" %s", comments[i]);
192 DumpBuffer(f, &out); 191 DumpBuffer(f, &out);
193 } 192 }
194 193
195 // Instruction address and instruction offset. 194 // Instruction address and instruction offset.
196 out.AddFormatted("%p %4d ", prev_pc, prev_pc - begin); 195 out.AddFormatted("%p %4d ", prev_pc, prev_pc - begin);
197 196
198 // Instruction. 197 // Instruction.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 } else { 294 } else {
296 out.AddFormatted(" ;; deoptimization bailout %d", id); 295 out.AddFormatted(" ;; deoptimization bailout %d", id);
297 } 296 }
298 } else { 297 } else {
299 out.AddFormatted(" ;; %s", RelocInfo::RelocModeName(rmode)); 298 out.AddFormatted(" ;; %s", RelocInfo::RelocModeName(rmode));
300 } 299 }
301 } 300 }
302 DumpBuffer(f, &out); 301 DumpBuffer(f, &out);
303 } 302 }
304 303
304 // Emit comments following the last instruction (if any).
305 if (it != NULL) {
306 for ( ; !it->done(); it->next()) {
307 if (RelocInfo::IsComment(it->rinfo()->rmode())) {
308 out.AddFormatted(" %s",
309 reinterpret_cast<const char*>(it->rinfo()->data()));
310 DumpBuffer(f, &out);
311 }
312 }
313 }
314
305 delete it; 315 delete it;
306 return static_cast<int>(pc - begin); 316 return static_cast<int>(pc - begin);
307 } 317 }
308 318
309 319
310 int Disassembler::Decode(FILE* f, byte* begin, byte* end) { 320 int Disassembler::Decode(FILE* f, byte* begin, byte* end) {
311 V8NameConverter defaultConverter(NULL); 321 V8NameConverter defaultConverter(NULL);
312 return DecodeIt(f, defaultConverter, begin, end); 322 return DecodeIt(f, defaultConverter, begin, end);
313 } 323 }
314 324
(...skipping 17 matching lines...) Expand all
332 342
333 #else // ENABLE_DISASSEMBLER 343 #else // ENABLE_DISASSEMBLER
334 344
335 void Disassembler::Dump(FILE* f, byte* begin, byte* end) {} 345 void Disassembler::Dump(FILE* f, byte* begin, byte* end) {}
336 int Disassembler::Decode(FILE* f, byte* begin, byte* end) { return 0; } 346 int Disassembler::Decode(FILE* f, byte* begin, byte* end) { return 0; }
337 void Disassembler::Decode(FILE* f, Code* code) {} 347 void Disassembler::Decode(FILE* f, Code* code) {}
338 348
339 #endif // ENABLE_DISASSEMBLER 349 #endif // ENABLE_DISASSEMBLER
340 350
341 } } // namespace v8::internal 351 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/full-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698