| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 void LoadDoubleOrSmiToXmm(XmmRegister result, | 63 void LoadDoubleOrSmiToXmm(XmmRegister result, |
| 64 Register reg, | 64 Register reg, |
| 65 Register temp, | 65 Register temp, |
| 66 Label* not_double_or_smi); | 66 Label* not_double_or_smi); |
| 67 | 67 |
| 68 // Returns 'true' if code generation for this function is complete, i.e., | 68 // Returns 'true' if code generation for this function is complete, i.e., |
| 69 // no fall-through to regular code is needed. | 69 // no fall-through to regular code is needed. |
| 70 bool TryIntrinsify(); | 70 bool TryIntrinsify(); |
| 71 | 71 |
| 72 void GenerateCallRuntime(intptr_t cid, | 72 void GenerateCallRuntime(intptr_t cid, |
| 73 intptr_t token_index, | 73 intptr_t token_pos, |
| 74 intptr_t try_index, | 74 intptr_t try_index, |
| 75 const RuntimeEntry& entry); | 75 const RuntimeEntry& entry); |
| 76 | 76 |
| 77 // Infrastructure copied from class CodeGenerator. | 77 // Infrastructure copied from class CodeGenerator. |
| 78 void GenerateCall(intptr_t token_index, | 78 void GenerateCall(intptr_t token_pos, |
| 79 intptr_t try_index, | 79 intptr_t try_index, |
| 80 const ExternalLabel* label, | 80 const ExternalLabel* label, |
| 81 PcDescriptors::Kind kind); | 81 PcDescriptors::Kind kind); |
| 82 | 82 |
| 83 void GenerateAssertAssignable(intptr_t cid, | 83 void GenerateAssertAssignable(intptr_t cid, |
| 84 intptr_t token_index, | 84 intptr_t token_pos, |
| 85 intptr_t try_index, | 85 intptr_t try_index, |
| 86 const AbstractType& dst_type, | 86 const AbstractType& dst_type, |
| 87 const String& dst_name); | 87 const String& dst_name); |
| 88 | 88 |
| 89 void GenerateInstanceOf(intptr_t cid, | 89 void GenerateInstanceOf(intptr_t cid, |
| 90 intptr_t token_index, | 90 intptr_t token_pos, |
| 91 intptr_t try_index, | 91 intptr_t try_index, |
| 92 const AbstractType& type, | 92 const AbstractType& type, |
| 93 bool negate_result); | 93 bool negate_result); |
| 94 | 94 |
| 95 void GenerateInstanceCall(intptr_t cid, | 95 void GenerateInstanceCall(intptr_t cid, |
| 96 intptr_t token_index, | 96 intptr_t token_pos, |
| 97 intptr_t try_index, | 97 intptr_t try_index, |
| 98 const String& function_name, | 98 const String& function_name, |
| 99 intptr_t argument_count, | 99 intptr_t argument_count, |
| 100 const Array& argument_names, | 100 const Array& argument_names, |
| 101 intptr_t checked_argument_count); | 101 intptr_t checked_argument_count); |
| 102 | 102 |
| 103 void GenerateStaticCall(intptr_t cid, | 103 void GenerateStaticCall(intptr_t cid, |
| 104 intptr_t token_index, | 104 intptr_t token_pos, |
| 105 intptr_t try_index, | 105 intptr_t try_index, |
| 106 const Function& function, | 106 const Function& function, |
| 107 intptr_t argument_count, | 107 intptr_t argument_count, |
| 108 const Array& argument_names); | 108 const Array& argument_names); |
| 109 | 109 |
| 110 void GenerateInlinedMathSqrt(Label* done); | 110 void GenerateInlinedMathSqrt(Label* done); |
| 111 | 111 |
| 112 void GenerateNumberTypeCheck(Register kClassIdReg, | 112 void GenerateNumberTypeCheck(Register kClassIdReg, |
| 113 const AbstractType& type, | 113 const AbstractType& type, |
| 114 Label* is_instance_lbl, | 114 Label* is_instance_lbl, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // Returns assembler label associated with the given block entry. | 149 // Returns assembler label associated with the given block entry. |
| 150 Label* GetBlockLabel(BlockEntryInstr* block_entry) const; | 150 Label* GetBlockLabel(BlockEntryInstr* block_entry) const; |
| 151 | 151 |
| 152 // Returns true if the next block after current in the current block order | 152 // Returns true if the next block after current in the current block order |
| 153 // is the given block. | 153 // is the given block. |
| 154 bool IsNextBlock(TargetEntryInstr* block_entry) const; | 154 bool IsNextBlock(TargetEntryInstr* block_entry) const; |
| 155 | 155 |
| 156 void AddExceptionHandler(intptr_t try_index, intptr_t pc_offset); | 156 void AddExceptionHandler(intptr_t try_index, intptr_t pc_offset); |
| 157 void AddCurrentDescriptor(PcDescriptors::Kind kind, | 157 void AddCurrentDescriptor(PcDescriptors::Kind kind, |
| 158 intptr_t cid, | 158 intptr_t cid, |
| 159 intptr_t token_index, | 159 intptr_t token_pos, |
| 160 intptr_t try_index); | 160 intptr_t try_index); |
| 161 Label* AddDeoptStub(intptr_t deopt_id, | 161 Label* AddDeoptStub(intptr_t deopt_id, |
| 162 intptr_t deopt_token_index, | 162 intptr_t deopt_token_pos, |
| 163 intptr_t try_index_, | 163 intptr_t try_index_, |
| 164 DeoptReasonId reason, | 164 DeoptReasonId reason, |
| 165 Register reg1 = kNoRegister, | 165 Register reg1 = kNoRegister, |
| 166 Register reg2 = kNoRegister, | 166 Register reg2 = kNoRegister, |
| 167 Register reg3 = kNoRegister); | 167 Register reg3 = kNoRegister); |
| 168 | 168 |
| 169 void FinalizeExceptionHandlers(const Code& code); | 169 void FinalizeExceptionHandlers(const Code& code); |
| 170 void FinalizePcDescriptors(const Code& code); | 170 void FinalizePcDescriptors(const Code& code); |
| 171 void FinalizeStackmaps(const Code& code); | 171 void FinalizeStackmaps(const Code& code); |
| 172 void FinalizeVarDescriptors(const Code& code); | 172 void FinalizeVarDescriptors(const Code& code); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 198 const Array& arguments_descriptor, | 198 const Array& arguments_descriptor, |
| 199 intptr_t argument_count); | 199 intptr_t argument_count); |
| 200 | 200 |
| 201 // Type checking helper methods. | 201 // Type checking helper methods. |
| 202 void CheckClassIds(Register class_id_reg, | 202 void CheckClassIds(Register class_id_reg, |
| 203 const GrowableArray<intptr_t>& class_ids, | 203 const GrowableArray<intptr_t>& class_ids, |
| 204 Label* is_instance_lbl, | 204 Label* is_instance_lbl, |
| 205 Label* is_not_instance_lbl); | 205 Label* is_not_instance_lbl); |
| 206 | 206 |
| 207 RawSubtypeTestCache* GenerateInlineInstanceof(intptr_t cid, | 207 RawSubtypeTestCache* GenerateInlineInstanceof(intptr_t cid, |
| 208 intptr_t token_index, | 208 intptr_t token_pos, |
| 209 const AbstractType& type, | 209 const AbstractType& type, |
| 210 Label* is_instance_lbl, | 210 Label* is_instance_lbl, |
| 211 Label* is_not_instance_lbl); | 211 Label* is_not_instance_lbl); |
| 212 | 212 |
| 213 RawSubtypeTestCache* GenerateInstantiatedTypeWithArgumentsTest( | 213 RawSubtypeTestCache* GenerateInstantiatedTypeWithArgumentsTest( |
| 214 intptr_t cid, | 214 intptr_t cid, |
| 215 intptr_t token_index, | 215 intptr_t token_pos, |
| 216 const AbstractType& dst_type, | 216 const AbstractType& dst_type, |
| 217 Label* is_instance_lbl, | 217 Label* is_instance_lbl, |
| 218 Label* is_not_instance_lbl); | 218 Label* is_not_instance_lbl); |
| 219 | 219 |
| 220 void GenerateInstantiatedTypeNoArgumentsTest(intptr_t cid, | 220 void GenerateInstantiatedTypeNoArgumentsTest(intptr_t cid, |
| 221 intptr_t token_index, | 221 intptr_t token_pos, |
| 222 const AbstractType& dst_type, | 222 const AbstractType& dst_type, |
| 223 Label* is_instance_lbl, | 223 Label* is_instance_lbl, |
| 224 Label* is_not_instance_lbl); | 224 Label* is_not_instance_lbl); |
| 225 | 225 |
| 226 RawSubtypeTestCache* GenerateUninstantiatedTypeTest( | 226 RawSubtypeTestCache* GenerateUninstantiatedTypeTest( |
| 227 intptr_t cid, | 227 intptr_t cid, |
| 228 intptr_t token_index, | 228 intptr_t token_pos, |
| 229 const AbstractType& dst_type, | 229 const AbstractType& dst_type, |
| 230 Label* is_instance_lbl, | 230 Label* is_instance_lbl, |
| 231 Label* is_not_instance_label); | 231 Label* is_not_instance_label); |
| 232 | 232 |
| 233 RawSubtypeTestCache* GenerateSubtype1TestCacheLookup( | 233 RawSubtypeTestCache* GenerateSubtype1TestCacheLookup( |
| 234 intptr_t cid, | 234 intptr_t cid, |
| 235 intptr_t token_index, | 235 intptr_t token_pos, |
| 236 const Class& type_class, | 236 const Class& type_class, |
| 237 Label* is_instance_lbl, | 237 Label* is_instance_lbl, |
| 238 Label* is_not_instance_lbl); | 238 Label* is_not_instance_lbl); |
| 239 | 239 |
| 240 enum TypeTestStubKind { | 240 enum TypeTestStubKind { |
| 241 kTestTypeOneArg, | 241 kTestTypeOneArg, |
| 242 kTestTypeTwoArgs, | 242 kTestTypeTwoArgs, |
| 243 kTestTypeThreeArgs, | 243 kTestTypeThreeArgs, |
| 244 }; | 244 }; |
| 245 | 245 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 | 285 |
| 286 FrameRegisterAllocator frame_register_allocator_; | 286 FrameRegisterAllocator frame_register_allocator_; |
| 287 | 287 |
| 288 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); | 288 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); |
| 289 }; | 289 }; |
| 290 | 290 |
| 291 | 291 |
| 292 class DeoptimizationStub : public ZoneAllocated { | 292 class DeoptimizationStub : public ZoneAllocated { |
| 293 public: | 293 public: |
| 294 DeoptimizationStub(intptr_t deopt_id, | 294 DeoptimizationStub(intptr_t deopt_id, |
| 295 intptr_t deopt_token_index, | 295 intptr_t deopt_token_pos, |
| 296 intptr_t try_index, | 296 intptr_t try_index, |
| 297 DeoptReasonId reason) | 297 DeoptReasonId reason) |
| 298 : deopt_id_(deopt_id), | 298 : deopt_id_(deopt_id), |
| 299 deopt_token_index_(deopt_token_index), | 299 deopt_token_pos_(deopt_token_pos), |
| 300 try_index_(try_index), | 300 try_index_(try_index), |
| 301 reason_(reason), | 301 reason_(reason), |
| 302 registers_(2), | 302 registers_(2), |
| 303 entry_label_() {} | 303 entry_label_() {} |
| 304 | 304 |
| 305 void Push(Register reg) { registers_.Add(reg); } | 305 void Push(Register reg) { registers_.Add(reg); } |
| 306 Label* entry_label() { return &entry_label_; } | 306 Label* entry_label() { return &entry_label_; } |
| 307 | 307 |
| 308 // Implementation is in architecture specific file. | 308 // Implementation is in architecture specific file. |
| 309 void GenerateCode(FlowGraphCompiler* compiler); | 309 void GenerateCode(FlowGraphCompiler* compiler); |
| 310 | 310 |
| 311 private: | 311 private: |
| 312 const intptr_t deopt_id_; | 312 const intptr_t deopt_id_; |
| 313 const intptr_t deopt_token_index_; | 313 const intptr_t deopt_token_pos_; |
| 314 const intptr_t try_index_; | 314 const intptr_t try_index_; |
| 315 const DeoptReasonId reason_; | 315 const DeoptReasonId reason_; |
| 316 GrowableArray<Register> registers_; | 316 GrowableArray<Register> registers_; |
| 317 Label entry_label_; | 317 Label entry_label_; |
| 318 | 318 |
| 319 DISALLOW_COPY_AND_ASSIGN(DeoptimizationStub); | 319 DISALLOW_COPY_AND_ASSIGN(DeoptimizationStub); |
| 320 }; | 320 }; |
| 321 | 321 |
| 322 } // namespace dart | 322 } // namespace dart |
| 323 | 323 |
| 324 #endif // VM_FLOW_GRAPH_COMPILER_X64_H_ | 324 #endif // VM_FLOW_GRAPH_COMPILER_X64_H_ |
| OLD | NEW |