| 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_FLOW_GRAPH_COMPILER_X64_H_ | 5 #ifndef VM_FLOW_GRAPH_COMPILER_X64_H_ |
| 6 #define VM_FLOW_GRAPH_COMPILER_X64_H_ | 6 #define VM_FLOW_GRAPH_COMPILER_X64_H_ |
| 7 | 7 |
| 8 #ifndef VM_FLOW_GRAPH_COMPILER_H_ | 8 #ifndef VM_FLOW_GRAPH_COMPILER_H_ |
| 9 #error Include flow_graph_compiler.h instead of flow_graph_compiler_x64.h. | 9 #error Include flow_graph_compiler.h instead of flow_graph_compiler_x64.h. |
| 10 #endif | 10 #endif |
| 11 | 11 |
| 12 #include "vm/assembler.h" | 12 #include "vm/assembler.h" |
| 13 #include "vm/code_generator.h" | 13 #include "vm/code_generator.h" |
| 14 #include "vm/intermediate_language.h" | 14 #include "vm/intermediate_language.h" |
| 15 | 15 |
| 16 namespace dart { | 16 namespace dart { |
| 17 | 17 |
| 18 class Code; |
| 19 class GrowableArray; |
| 18 class ParsedFunction; | 20 class ParsedFunction; |
| 19 | 21 |
| 20 class FlowGraphCompiler : public InstructionVisitor { | 22 class FlowGraphCompiler : public InstructionVisitor { |
| 21 public: | 23 public: |
| 22 FlowGraphCompiler(Assembler* assembler, | 24 FlowGraphCompiler(Assembler* assembler, |
| 23 const ParsedFunction& parsed_function, | 25 const ParsedFunction& parsed_function, |
| 24 const GrowableArray<BlockEntryInstr*>* blocks) | 26 const GrowableArray<BlockEntryInstr*>* blocks) |
| 25 : assembler_(assembler), | 27 : assembler_(assembler), |
| 26 parsed_function_(parsed_function), | 28 parsed_function_(parsed_function), |
| 27 blocks_(blocks), | 29 blocks_(blocks), |
| 28 pc_descriptors_list_(new CodeGenerator::DescriptorList()) { } | 30 pc_descriptors_list_(new CodeGenerator::DescriptorList()) { } |
| 29 | 31 |
| 30 virtual ~FlowGraphCompiler() { } | 32 virtual ~FlowGraphCompiler() { } |
| 31 | 33 |
| 32 void CompileGraph(); | 34 void CompileGraph(); |
| 33 | 35 |
| 36 // Infrastructure copied from class CodeGenerator or stubbed out. |
| 37 void FinalizePcDescriptors(const Code& code); |
| 38 void FinalizeVarDescriptors(const Code& code); |
| 39 void FinalizeExceptionHandlers(const Code& code); |
| 40 |
| 34 private: | 41 private: |
| 35 // Bail out of the flow graph compiler. Does not return to the caller. | 42 // Bail out of the flow graph compiler. Does not return to the caller. |
| 36 void Bailout(const char* reason); | 43 void Bailout(const char* reason); |
| 37 | 44 |
| 38 // Each visit function compiles a type of instruction. | 45 // Each visit function compiles a type of instruction. |
| 39 #define DECLARE_VISIT(type) \ | 46 #define DECLARE_VISIT(type) \ |
| 40 virtual void Visit##type(type##Instr* instr); | 47 virtual void Visit##type(type##Instr* instr); |
| 41 FOR_EACH_INSTRUCTION(DECLARE_VISIT) | 48 FOR_EACH_INSTRUCTION(DECLARE_VISIT) |
| 42 #undef DECLARE_VISIT | 49 #undef DECLARE_VISIT |
| 43 | 50 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 57 const GrowableArray<BlockEntryInstr*>* blocks_; | 64 const GrowableArray<BlockEntryInstr*>* blocks_; |
| 58 | 65 |
| 59 CodeGenerator::DescriptorList* pc_descriptors_list_; | 66 CodeGenerator::DescriptorList* pc_descriptors_list_; |
| 60 | 67 |
| 61 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); | 68 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); |
| 62 }; | 69 }; |
| 63 | 70 |
| 64 } // namespace dart | 71 } // namespace dart |
| 65 | 72 |
| 66 #endif // VM_FLOW_GRAPH_COMPILER_X64_H_ | 73 #endif // VM_FLOW_GRAPH_COMPILER_X64_H_ |
| OLD | NEW |