| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 Label* not_double_or_smi); | 74 Label* not_double_or_smi); |
| 75 | 75 |
| 76 // Returns 'true' if code generation for this function is complete, i.e., | 76 // Returns 'true' if code generation for this function is complete, i.e., |
| 77 // no fall-through to regular code is needed. | 77 // no fall-through to regular code is needed. |
| 78 bool TryIntrinsify(); | 78 bool TryIntrinsify(); |
| 79 | 79 |
| 80 void GenerateCallRuntime(intptr_t deopt_id, | 80 void GenerateCallRuntime(intptr_t deopt_id, |
| 81 intptr_t token_pos, | 81 intptr_t token_pos, |
| 82 intptr_t try_index, | 82 intptr_t try_index, |
| 83 const RuntimeEntry& entry, | 83 const RuntimeEntry& entry, |
| 84 BitmapBuilder* stack_bitmap); | 84 LocationSummary* locs); |
| 85 | 85 |
| 86 void GenerateCall(intptr_t token_pos, | 86 void GenerateCall(intptr_t token_pos, |
| 87 intptr_t try_index, | 87 intptr_t try_index, |
| 88 const ExternalLabel* label, | 88 const ExternalLabel* label, |
| 89 PcDescriptors::Kind kind, | 89 PcDescriptors::Kind kind, |
| 90 BitmapBuilder* stack_bitmap); | 90 LocationSummary* locs); |
| 91 | 91 |
| 92 void GenerateAssertAssignable(intptr_t deopt_id, | 92 void GenerateAssertAssignable(intptr_t deopt_id, |
| 93 intptr_t token_pos, | 93 intptr_t token_pos, |
| 94 intptr_t try_index, | 94 intptr_t try_index, |
| 95 const AbstractType& dst_type, | 95 const AbstractType& dst_type, |
| 96 const String& dst_name, | 96 const String& dst_name, |
| 97 BitmapBuilder* stack_bitmap); | 97 LocationSummary* locs); |
| 98 | 98 |
| 99 void GenerateInstanceOf(intptr_t deopt_id, | 99 void GenerateInstanceOf(intptr_t deopt_id, |
| 100 intptr_t token_pos, | 100 intptr_t token_pos, |
| 101 intptr_t try_index, | 101 intptr_t try_index, |
| 102 const AbstractType& type, | 102 const AbstractType& type, |
| 103 bool negate_result, | 103 bool negate_result, |
| 104 BitmapBuilder* stack_bitmap); | 104 LocationSummary* locs); |
| 105 | 105 |
| 106 void GenerateInstanceCall(intptr_t deopt_id, | 106 void GenerateInstanceCall(intptr_t deopt_id, |
| 107 intptr_t token_pos, | 107 intptr_t token_pos, |
| 108 intptr_t try_index, | 108 intptr_t try_index, |
| 109 const String& function_name, | 109 const String& function_name, |
| 110 intptr_t argument_count, | 110 intptr_t argument_count, |
| 111 const Array& argument_names, | 111 const Array& argument_names, |
| 112 intptr_t checked_argument_count, | 112 intptr_t checked_argument_count, |
| 113 BitmapBuilder* stack_bitmap); | 113 LocationSummary* locs); |
| 114 | 114 |
| 115 void GenerateStaticCall(intptr_t deopt_id, | 115 void GenerateStaticCall(intptr_t deopt_id, |
| 116 intptr_t token_pos, | 116 intptr_t token_pos, |
| 117 intptr_t try_index, | 117 intptr_t try_index, |
| 118 const Function& function, | 118 const Function& function, |
| 119 intptr_t argument_count, | 119 intptr_t argument_count, |
| 120 const Array& argument_names, | 120 const Array& argument_names, |
| 121 BitmapBuilder* stack_bitmap); | 121 LocationSummary* locs); |
| 122 | 122 |
| 123 void GenerateInlinedMathSqrt(Label* done); | 123 void GenerateInlinedMathSqrt(Label* done); |
| 124 | 124 |
| 125 void GenerateNumberTypeCheck(Register kClassIdReg, | 125 void GenerateNumberTypeCheck(Register kClassIdReg, |
| 126 const AbstractType& type, | 126 const AbstractType& type, |
| 127 Label* is_instance_lbl, | 127 Label* is_instance_lbl, |
| 128 Label* is_not_instance_lbl); | 128 Label* is_not_instance_lbl); |
| 129 void GenerateStringTypeCheck(Register kClassIdReg, | 129 void GenerateStringTypeCheck(Register kClassIdReg, |
| 130 Label* is_instance_lbl, | 130 Label* is_instance_lbl, |
| 131 Label* is_not_instance_lbl); | 131 Label* is_not_instance_lbl); |
| 132 void GenerateListTypeCheck(Register kClassIdReg, | 132 void GenerateListTypeCheck(Register kClassIdReg, |
| 133 Label* is_instance_lbl); | 133 Label* is_instance_lbl); |
| 134 | 134 |
| 135 void EmitComment(Instruction* instr); | 135 void EmitComment(Instruction* instr); |
| 136 | 136 |
| 137 void EmitClassChecksNoSmi(const ICData& ic_data, | 137 void EmitClassChecksNoSmi(const ICData& ic_data, |
| 138 Register instance_reg, | 138 Register instance_reg, |
| 139 Register temp_reg, | 139 Register temp_reg, |
| 140 Label* deopt); | 140 Label* deopt); |
| 141 | 141 |
| 142 // Returns pc-offset (in bytes) of the pc after the call, can be used to emit | 142 void EmitInstanceCall(ExternalLabel* target_label, |
| 143 // pc-descriptor information. | 143 const ICData& ic_data, |
| 144 intptr_t EmitInstanceCall(ExternalLabel* target_label, | 144 const Array& arguments_descriptor, |
| 145 const ICData& ic_data, | 145 intptr_t argument_count, |
| 146 const Array& arguments_descriptor, | 146 intptr_t deopt_id, |
| 147 intptr_t argument_count); | 147 intptr_t token_pos, |
| 148 intptr_t try_index, |
| 149 LocationSummary* locs); |
| 148 | 150 |
| 149 void EmitTestAndCall(const ICData& ic_data, | 151 void EmitTestAndCall(const ICData& ic_data, |
| 150 Register class_id_reg, | 152 Register class_id_reg, |
| 151 intptr_t arg_count, | 153 intptr_t arg_count, |
| 152 const Array& arg_names, | 154 const Array& arg_names, |
| 153 Label* deopt, | 155 Label* deopt, |
| 154 Label* done, // Can be NULL, which means fallthrough. | 156 Label* done, // Can be NULL, which means fallthrough. |
| 155 intptr_t deopt_id, | 157 intptr_t deopt_id, |
| 156 intptr_t token_index, | 158 intptr_t token_index, |
| 157 intptr_t try_index, | 159 intptr_t try_index, |
| 158 BitmapBuilder* stack_bitmap); | 160 LocationSummary* locs); |
| 159 | 161 |
| 160 void EmitDoubleCompareBranch(Condition true_condition, | 162 void EmitDoubleCompareBranch(Condition true_condition, |
| 161 XmmRegister left, | 163 XmmRegister left, |
| 162 XmmRegister right, | 164 XmmRegister right, |
| 163 BranchInstr* branch); | 165 BranchInstr* branch); |
| 164 void EmitDoubleCompareBool(Condition true_condition, | 166 void EmitDoubleCompareBool(Condition true_condition, |
| 165 XmmRegister left, | 167 XmmRegister left, |
| 166 XmmRegister right, | 168 XmmRegister right, |
| 167 Register result); | 169 Register result); |
| 168 | 170 |
| 169 intptr_t StackSize() const; | 171 intptr_t StackSize() const; |
| 170 | 172 |
| 171 // Returns assembler label associated with the given block entry. | 173 // Returns assembler label associated with the given block entry. |
| 172 Label* GetBlockLabel(BlockEntryInstr* block_entry) const; | 174 Label* GetBlockLabel(BlockEntryInstr* block_entry) const; |
| 173 | 175 |
| 174 // Returns true if there is a next block after the current one in | 176 // Returns true if there is a next block after the current one in |
| 175 // the block order and if it is the given block. | 177 // the block order and if it is the given block. |
| 176 bool IsNextBlock(BlockEntryInstr* block_entry) const; | 178 bool IsNextBlock(BlockEntryInstr* block_entry) const; |
| 177 | 179 |
| 178 void AddExceptionHandler(intptr_t try_index, intptr_t pc_offset); | 180 void AddExceptionHandler(intptr_t try_index, intptr_t pc_offset); |
| 179 void AddCurrentDescriptor(PcDescriptors::Kind kind, | 181 void AddCurrentDescriptor(PcDescriptors::Kind kind, |
| 180 intptr_t deopt_id, | 182 intptr_t deopt_id, |
| 181 intptr_t token_pos, | 183 intptr_t token_pos, |
| 182 intptr_t try_index); | 184 intptr_t try_index); |
| 185 |
| 186 void RecordSafepoint(LocationSummary* locs); |
| 187 |
| 183 Label* AddDeoptStub(intptr_t deopt_id, | 188 Label* AddDeoptStub(intptr_t deopt_id, |
| 184 intptr_t try_index_, | 189 intptr_t try_index_, |
| 185 DeoptReasonId reason); | 190 DeoptReasonId reason); |
| 186 | 191 |
| 187 void AddSlowPathCode(SlowPathCode* slow_path); | 192 void AddSlowPathCode(SlowPathCode* slow_path); |
| 188 | 193 |
| 189 void FinalizeExceptionHandlers(const Code& code); | 194 void FinalizeExceptionHandlers(const Code& code); |
| 190 void FinalizePcDescriptors(const Code& code); | 195 void FinalizePcDescriptors(const Code& code); |
| 191 void FinalizeDeoptInfo(const Code& code); | 196 void FinalizeDeoptInfo(const Code& code); |
| 192 void FinalizeStackmaps(const Code& code); | 197 void FinalizeStackmaps(const Code& code); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 208 private: | 213 private: |
| 209 friend class DeoptimizationStub; | 214 friend class DeoptimizationStub; |
| 210 | 215 |
| 211 void GenerateDeferredCode(); | 216 void GenerateDeferredCode(); |
| 212 | 217 |
| 213 void EmitInstructionPrologue(Instruction* instr); | 218 void EmitInstructionPrologue(Instruction* instr); |
| 214 | 219 |
| 215 // Emit code to load a Value into register 'dst'. | 220 // Emit code to load a Value into register 'dst'. |
| 216 void LoadValue(Register dst, Value* value); | 221 void LoadValue(Register dst, Value* value); |
| 217 | 222 |
| 218 // Returns pc-offset (in bytes) of the pc after the call, can be used to emit | 223 void EmitStaticCall(const Function& function, |
| 219 // pc-descriptor information. | 224 const Array& arguments_descriptor, |
| 220 intptr_t EmitStaticCall(const Function& function, | 225 intptr_t argument_count, |
| 221 const Array& arguments_descriptor, | 226 intptr_t deopt_id, |
| 222 intptr_t argument_count); | 227 intptr_t token_pos, |
| 228 intptr_t try_index, |
| 229 LocationSummary* locs); |
| 223 | 230 |
| 224 // Type checking helper methods. | 231 // Type checking helper methods. |
| 225 void CheckClassIds(Register class_id_reg, | 232 void CheckClassIds(Register class_id_reg, |
| 226 const GrowableArray<intptr_t>& class_ids, | 233 const GrowableArray<intptr_t>& class_ids, |
| 227 Label* is_instance_lbl, | 234 Label* is_instance_lbl, |
| 228 Label* is_not_instance_lbl); | 235 Label* is_not_instance_lbl); |
| 229 | 236 |
| 230 RawSubtypeTestCache* GenerateInlineInstanceof(intptr_t token_pos, | 237 RawSubtypeTestCache* GenerateInlineInstanceof(intptr_t token_pos, |
| 231 const AbstractType& type, | 238 const AbstractType& type, |
| 232 Label* is_instance_lbl, | 239 Label* is_instance_lbl, |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 // that should be used when deoptimizing we store it in this variable. | 325 // that should be used when deoptimizing we store it in this variable. |
| 319 // In future AddDeoptStub should be moved out of the instruction template. | 326 // In future AddDeoptStub should be moved out of the instruction template. |
| 320 Environment* pending_deoptimization_env_; | 327 Environment* pending_deoptimization_env_; |
| 321 | 328 |
| 322 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); | 329 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); |
| 323 }; | 330 }; |
| 324 | 331 |
| 325 } // namespace dart | 332 } // namespace dart |
| 326 | 333 |
| 327 #endif // VM_FLOW_GRAPH_COMPILER_X64_H_ | 334 #endif // VM_FLOW_GRAPH_COMPILER_X64_H_ |
| OLD | NEW |