| 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 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 class FlowGraphCompiler : public FlowGraphCompilerShared { | 27 class FlowGraphCompiler : public FlowGraphCompilerShared { |
| 28 public: | 28 public: |
| 29 FlowGraphCompiler(Assembler* assembler, | 29 FlowGraphCompiler(Assembler* assembler, |
| 30 const ParsedFunction& parsed_function, | 30 const ParsedFunction& parsed_function, |
| 31 const GrowableArray<BlockEntryInstr*>& block_order, | 31 const GrowableArray<BlockEntryInstr*>& block_order, |
| 32 bool is_optimizing); | 32 bool is_optimizing); |
| 33 | 33 |
| 34 void CompileGraph(); | 34 void CompileGraph(); |
| 35 | 35 |
| 36 void FinalizeComments(const Code& code); | |
| 37 | |
| 38 void GenerateCallRuntime(intptr_t cid, | 36 void GenerateCallRuntime(intptr_t cid, |
| 39 intptr_t token_index, | 37 intptr_t token_index, |
| 40 intptr_t try_index, | 38 intptr_t try_index, |
| 41 const RuntimeEntry& entry); | 39 const RuntimeEntry& entry); |
| 42 | 40 |
| 43 private: | 41 private: |
| 44 friend class DeoptimizationStub; | 42 friend class DeoptimizationStub; |
| 45 | 43 |
| 46 // TODO(fschneider): Clean up friend-class declarations once all code | 44 // TODO(fschneider): Clean up friend-class declarations once all code |
| 47 // generator templates have been moved to intermediate_language_x64.cc. | 45 // generator templates have been moved to intermediate_language_x64.cc. |
| 48 #define DECLARE_FRIEND(ShortName, ClassName) friend class ClassName; | 46 #define DECLARE_FRIEND(ShortName, ClassName) friend class ClassName; |
| 49 FOR_EACH_COMPUTATION(DECLARE_FRIEND) | 47 FOR_EACH_COMPUTATION(DECLARE_FRIEND) |
| 50 #undef DECLARE_FRIEND | 48 #undef DECLARE_FRIEND |
| 51 | 49 |
| 52 static const int kLocalsOffsetFromFP = (-1 * kWordSize); | 50 static const int kLocalsOffsetFromFP = (-1 * kWordSize); |
| 53 | 51 |
| 54 // Bail out of the flow graph compiler. Does not return to the caller. | |
| 55 void Bailout(const char* reason); | |
| 56 | |
| 57 virtual void VisitBlocks(); | 52 virtual void VisitBlocks(); |
| 58 | 53 |
| 59 void EmitInstructionPrologue(Instruction* instr); | 54 void EmitInstructionPrologue(Instruction* instr); |
| 60 | 55 |
| 61 // Emit code to load a Value into register 'dst'. | 56 // Emit code to load a Value into register 'dst'. |
| 62 void LoadValue(Register dst, Value* value); | 57 void LoadValue(Register dst, Value* value); |
| 63 | 58 |
| 64 void EmitComment(Instruction* instr); | 59 void EmitComment(Instruction* instr); |
| 65 | 60 |
| 66 // Emit an instance call. | 61 // Returns pc-offset (in bytes) of the pc after the call, can be used to emit |
| 67 void EmitInstanceCall(intptr_t cid, | 62 // pc-descriptor information. |
| 68 intptr_t token_index, | 63 virtual intptr_t EmitInstanceCall(ExternalLabel* target_label, |
| 69 intptr_t try_index, | 64 const ICData& ic_data, |
| 70 const String& function_name, | 65 const Array& arguments_descriptor, |
| 71 intptr_t argument_count, | 66 intptr_t argument_count); |
| 72 const Array& argument_names, | |
| 73 intptr_t checked_argument_count); | |
| 74 | 67 |
| 75 // Emit a static call. | 68 // Returns pc-offset (in bytes) of the pc after the call, can be used to emit |
| 76 void EmitStaticCall(intptr_t token_index, | 69 // pc-descriptor information. |
| 77 intptr_t try_index, | 70 virtual intptr_t EmitStaticCall(const Function& function, |
| 78 const Function& function, | 71 const Array& arguments_descriptor, |
| 79 intptr_t argument_count, | 72 intptr_t argument_count); |
| 80 const Array& argument_names); | |
| 81 | 73 |
| 82 // Infrastructure copied from class CodeGenerator. | 74 // Infrastructure copied from class CodeGenerator. |
| 83 void GenerateCall(intptr_t token_index, | 75 void GenerateCall(intptr_t token_index, |
| 84 intptr_t try_index, | 76 intptr_t try_index, |
| 85 const ExternalLabel* label, | 77 const ExternalLabel* label, |
| 86 PcDescriptors::Kind kind); | 78 PcDescriptors::Kind kind); |
| 87 | 79 |
| 88 // Type checking helper methods. | 80 // Type checking helper methods. |
| 89 void CheckClassIds(const GrowableArray<intptr_t>& class_ids, | 81 void CheckClassIds(const GrowableArray<intptr_t>& class_ids, |
| 90 Label* is_instance_lbl, | 82 Label* is_instance_lbl, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 const String& dst_name); | 121 const String& dst_name); |
| 130 | 122 |
| 131 void GenerateInstanceOf(intptr_t cid, | 123 void GenerateInstanceOf(intptr_t cid, |
| 132 intptr_t token_index, | 124 intptr_t token_index, |
| 133 intptr_t try_index, | 125 intptr_t try_index, |
| 134 const AbstractType& type, | 126 const AbstractType& type, |
| 135 bool negate_result); | 127 bool negate_result); |
| 136 | 128 |
| 137 void CopyParameters(); | 129 void CopyParameters(); |
| 138 | 130 |
| 139 bool TryIntrinsify(); | 131 virtual void GenerateInlinedGetter(intptr_t offset); |
| 140 void IntrinsifyGetter(); | 132 virtual void GenerateInlinedSetter(intptr_t offset); |
| 141 void IntrinsifySetter(); | |
| 142 static bool CanOptimize(); | |
| 143 | 133 |
| 144 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); | 134 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); |
| 145 }; | 135 }; |
| 146 | 136 |
| 147 } // namespace dart | 137 } // namespace dart |
| 148 | 138 |
| 149 #endif // VM_FLOW_GRAPH_COMPILER_X64_H_ | 139 #endif // VM_FLOW_GRAPH_COMPILER_X64_H_ |
| OLD | NEW |