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

Side by Side Diff: runtime/vm/disassembler.cc

Issue 914463002: Fix disassembly comments (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/disassembler.h" 5 #include "vm/disassembler.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/globals.h" 8 #include "vm/globals.h"
9 #include "vm/os.h" 9 #include "vm/os.h"
10 #include "vm/log.h" 10 #include "vm/log.h"
(...skipping 15 matching lines...) Expand all
26 ISL_Print(" "); 26 ISL_Print(" ");
27 } 27 }
28 } 28 }
29 ISL_Print("%s", human_buffer); 29 ISL_Print("%s", human_buffer);
30 ISL_Print("\n"); 30 ISL_Print("\n");
31 } 31 }
32 32
33 33
34 void DisassembleToStdout::Print(const char* format, ...) { 34 void DisassembleToStdout::Print(const char* format, ...) {
35 va_list args; 35 va_list args;
36
36 va_start(args, format); 37 va_start(args, format);
37 OS::VFPrint(stdout, format, args); 38 intptr_t len = OS::VSNPrint(NULL, 0, format, args);
38 va_end(args); 39 va_end(args);
40
41 char* p = reinterpret_cast<char*>(malloc(len+1));
42 va_start(args, format);
43 OS::VSNPrint(p, len, format, args);
44 va_end(args);
45
46 ISL_Print("%s", p);
47 free(p);
39 } 48 }
40 49
41 50
42 void DisassembleToJSONStream::ConsumeInstruction(char* hex_buffer, 51 void DisassembleToJSONStream::ConsumeInstruction(char* hex_buffer,
43 intptr_t hex_size, 52 intptr_t hex_size,
44 char* human_buffer, 53 char* human_buffer,
45 intptr_t human_size, 54 intptr_t human_size,
46 uword pc) { 55 uword pc) {
47 uint8_t* pc_ptr = reinterpret_cast<uint8_t*>(pc); 56 uint8_t* pc_ptr = reinterpret_cast<uint8_t*>(pc);
48 // Instructions are represented as three consecutive values in a JSON array. 57 // Instructions are represented as three consecutive values in a JSON array.
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 formatter->ConsumeInstruction(hex_buffer, 161 formatter->ConsumeInstruction(hex_buffer,
153 sizeof(hex_buffer), 162 sizeof(hex_buffer),
154 human_buffer, 163 human_buffer,
155 sizeof(human_buffer), 164 sizeof(human_buffer),
156 pc); 165 pc);
157 pc += instruction_length; 166 pc += instruction_length;
158 } 167 }
159 } 168 }
160 169
161 } // namespace dart 170 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698