OLD | NEW |
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/instructions.h" | 10 #include "vm/instructions.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 | 38 |
39 void DisassembleToStdout::Print(const char* format, ...) { | 39 void DisassembleToStdout::Print(const char* format, ...) { |
40 va_list args; | 40 va_list args; |
41 va_start(args, format); | 41 va_start(args, format); |
42 THR_VPrint(format, args); | 42 THR_VPrint(format, args); |
43 va_end(args); | 43 va_end(args); |
44 } | 44 } |
45 | 45 |
46 | 46 |
| 47 #ifndef PRODUCT |
| 48 |
47 void DisassembleToJSONStream::ConsumeInstruction(const Code& code, | 49 void DisassembleToJSONStream::ConsumeInstruction(const Code& code, |
48 char* hex_buffer, | 50 char* hex_buffer, |
49 intptr_t hex_size, | 51 intptr_t hex_size, |
50 char* human_buffer, | 52 char* human_buffer, |
51 intptr_t human_size, | 53 intptr_t human_size, |
52 uword pc) { | 54 uword pc) { |
53 // Instructions are represented as four consecutive values in a JSON array. | 55 // Instructions are represented as four consecutive values in a JSON array. |
54 // The first is the address of the instruction, the second is the hex string, | 56 // The first is the address of the instruction, the second is the hex string, |
55 // of the code, and the third is a human readable string, and the fourth is | 57 // of the code, and the third is a human readable string, and the fourth is |
56 // the object loaded by the instruction. | 58 // the object loaded by the instruction. |
(...skipping 27 matching lines...) Expand all Loading... |
84 } | 86 } |
85 // Instructions are represented as four consecutive values in a JSON array. | 87 // Instructions are represented as four consecutive values in a JSON array. |
86 // Comments only use the third slot. See above comment for more information. | 88 // Comments only use the third slot. See above comment for more information. |
87 jsarr_.AddValueNull(); | 89 jsarr_.AddValueNull(); |
88 jsarr_.AddValueNull(); | 90 jsarr_.AddValueNull(); |
89 jsarr_.AddValue(p); | 91 jsarr_.AddValue(p); |
90 jsarr_.AddValueNull(); | 92 jsarr_.AddValueNull(); |
91 free(p); | 93 free(p); |
92 } | 94 } |
93 | 95 |
| 96 #endif // !PRODUCT |
94 | 97 |
95 class FindAddrVisitor : public FindObjectVisitor { | 98 class FindAddrVisitor : public FindObjectVisitor { |
96 public: | 99 public: |
97 explicit FindAddrVisitor(uword addr) | 100 explicit FindAddrVisitor(uword addr) |
98 : FindObjectVisitor(Isolate::Current()), addr_(addr) { } | 101 : FindObjectVisitor(Isolate::Current()), addr_(addr) { } |
99 virtual ~FindAddrVisitor() { } | 102 virtual ~FindAddrVisitor() { } |
100 | 103 |
101 virtual uword filter_addr() const { return addr_; } | 104 virtual uword filter_addr() const { return addr_; } |
102 | 105 |
103 // Check if object matches find condition. | 106 // Check if object matches find condition. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 hex_buffer, | 176 hex_buffer, |
174 sizeof(hex_buffer), | 177 sizeof(hex_buffer), |
175 human_buffer, | 178 human_buffer, |
176 sizeof(human_buffer), | 179 sizeof(human_buffer), |
177 pc); | 180 pc); |
178 pc += instruction_length; | 181 pc += instruction_length; |
179 } | 182 } |
180 } | 183 } |
181 | 184 |
182 } // namespace dart | 185 } // namespace dart |
OLD | NEW |