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

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

Issue 1314673008: Migrate logging infrastructure Isolate->Thread (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix test. Created 5 years, 3 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
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/il_printer.h" 9 #include "vm/il_printer.h"
10 #include "vm/json_stream.h" 10 #include "vm/json_stream.h"
11 #include "vm/log.h" 11 #include "vm/log.h"
12 #include "vm/os.h" 12 #include "vm/os.h"
13 13
14 14
15 namespace dart { 15 namespace dart {
16 16
17 void DisassembleToStdout::ConsumeInstruction(char* hex_buffer, 17 void DisassembleToStdout::ConsumeInstruction(char* hex_buffer,
18 intptr_t hex_size, 18 intptr_t hex_size,
19 char* human_buffer, 19 char* human_buffer,
20 intptr_t human_size, 20 intptr_t human_size,
21 uword pc) { 21 uword pc) {
22 static const int kHexColumnWidth = 23; 22 static const int kHexColumnWidth = 23;
23 uint8_t* pc_ptr = reinterpret_cast<uint8_t*>(pc); 23 uint8_t* pc_ptr = reinterpret_cast<uint8_t*>(pc);
24 ISL_Print("%p %s", pc_ptr, hex_buffer); 24 THR_Print("%p %s", pc_ptr, hex_buffer);
25 int hex_length = strlen(hex_buffer); 25 int hex_length = strlen(hex_buffer);
26 if (hex_length < kHexColumnWidth) { 26 if (hex_length < kHexColumnWidth) {
27 for (int i = kHexColumnWidth - hex_length; i > 0; i--) { 27 for (int i = kHexColumnWidth - hex_length; i > 0; i--) {
28 ISL_Print(" "); 28 THR_Print(" ");
29 } 29 }
30 } 30 }
31 ISL_Print("%s", human_buffer); 31 THR_Print("%s", human_buffer);
32 ISL_Print("\n"); 32 THR_Print("\n");
33 } 33 }
34 34
35 35
36 void DisassembleToStdout::Print(const char* format, ...) { 36 void DisassembleToStdout::Print(const char* format, ...) {
37 va_list args; 37 va_list args;
38 va_start(args, format); 38 va_start(args, format);
39 ISL_VPrint(format, args); 39 THR_VPrint(format, args);
40 va_end(args); 40 va_end(args);
41 } 41 }
42 42
43 43
44 void DisassembleToJSONStream::ConsumeInstruction(char* hex_buffer, 44 void DisassembleToJSONStream::ConsumeInstruction(char* hex_buffer,
45 intptr_t hex_size, 45 intptr_t hex_size,
46 char* human_buffer, 46 char* human_buffer,
47 intptr_t human_size, 47 intptr_t human_size,
48 uword pc) { 48 uword pc) {
49 // Instructions are represented as three consecutive values in a JSON array. 49 // Instructions are represented as three consecutive values in a JSON array.
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 formatter->ConsumeInstruction(hex_buffer, 160 formatter->ConsumeInstruction(hex_buffer,
161 sizeof(hex_buffer), 161 sizeof(hex_buffer),
162 human_buffer, 162 human_buffer,
163 sizeof(human_buffer), 163 sizeof(human_buffer),
164 pc); 164 pc);
165 pc += instruction_length; 165 pc += instruction_length;
166 } 166 }
167 } 167 }
168 168
169 } // namespace dart 169 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698