OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #ifndef VM_IL_PRINTER_H_ | 5 #ifndef VM_IL_PRINTER_H_ |
6 #define VM_IL_PRINTER_H_ | 6 #define VM_IL_PRINTER_H_ |
7 | 7 |
8 #include "vm/flow_graph.h" | 8 #include "vm/flow_graph.h" |
9 #include "vm/intermediate_language.h" | 9 #include "vm/intermediate_language.h" |
10 | 10 |
11 namespace dart { | 11 namespace dart { |
12 | 12 |
13 class BufferFormatter : public ValueObject { | 13 class BufferFormatter : public ValueObject { |
14 public: | 14 public: |
15 BufferFormatter(char* buffer, intptr_t size) | 15 BufferFormatter(char* buffer, intptr_t size) |
16 : position_(0), | 16 : position_(0), |
17 buffer_(buffer), | 17 buffer_(buffer), |
18 size_(size) { } | 18 size_(size) { } |
19 | 19 |
20 void VPrint(const char* format, va_list args); | 20 void VPrint(const char* format, va_list args); |
21 void Print(const char* format, ...); | 21 void Print(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); |
22 | 22 |
23 private: | 23 private: |
24 intptr_t position_; | 24 intptr_t position_; |
25 char* buffer_; | 25 char* buffer_; |
26 const intptr_t size_; | 26 const intptr_t size_; |
27 | 27 |
28 DISALLOW_COPY_AND_ASSIGN(BufferFormatter); | 28 DISALLOW_COPY_AND_ASSIGN(BufferFormatter); |
29 }; | 29 }; |
30 | 30 |
31 | 31 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 explicit FlowGraphVisualizer(const FlowGraph& flow_graph) | 65 explicit FlowGraphVisualizer(const FlowGraph& flow_graph) |
66 : function_(flow_graph.parsed_function().function()), | 66 : function_(flow_graph.parsed_function().function()), |
67 block_order_(flow_graph.reverse_postorder()), | 67 block_order_(flow_graph.reverse_postorder()), |
68 indent_(0) { } | 68 indent_(0) { } |
69 | 69 |
70 void PrintFunction(); | 70 void PrintFunction(); |
71 | 71 |
72 private: | 72 private: |
73 // Helpers for printing. | 73 // Helpers for printing. |
74 void PrintInstruction(Instruction* instr); | 74 void PrintInstruction(Instruction* instr); |
75 void Print(const char* format, ...); | 75 void Print(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); |
76 | 76 |
77 const Function& function_; | 77 const Function& function_; |
78 const GrowableArray<BlockEntryInstr*>& block_order_; | 78 const GrowableArray<BlockEntryInstr*>& block_order_; |
79 intptr_t indent_; | 79 intptr_t indent_; |
80 | 80 |
81 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisualizer); | 81 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisualizer); |
82 }; | 82 }; |
83 | 83 |
84 } // namespace dart | 84 } // namespace dart |
85 | 85 |
86 #endif // VM_IL_PRINTER_H_ | 86 #endif // VM_IL_PRINTER_H_ |
OLD | NEW |