| 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 template <typename T> class GrowableArray; | 21 template <typename T> class GrowableArray; |
| 21 class ParsedFunction; | 22 class ParsedFunction; |
| 22 | 23 |
| 23 class FlowGraphCompiler : public FlowGraphVisitor { | 24 class FlowGraphCompiler : public FlowGraphVisitor { |
| 24 public: | 25 public: |
| 25 FlowGraphCompiler(Assembler* assembler, | 26 FlowGraphCompiler(Assembler* assembler, |
| 26 const ParsedFunction& parsed_function, | 27 const ParsedFunction& parsed_function, |
| 27 const GrowableArray<BlockEntryInstr*>& block_order); | 28 const GrowableArray<BlockEntryInstr*>& block_order); |
| 28 | 29 |
| 29 virtual ~FlowGraphCompiler(); | 30 virtual ~FlowGraphCompiler(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 64 |
| 64 #undef DECLARE_VISIT_COMPUTATION | 65 #undef DECLARE_VISIT_COMPUTATION |
| 65 #undef DECLARE_VISIT_INSTRUCTION | 66 #undef DECLARE_VISIT_INSTRUCTION |
| 66 | 67 |
| 67 // Emit code to load a Value into register 'dst'. | 68 // Emit code to load a Value into register 'dst'. |
| 68 void LoadValue(Register dst, Value* value); | 69 void LoadValue(Register dst, Value* value); |
| 69 | 70 |
| 70 // Emit an instance call. | 71 // Emit an instance call. |
| 71 void EmitInstanceCall(intptr_t node_id, | 72 void EmitInstanceCall(intptr_t node_id, |
| 72 intptr_t token_index, | 73 intptr_t token_index, |
| 74 intptr_t try_index, |
| 73 const String& function_name, | 75 const String& function_name, |
| 74 intptr_t argument_count, | 76 intptr_t argument_count, |
| 75 const Array& argument_names, | 77 const Array& argument_names, |
| 76 intptr_t checked_argument_count); | 78 intptr_t checked_argument_count); |
| 77 | 79 |
| 78 // Emit a static call. | 80 // Emit a static call. |
| 79 void EmitStaticCall(intptr_t token_index, | 81 void EmitStaticCall(intptr_t token_index, |
| 82 intptr_t try_index, |
| 80 const Function& function, | 83 const Function& function, |
| 81 intptr_t argument_count, | 84 intptr_t argument_count, |
| 82 const Array& argument_names); | 85 const Array& argument_names); |
| 83 | 86 |
| 84 // Infrastructure copied from class CodeGenerator. | 87 // Infrastructure copied from class CodeGenerator. |
| 85 void GenerateCall(intptr_t token_index, | 88 void GenerateCall(intptr_t token_index, |
| 89 intptr_t try_index, |
| 86 const ExternalLabel* label, | 90 const ExternalLabel* label, |
| 87 PcDescriptors::Kind kind); | 91 PcDescriptors::Kind kind); |
| 88 void GenerateCallRuntime(intptr_t node_id, | 92 void GenerateCallRuntime(intptr_t node_id, |
| 89 intptr_t token_index, | 93 intptr_t token_index, |
| 94 intptr_t try_index, |
| 90 const RuntimeEntry& entry); | 95 const RuntimeEntry& entry); |
| 91 void AddCurrentDescriptor(PcDescriptors::Kind kind, | 96 void AddCurrentDescriptor(PcDescriptors::Kind kind, |
| 92 intptr_t node_id, | 97 intptr_t node_id, |
| 93 intptr_t token_index); | 98 intptr_t token_index, |
| 99 intptr_t try_index); |
| 94 | 100 |
| 95 void GenerateAssertAssignable(intptr_t node_id, | 101 void GenerateAssertAssignable(intptr_t node_id, |
| 96 intptr_t token_index, | 102 intptr_t token_index, |
| 97 const AbstractType& dst_type, | 103 const AbstractType& dst_type, |
| 98 const String& dst_name); | 104 const String& dst_name); |
| 99 | 105 |
| 100 void GenerateInstanceOf(intptr_t node_id, | 106 void GenerateInstanceOf(intptr_t node_id, |
| 101 intptr_t token_index, | 107 intptr_t token_index, |
| 108 intptr_t try_index, |
| 102 const AbstractType& type, | 109 const AbstractType& type, |
| 103 bool negate_result); | 110 bool negate_result); |
| 104 | 111 |
| 105 void GenerateInstantiatorTypeArguments(intptr_t token_index); | 112 void GenerateInstantiatorTypeArguments(intptr_t token_index); |
| 106 | 113 |
| 107 void CopyParameters(); | 114 void CopyParameters(); |
| 108 | 115 |
| 109 intptr_t StackSize() const; | 116 intptr_t StackSize() const; |
| 110 | 117 |
| 111 Assembler* assembler_; | 118 Assembler* assembler_; |
| 112 const ParsedFunction& parsed_function_; | 119 const ParsedFunction& parsed_function_; |
| 113 | 120 |
| 114 // Compiler specific per-block state. Indexed by postorder block number | 121 // Compiler specific per-block state. Indexed by postorder block number |
| 115 // for convenience. This is not the block's index in the block order, | 122 // for convenience. This is not the block's index in the block order, |
| 116 // which is reverse postorder. | 123 // which is reverse postorder. |
| 117 GrowableArray<BlockInfo*> block_info_; | 124 GrowableArray<BlockInfo*> block_info_; |
| 118 | |
| 119 BlockEntryInstr* current_block_; | 125 BlockEntryInstr* current_block_; |
| 120 | |
| 121 DescriptorList* pc_descriptors_list_; | 126 DescriptorList* pc_descriptors_list_; |
| 127 ExceptionHandlerList* exception_handlers_list_; |
| 122 | 128 |
| 123 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); | 129 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); |
| 124 }; | 130 }; |
| 125 | 131 |
| 126 } // namespace dart | 132 } // namespace dart |
| 127 | 133 |
| 128 #endif // VM_FLOW_GRAPH_COMPILER_X64_H_ | 134 #endif // VM_FLOW_GRAPH_COMPILER_X64_H_ |
| OLD | NEW |