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/deopt_instructions.h" | 8 #include "vm/deopt_instructions.h" |
9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
10 #include "vm/il_printer.h" | 10 #include "vm/il_printer.h" |
11 #include "vm/instructions.h" | 11 #include "vm/instructions.h" |
12 #include "vm/json_stream.h" | 12 #include "vm/json_stream.h" |
13 #include "vm/log.h" | 13 #include "vm/log.h" |
14 #include "vm/os.h" | 14 #include "vm/os.h" |
15 #include "vm/code_patcher.h" | 15 #include "vm/code_patcher.h" |
16 | 16 |
17 | 17 |
18 namespace dart { | 18 namespace dart { |
19 | 19 |
| 20 #ifndef PRODUCT |
| 21 |
20 DECLARE_FLAG(bool, trace_inlining_intervals); | 22 DECLARE_FLAG(bool, trace_inlining_intervals); |
21 | 23 |
22 void DisassembleToStdout::ConsumeInstruction(const Code& code, | 24 void DisassembleToStdout::ConsumeInstruction(const Code& code, |
23 char* hex_buffer, | 25 char* hex_buffer, |
24 intptr_t hex_size, | 26 intptr_t hex_size, |
25 char* human_buffer, | 27 char* human_buffer, |
26 intptr_t human_size, | 28 intptr_t human_size, |
27 uword pc) { | 29 uword pc) { |
28 static const int kHexColumnWidth = 23; | 30 static const int kHexColumnWidth = 23; |
29 uint8_t* pc_ptr = reinterpret_cast<uint8_t*>(pc); | 31 uint8_t* pc_ptr = reinterpret_cast<uint8_t*>(pc); |
(...skipping 10 matching lines...) Expand all Loading... |
40 | 42 |
41 | 43 |
42 void DisassembleToStdout::Print(const char* format, ...) { | 44 void DisassembleToStdout::Print(const char* format, ...) { |
43 va_list args; | 45 va_list args; |
44 va_start(args, format); | 46 va_start(args, format); |
45 THR_VPrint(format, args); | 47 THR_VPrint(format, args); |
46 va_end(args); | 48 va_end(args); |
47 } | 49 } |
48 | 50 |
49 | 51 |
50 #ifndef PRODUCT | |
51 | |
52 void DisassembleToJSONStream::ConsumeInstruction(const Code& code, | 52 void DisassembleToJSONStream::ConsumeInstruction(const Code& code, |
53 char* hex_buffer, | 53 char* hex_buffer, |
54 intptr_t hex_size, | 54 intptr_t hex_size, |
55 char* human_buffer, | 55 char* human_buffer, |
56 intptr_t human_size, | 56 intptr_t human_size, |
57 uword pc) { | 57 uword pc) { |
58 // Instructions are represented as four consecutive values in a JSON array. | 58 // Instructions are represented as four consecutive values in a JSON array. |
59 // The first is the address of the instruction, the second is the hex string, | 59 // The first is the address of the instruction, the second is the hex string, |
60 // of the code, and the third is a human readable string, and the fourth is | 60 // of the code, and the third is a human readable string, and the fourth is |
61 // the object loaded by the instruction. | 61 // the object loaded by the instruction. |
(...skipping 27 matching lines...) Expand all Loading... |
89 } | 89 } |
90 // Instructions are represented as four consecutive values in a JSON array. | 90 // Instructions are represented as four consecutive values in a JSON array. |
91 // Comments only use the third slot. See above comment for more information. | 91 // Comments only use the third slot. See above comment for more information. |
92 jsarr_.AddValueNull(); | 92 jsarr_.AddValueNull(); |
93 jsarr_.AddValueNull(); | 93 jsarr_.AddValueNull(); |
94 jsarr_.AddValue(p); | 94 jsarr_.AddValue(p); |
95 jsarr_.AddValueNull(); | 95 jsarr_.AddValueNull(); |
96 free(p); | 96 free(p); |
97 } | 97 } |
98 | 98 |
99 #endif // !PRODUCT | |
100 | 99 |
101 class FindAddrVisitor : public FindObjectVisitor { | 100 class FindAddrVisitor : public FindObjectVisitor { |
102 public: | 101 public: |
103 explicit FindAddrVisitor(uword addr) | 102 explicit FindAddrVisitor(uword addr) |
104 : FindObjectVisitor(Isolate::Current()), addr_(addr) { } | 103 : FindObjectVisitor(Isolate::Current()), addr_(addr) { } |
105 virtual ~FindAddrVisitor() { } | 104 virtual ~FindAddrVisitor() { } |
106 | 105 |
107 virtual uword filter_addr() const { return addr_; } | 106 virtual uword filter_addr() const { return addr_; } |
108 | 107 |
109 // Check if object matches find condition. | 108 // Check if object matches find condition. |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 code.raw()); | 318 code.raw()); |
320 } | 319 } |
321 } | 320 } |
322 THR_Print("}\n"); | 321 THR_Print("}\n"); |
323 } | 322 } |
324 if (optimized && FLAG_trace_inlining_intervals) { | 323 if (optimized && FLAG_trace_inlining_intervals) { |
325 code.DumpInlinedIntervals(); | 324 code.DumpInlinedIntervals(); |
326 } | 325 } |
327 } | 326 } |
328 | 327 |
| 328 #endif // !PRODUCT |
329 | 329 |
330 } // namespace dart | 330 } // namespace dart |
OLD | NEW |