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 GenerateCallRuntime(intptr_t cid, | 36 virtual void GenerateCallRuntime(intptr_t cid, |
37 intptr_t token_index, | 37 intptr_t token_index, |
38 intptr_t try_index, | 38 intptr_t try_index, |
39 const RuntimeEntry& entry); | 39 const RuntimeEntry& entry); |
| 40 |
| 41 static const int kLocalsOffsetFromFP = (-1 * kWordSize); |
40 | 42 |
41 private: | 43 private: |
42 friend class DeoptimizationStub; | 44 friend class DeoptimizationStub; |
43 | 45 |
44 // TODO(fschneider): Clean up friend-class declarations once all code | 46 virtual void EmitInstructionPrologue(Instruction* instr); |
45 // generator templates have been moved to intermediate_language_x64.cc. | |
46 #define DECLARE_FRIEND(ShortName, ClassName) friend class ClassName; | |
47 FOR_EACH_COMPUTATION(DECLARE_FRIEND) | |
48 #undef DECLARE_FRIEND | |
49 | |
50 static const int kLocalsOffsetFromFP = (-1 * kWordSize); | |
51 | |
52 virtual void VisitBlocks(); | |
53 | |
54 void EmitInstructionPrologue(Instruction* instr); | |
55 | 47 |
56 // Emit code to load a Value into register 'dst'. | 48 // Emit code to load a Value into register 'dst'. |
57 void LoadValue(Register dst, Value* value); | 49 void LoadValue(Register dst, Value* value); |
58 | 50 |
59 void EmitComment(Instruction* instr); | |
60 | |
61 // Returns pc-offset (in bytes) of the pc after the call, can be used to emit | 51 // Returns pc-offset (in bytes) of the pc after the call, can be used to emit |
62 // pc-descriptor information. | 52 // pc-descriptor information. |
63 virtual intptr_t EmitInstanceCall(ExternalLabel* target_label, | 53 virtual intptr_t EmitInstanceCall(ExternalLabel* target_label, |
64 const ICData& ic_data, | 54 const ICData& ic_data, |
65 const Array& arguments_descriptor, | 55 const Array& arguments_descriptor, |
66 intptr_t argument_count); | 56 intptr_t argument_count); |
67 | 57 |
68 // Returns pc-offset (in bytes) of the pc after the call, can be used to emit | 58 // Returns pc-offset (in bytes) of the pc after the call, can be used to emit |
69 // pc-descriptor information. | 59 // pc-descriptor information. |
70 virtual intptr_t EmitStaticCall(const Function& function, | 60 virtual intptr_t EmitStaticCall(const Function& function, |
71 const Array& arguments_descriptor, | 61 const Array& arguments_descriptor, |
72 intptr_t argument_count); | 62 intptr_t argument_count); |
73 | 63 |
74 // Infrastructure copied from class CodeGenerator. | 64 // Infrastructure copied from class CodeGenerator. |
75 void GenerateCall(intptr_t token_index, | 65 virtual void GenerateCall(intptr_t token_index, |
76 intptr_t try_index, | 66 intptr_t try_index, |
77 const ExternalLabel* label, | 67 const ExternalLabel* label, |
78 PcDescriptors::Kind kind); | 68 PcDescriptors::Kind kind); |
79 | 69 |
80 // Type checking helper methods. | 70 // Type checking helper methods. |
81 virtual void CheckClassIds(Register class_id_reg, | 71 virtual void CheckClassIds(Register class_id_reg, |
82 const GrowableArray<intptr_t>& class_ids, | 72 const GrowableArray<intptr_t>& class_ids, |
83 Label* is_instance_lbl, | 73 Label* is_instance_lbl, |
84 Label* is_not_instance_lbl); | 74 Label* is_not_instance_lbl); |
85 | 75 |
86 RawSubtypeTestCache* GenerateInlineInstanceof(intptr_t cid, | 76 RawSubtypeTestCache* GenerateInlineInstanceof(intptr_t cid, |
87 intptr_t token_index, | 77 intptr_t token_index, |
88 const AbstractType& type, | 78 const AbstractType& type, |
(...skipping 20 matching lines...) Expand all Loading... |
109 Label* is_instance_lbl, | 99 Label* is_instance_lbl, |
110 Label* is_not_instance_label); | 100 Label* is_not_instance_label); |
111 | 101 |
112 RawSubtypeTestCache* GenerateSubtype1TestCacheLookup( | 102 RawSubtypeTestCache* GenerateSubtype1TestCacheLookup( |
113 intptr_t cid, | 103 intptr_t cid, |
114 intptr_t token_index, | 104 intptr_t token_index, |
115 const Class& type_class, | 105 const Class& type_class, |
116 Label* is_instance_lbl, | 106 Label* is_instance_lbl, |
117 Label* is_not_instance_lbl); | 107 Label* is_not_instance_lbl); |
118 | 108 |
119 void GenerateAssertAssignable(intptr_t cid, | 109 virtual void GenerateAssertAssignable(intptr_t cid, |
120 intptr_t token_index, | 110 intptr_t token_index, |
121 intptr_t try_index, | 111 intptr_t try_index, |
122 const AbstractType& dst_type, | 112 const AbstractType& dst_type, |
123 const String& dst_name); | 113 const String& dst_name); |
124 | 114 |
125 void GenerateInstanceOf(intptr_t cid, | 115 virtual void GenerateInstanceOf(intptr_t cid, |
126 intptr_t token_index, | 116 intptr_t token_index, |
127 intptr_t try_index, | 117 intptr_t try_index, |
128 const AbstractType& type, | 118 const AbstractType& type, |
129 bool negate_result); | 119 bool negate_result); |
130 | 120 |
131 enum TypeTestStubKind { | 121 enum TypeTestStubKind { |
132 kTestTypeOneArg, | 122 kTestTypeOneArg, |
133 kTestTypeTwoArgs, | 123 kTestTypeTwoArgs, |
134 kTestTypeThreeArgs, | 124 kTestTypeThreeArgs, |
135 }; | 125 }; |
136 | 126 |
137 RawSubtypeTestCache* GenerateCallSubtypeTestStub(TypeTestStubKind test_kind, | 127 RawSubtypeTestCache* GenerateCallSubtypeTestStub(TypeTestStubKind test_kind, |
138 Register instance_reg, | 128 Register instance_reg, |
139 Register type_arguments_reg, | 129 Register type_arguments_reg, |
140 Register temp_reg, | 130 Register temp_reg, |
141 Label* is_instance_lbl, | 131 Label* is_instance_lbl, |
142 Label* is_not_instance_lbl); | 132 Label* is_not_instance_lbl); |
143 | 133 |
144 void GenerateBoolToJump(Register bool_reg, Label* is_true, Label* is_false); | 134 void GenerateBoolToJump(Register bool_reg, Label* is_true, Label* is_false); |
145 | 135 |
146 void CopyParameters(); | 136 void CopyParameters(); |
147 | 137 |
148 virtual void GenerateInlinedGetter(intptr_t offset); | 138 virtual void GenerateInlinedGetter(intptr_t offset); |
149 virtual void GenerateInlinedSetter(intptr_t offset); | 139 virtual void GenerateInlinedSetter(intptr_t offset); |
150 | 140 |
151 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); | 141 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); |
152 }; | 142 }; |
153 | 143 |
154 } // namespace dart | 144 } // namespace dart |
155 | 145 |
156 #endif // VM_FLOW_GRAPH_COMPILER_X64_H_ | 146 #endif // VM_FLOW_GRAPH_COMPILER_X64_H_ |
OLD | NEW |