| 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 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 DISALLOW_COPY_AND_ASSIGN(BufferFormatter); | 28 DISALLOW_COPY_AND_ASSIGN(BufferFormatter); |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 | 31 |
| 32 class ParsedFunction; | 32 class ParsedFunction; |
| 33 | 33 |
| 34 | 34 |
| 35 // Graph printing. | 35 // Graph printing. |
| 36 class FlowGraphPrinter : public ValueObject { | 36 class FlowGraphPrinter : public ValueObject { |
| 37 public: | 37 public: |
| 38 static const intptr_t kPrintAll = -1; |
| 39 |
| 38 FlowGraphPrinter(const FlowGraph& flow_graph, | 40 FlowGraphPrinter(const FlowGraph& flow_graph, |
| 39 bool print_locations = false) | 41 bool print_locations = false) |
| 40 : function_(flow_graph.function()), | 42 : function_(flow_graph.function()), |
| 41 block_order_(flow_graph.reverse_postorder()), | 43 block_order_(flow_graph.reverse_postorder()), |
| 42 print_locations_(print_locations) { } | 44 print_locations_(print_locations) { } |
| 43 | 45 |
| 44 // Print the instructions in a block terminated by newlines. Add "goto N" | 46 // Print the instructions in a block terminated by newlines. Add "goto N" |
| 45 // to the end of the block if it ends with an unconditional jump to | 47 // to the end of the block if it ends with an unconditional jump to |
| 46 // another block and that block is not next in reverse postorder. | 48 // another block and that block is not next in reverse postorder. |
| 47 void PrintBlocks(); | 49 void PrintBlocks(); |
| 48 void PrintInstruction(Instruction* instr); | 50 void PrintInstruction(Instruction* instr); |
| 49 static void PrintOneInstruction(Instruction* instr, bool print_locations); | 51 static void PrintOneInstruction(Instruction* instr, bool print_locations); |
| 50 static void PrintTypeCheck(const ParsedFunction& parsed_function, | 52 static void PrintTypeCheck(const ParsedFunction& parsed_function, |
| 51 TokenPosition token_pos, | 53 TokenPosition token_pos, |
| 52 Value* value, | 54 Value* value, |
| 53 const AbstractType& dst_type, | 55 const AbstractType& dst_type, |
| 54 const String& dst_name, | 56 const String& dst_name, |
| 55 bool eliminated); | 57 bool eliminated); |
| 56 static void PrintBlock(BlockEntryInstr* block, bool print_locations); | 58 static void PrintBlock(BlockEntryInstr* block, bool print_locations); |
| 57 | 59 |
| 58 static void PrintGraph(const char* phase, FlowGraph* flow_graph); | 60 static void PrintGraph(const char* phase, FlowGraph* flow_graph); |
| 59 | 61 |
| 60 // Debugging helper function. | 62 // Debugging helper function. If 'num_checks_to_print' is not specified |
| 61 static void PrintICData(const ICData& ic_data); | 63 // all checks will be printed. |
| 64 static void PrintICData(const ICData& ic_data, |
| 65 intptr_t num_checks_to_print = kPrintAll); |
| 62 | 66 |
| 63 static bool ShouldPrint(const Function& function); | 67 static bool ShouldPrint(const Function& function); |
| 64 | 68 |
| 65 static bool PassesFilter(const char* filter, const Function& function); | 69 static bool PassesFilter(const char* filter, const Function& function); |
| 66 | 70 |
| 67 private: | 71 private: |
| 68 const Function& function_; | 72 const Function& function_; |
| 69 const GrowableArray<BlockEntryInstr*>& block_order_; | 73 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 70 const bool print_locations_; | 74 const bool print_locations_; |
| 71 }; | 75 }; |
| 72 | 76 |
| 73 } // namespace dart | 77 } // namespace dart |
| 74 | 78 |
| 75 #endif // VM_IL_PRINTER_H_ | 79 #endif // VM_IL_PRINTER_H_ |
| OLD | NEW |