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_IA32_H_ | 5 #ifndef VM_FLOW_GRAPH_COMPILER_IA32_H_ |
6 #define VM_FLOW_GRAPH_COMPILER_IA32_H_ | 6 #define VM_FLOW_GRAPH_COMPILER_IA32_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_ia32.h. | 9 #error Include flow_graph_compiler.h instead of flow_graph_compiler_ia32.h. |
10 #endif | 10 #endif |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 void LoadDoubleOrSmiToXmm(XmmRegister result, | 69 void LoadDoubleOrSmiToXmm(XmmRegister result, |
70 Register reg, | 70 Register reg, |
71 Register temp, | 71 Register temp, |
72 Label* not_double_or_smi); | 72 Label* not_double_or_smi); |
73 | 73 |
74 // Returns 'true' if code generation for this function is complete, i.e., | 74 // Returns 'true' if code generation for this function is complete, i.e., |
75 // no fall-through to regular code is needed. | 75 // no fall-through to regular code is needed. |
76 bool TryIntrinsify(); | 76 bool TryIntrinsify(); |
77 | 77 |
78 void GenerateCallRuntime(intptr_t cid, | 78 void GenerateCallRuntime(intptr_t cid, |
79 intptr_t token_index, | 79 intptr_t token_pos, |
80 intptr_t try_index, | 80 intptr_t try_index, |
81 const RuntimeEntry& entry); | 81 const RuntimeEntry& entry); |
82 | 82 |
83 // Returns pc-offset (in bytes) of the pc after the call, can be used to emit | 83 // Returns pc-offset (in bytes) of the pc after the call, can be used to emit |
84 // pc-descriptor information. | 84 // pc-descriptor information. |
85 intptr_t EmitStaticCall(const Function& function, | 85 intptr_t EmitStaticCall(const Function& function, |
86 const Array& arguments_descriptor, | 86 const Array& arguments_descriptor, |
87 intptr_t argument_count); | 87 intptr_t argument_count); |
88 | 88 |
89 void GenerateCall(intptr_t token_index, | 89 void GenerateCall(intptr_t token_pos, |
90 intptr_t try_index, | 90 intptr_t try_index, |
91 const ExternalLabel* label, | 91 const ExternalLabel* label, |
92 PcDescriptors::Kind kind); | 92 PcDescriptors::Kind kind); |
93 void GenerateInstanceOf(intptr_t cid, | 93 void GenerateInstanceOf(intptr_t cid, |
94 intptr_t token_index, | 94 intptr_t token_pos, |
95 intptr_t try_index, | 95 intptr_t try_index, |
96 const AbstractType& type, | 96 const AbstractType& type, |
97 bool negate_result); | 97 bool negate_result); |
98 void GenerateAssertAssignable(intptr_t cid, | 98 void GenerateAssertAssignable(intptr_t cid, |
99 intptr_t token_index, | 99 intptr_t token_pos, |
100 intptr_t try_index, | 100 intptr_t try_index, |
101 const AbstractType& dst_type, | 101 const AbstractType& dst_type, |
102 const String& dst_name); | 102 const String& dst_name); |
103 | 103 |
104 void GenerateInstanceCall(intptr_t cid, | 104 void GenerateInstanceCall(intptr_t cid, |
105 intptr_t token_index, | 105 intptr_t token_pos, |
106 intptr_t try_index, | 106 intptr_t try_index, |
107 const String& function_name, | 107 const String& function_name, |
108 intptr_t argument_count, | 108 intptr_t argument_count, |
109 const Array& argument_names, | 109 const Array& argument_names, |
110 intptr_t checked_argument_count); | 110 intptr_t checked_argument_count); |
111 | 111 |
112 void GenerateStaticCall(intptr_t cid, | 112 void GenerateStaticCall(intptr_t cid, |
113 intptr_t token_index, | 113 intptr_t token_pos, |
114 intptr_t try_index, | 114 intptr_t try_index, |
115 const Function& function, | 115 const Function& function, |
116 intptr_t argument_count, | 116 intptr_t argument_count, |
117 const Array& argument_names); | 117 const Array& argument_names); |
118 | 118 |
119 void GenerateInlinedMathSqrt(Label* done); | 119 void GenerateInlinedMathSqrt(Label* done); |
120 | 120 |
121 void GenerateNumberTypeCheck(Register kClassIdReg, | 121 void GenerateNumberTypeCheck(Register kClassIdReg, |
122 const AbstractType& type, | 122 const AbstractType& type, |
123 Label* is_instance_lbl, | 123 Label* is_instance_lbl, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // Returns assembler label associated with the given block entry. | 158 // Returns assembler label associated with the given block entry. |
159 Label* GetBlockLabel(BlockEntryInstr* block_entry) const; | 159 Label* GetBlockLabel(BlockEntryInstr* block_entry) const; |
160 | 160 |
161 // Returns true if the next block after current in the current block order | 161 // Returns true if the next block after current in the current block order |
162 // is the given block. | 162 // is the given block. |
163 bool IsNextBlock(TargetEntryInstr* block_entry) const; | 163 bool IsNextBlock(TargetEntryInstr* block_entry) const; |
164 | 164 |
165 void AddExceptionHandler(intptr_t try_index, intptr_t pc_offset); | 165 void AddExceptionHandler(intptr_t try_index, intptr_t pc_offset); |
166 void AddCurrentDescriptor(PcDescriptors::Kind kind, | 166 void AddCurrentDescriptor(PcDescriptors::Kind kind, |
167 intptr_t cid, | 167 intptr_t cid, |
168 intptr_t token_index, | 168 intptr_t token_pos, |
169 intptr_t try_index); | 169 intptr_t try_index); |
170 Label* AddDeoptStub(intptr_t deopt_id, | 170 Label* AddDeoptStub(intptr_t deopt_id, |
171 intptr_t deopt_token_index, | 171 intptr_t deopt_token_pos, |
172 intptr_t try_index_, | 172 intptr_t try_index_, |
173 DeoptReasonId reason, | 173 DeoptReasonId reason, |
174 Register reg1 = kNoRegister, | 174 Register reg1 = kNoRegister, |
175 Register reg2 = kNoRegister, | 175 Register reg2 = kNoRegister, |
176 Register reg3 = kNoRegister); | 176 Register reg3 = kNoRegister); |
177 | 177 |
178 void FinalizeExceptionHandlers(const Code& code); | 178 void FinalizeExceptionHandlers(const Code& code); |
179 void FinalizePcDescriptors(const Code& code); | 179 void FinalizePcDescriptors(const Code& code); |
180 void FinalizeStackmaps(const Code& code); | 180 void FinalizeStackmaps(const Code& code); |
181 void FinalizeVarDescriptors(const Code& code); | 181 void FinalizeVarDescriptors(const Code& code); |
(...skipping 14 matching lines...) Expand all Loading... |
196 | 196 |
197 void GenerateDeferredCode(); | 197 void GenerateDeferredCode(); |
198 | 198 |
199 void CopyParameters(); | 199 void CopyParameters(); |
200 void EmitInstructionPrologue(Instruction* instr); | 200 void EmitInstructionPrologue(Instruction* instr); |
201 | 201 |
202 void GenerateInlinedGetter(intptr_t offset); | 202 void GenerateInlinedGetter(intptr_t offset); |
203 void GenerateInlinedSetter(intptr_t offset); | 203 void GenerateInlinedSetter(intptr_t offset); |
204 | 204 |
205 RawSubtypeTestCache* GenerateInlineInstanceof(intptr_t cid, | 205 RawSubtypeTestCache* GenerateInlineInstanceof(intptr_t cid, |
206 intptr_t token_index, | 206 intptr_t token_pos, |
207 const AbstractType& type, | 207 const AbstractType& type, |
208 Label* is_instance_lbl, | 208 Label* is_instance_lbl, |
209 Label* is_not_instance_lbl); | 209 Label* is_not_instance_lbl); |
210 | 210 |
211 RawSubtypeTestCache* GenerateInstantiatedTypeWithArgumentsTest( | 211 RawSubtypeTestCache* GenerateInstantiatedTypeWithArgumentsTest( |
212 intptr_t cid, | 212 intptr_t cid, |
213 intptr_t token_index, | 213 intptr_t token_pos, |
214 const AbstractType& dst_type, | 214 const AbstractType& dst_type, |
215 Label* is_instance_lbl, | 215 Label* is_instance_lbl, |
216 Label* is_not_instance_lbl); | 216 Label* is_not_instance_lbl); |
217 | 217 |
218 void GenerateInstantiatedTypeNoArgumentsTest(intptr_t cid, | 218 void GenerateInstantiatedTypeNoArgumentsTest(intptr_t cid, |
219 intptr_t token_index, | 219 intptr_t token_pos, |
220 const AbstractType& dst_type, | 220 const AbstractType& dst_type, |
221 Label* is_instance_lbl, | 221 Label* is_instance_lbl, |
222 Label* is_not_instance_lbl); | 222 Label* is_not_instance_lbl); |
223 | 223 |
224 RawSubtypeTestCache* GenerateUninstantiatedTypeTest( | 224 RawSubtypeTestCache* GenerateUninstantiatedTypeTest( |
225 intptr_t cid, | 225 intptr_t cid, |
226 intptr_t token_index, | 226 intptr_t token_pos, |
227 const AbstractType& dst_type, | 227 const AbstractType& dst_type, |
228 Label* is_instance_lbl, | 228 Label* is_instance_lbl, |
229 Label* is_not_instance_label); | 229 Label* is_not_instance_label); |
230 | 230 |
231 RawSubtypeTestCache* GenerateSubtype1TestCacheLookup( | 231 RawSubtypeTestCache* GenerateSubtype1TestCacheLookup( |
232 intptr_t cid, | 232 intptr_t cid, |
233 intptr_t token_index, | 233 intptr_t token_pos, |
234 const Class& type_class, | 234 const Class& type_class, |
235 Label* is_instance_lbl, | 235 Label* is_instance_lbl, |
236 Label* is_not_instance_lbl); | 236 Label* is_not_instance_lbl); |
237 | 237 |
238 enum TypeTestStubKind { | 238 enum TypeTestStubKind { |
239 kTestTypeOneArg, | 239 kTestTypeOneArg, |
240 kTestTypeTwoArgs, | 240 kTestTypeTwoArgs, |
241 kTestTypeThreeArgs, | 241 kTestTypeThreeArgs, |
242 }; | 242 }; |
243 | 243 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 284 |
285 FrameRegisterAllocator frame_register_allocator_; | 285 FrameRegisterAllocator frame_register_allocator_; |
286 | 286 |
287 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); | 287 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); |
288 }; | 288 }; |
289 | 289 |
290 | 290 |
291 class DeoptimizationStub : public ZoneAllocated { | 291 class DeoptimizationStub : public ZoneAllocated { |
292 public: | 292 public: |
293 DeoptimizationStub(intptr_t deopt_id, | 293 DeoptimizationStub(intptr_t deopt_id, |
294 intptr_t deopt_token_index, | 294 intptr_t deopt_token_pos, |
295 intptr_t try_index, | 295 intptr_t try_index, |
296 DeoptReasonId reason) | 296 DeoptReasonId reason) |
297 : deopt_id_(deopt_id), | 297 : deopt_id_(deopt_id), |
298 deopt_token_index_(deopt_token_index), | 298 deopt_token_pos_(deopt_token_pos), |
299 try_index_(try_index), | 299 try_index_(try_index), |
300 reason_(reason), | 300 reason_(reason), |
301 registers_(2), | 301 registers_(2), |
302 entry_label_() {} | 302 entry_label_() {} |
303 | 303 |
304 void Push(Register reg) { registers_.Add(reg); } | 304 void Push(Register reg) { registers_.Add(reg); } |
305 Label* entry_label() { return &entry_label_; } | 305 Label* entry_label() { return &entry_label_; } |
306 | 306 |
307 // Implementation is in architecture specific file. | 307 // Implementation is in architecture specific file. |
308 void GenerateCode(FlowGraphCompiler* compiler); | 308 void GenerateCode(FlowGraphCompiler* compiler); |
309 | 309 |
310 private: | 310 private: |
311 const intptr_t deopt_id_; | 311 const intptr_t deopt_id_; |
312 const intptr_t deopt_token_index_; | 312 const intptr_t deopt_token_pos_; |
313 const intptr_t try_index_; | 313 const intptr_t try_index_; |
314 const DeoptReasonId reason_; | 314 const DeoptReasonId reason_; |
315 GrowableArray<Register> registers_; | 315 GrowableArray<Register> registers_; |
316 Label entry_label_; | 316 Label entry_label_; |
317 | 317 |
318 DISALLOW_COPY_AND_ASSIGN(DeoptimizationStub); | 318 DISALLOW_COPY_AND_ASSIGN(DeoptimizationStub); |
319 }; | 319 }; |
320 | 320 |
321 | 321 |
322 } // namespace dart | 322 } // namespace dart |
323 | 323 |
324 #endif // VM_FLOW_GRAPH_COMPILER_IA32_H_ | 324 #endif // VM_FLOW_GRAPH_COMPILER_IA32_H_ |
OLD | NEW |