| 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_descriptors.h" | 13 #include "vm/code_descriptors.h" |
| 14 #include "vm/code_generator.h" | 14 #include "vm/code_generator.h" |
| 15 #include "vm/intermediate_language.h" | 15 #include "vm/intermediate_language.h" |
| 16 | 16 |
| 17 namespace dart { | 17 namespace dart { |
| 18 | 18 |
| 19 class Code; | 19 class Code; |
| 20 class ExceptionHandlerList; | 20 class ExceptionHandlerList; |
| 21 template <typename T> class GrowableArray; | 21 template <typename T> class GrowableArray; |
| 22 class ParsedFunction; | 22 class ParsedFunction; |
| 23 | 23 |
| 24 class FlowGraphCompiler : public FlowGraphVisitor { | 24 class FlowGraphCompiler : public FlowGraphVisitor { |
| 25 public: | 25 public: |
| 26 FlowGraphCompiler(Assembler* assembler, | 26 FlowGraphCompiler(Assembler* assembler, |
| 27 const ParsedFunction& parsed_function, | 27 const ParsedFunction& parsed_function, |
| 28 const GrowableArray<BlockEntryInstr*>& block_order); | 28 const GrowableArray<BlockEntryInstr*>& block_order, |
| 29 bool is_optimizing); |
| 29 | 30 |
| 30 virtual ~FlowGraphCompiler(); | 31 virtual ~FlowGraphCompiler(); |
| 31 | 32 |
| 32 void CompileGraph(); | 33 void CompileGraph(); |
| 33 | 34 |
| 34 // Infrastructure copied from class CodeGenerator or stubbed out. | 35 // Infrastructure copied from class CodeGenerator or stubbed out. |
| 35 void FinalizePcDescriptors(const Code& code); | 36 void FinalizePcDescriptors(const Code& code); |
| 36 void FinalizeStackmaps(const Code& code); | 37 void FinalizeStackmaps(const Code& code); |
| 37 void FinalizeVarDescriptors(const Code& code); | 38 void FinalizeVarDescriptors(const Code& code); |
| 38 void FinalizeExceptionHandlers(const Code& code); | 39 void FinalizeExceptionHandlers(const Code& code); |
| 39 | 40 |
| 40 private: | 41 private: |
| 41 struct BlockInfo : public ZoneAllocated { | 42 struct BlockInfo : public ZoneAllocated { |
| 42 public: | 43 public: |
| 43 BlockInfo() : label() { } | 44 BlockInfo() : label() { } |
| 44 | 45 |
| 45 Label label; | 46 Label label; |
| 46 }; | 47 }; |
| 47 | 48 |
| 48 BlockEntryInstr* current_block() const { return current_block_; } | 49 BlockEntryInstr* current_block() const { return current_block_; } |
| 49 | 50 |
| 51 bool is_optimizing() const { return is_optimizing_; } |
| 52 |
| 50 // Bail out of the flow graph compiler. Does not return to the caller. | 53 // Bail out of the flow graph compiler. Does not return to the caller. |
| 51 void Bailout(const char* reason); | 54 void Bailout(const char* reason); |
| 52 | 55 |
| 53 virtual void VisitBlocks(); | 56 virtual void VisitBlocks(); |
| 54 | 57 |
| 55 // Emit code to perform a computation, leaving its value in RAX. | 58 // Emit code to perform a computation, leaving its value in RAX. |
| 56 #define DECLARE_VISIT_COMPUTATION(ShortName, ClassName) \ | 59 #define DECLARE_VISIT_COMPUTATION(ShortName, ClassName) \ |
| 57 virtual void Visit##ShortName(ClassName* comp); | 60 virtual void Visit##ShortName(ClassName* comp); |
| 58 | 61 |
| 59 // Each visit function compiles a type of instruction. | 62 // Each visit function compiles a type of instruction. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 Assembler* assembler_; | 130 Assembler* assembler_; |
| 128 const ParsedFunction& parsed_function_; | 131 const ParsedFunction& parsed_function_; |
| 129 | 132 |
| 130 // Compiler specific per-block state. Indexed by postorder block number | 133 // Compiler specific per-block state. Indexed by postorder block number |
| 131 // for convenience. This is not the block's index in the block order, | 134 // for convenience. This is not the block's index in the block order, |
| 132 // which is reverse postorder. | 135 // which is reverse postorder. |
| 133 GrowableArray<BlockInfo*> block_info_; | 136 GrowableArray<BlockInfo*> block_info_; |
| 134 BlockEntryInstr* current_block_; | 137 BlockEntryInstr* current_block_; |
| 135 DescriptorList* pc_descriptors_list_; | 138 DescriptorList* pc_descriptors_list_; |
| 136 ExceptionHandlerList* exception_handlers_list_; | 139 ExceptionHandlerList* exception_handlers_list_; |
| 140 const bool is_optimizing_; |
| 137 | 141 |
| 138 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); | 142 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); |
| 139 }; | 143 }; |
| 140 | 144 |
| 141 } // namespace dart | 145 } // namespace dart |
| 142 | 146 |
| 143 #endif // VM_FLOW_GRAPH_COMPILER_X64_H_ | 147 #endif // VM_FLOW_GRAPH_COMPILER_X64_H_ |
| OLD | NEW |