| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 Register reg, | 72 Register reg, |
| 73 Register temp, | 73 Register temp, |
| 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, | |
| 83 const RuntimeEntry& entry, | 82 const RuntimeEntry& entry, |
| 84 LocationSummary* locs); | 83 LocationSummary* locs); |
| 85 | 84 |
| 86 void GenerateCall(intptr_t token_pos, | 85 void GenerateCall(intptr_t token_pos, |
| 87 intptr_t try_index, | |
| 88 const ExternalLabel* label, | 86 const ExternalLabel* label, |
| 89 PcDescriptors::Kind kind, | 87 PcDescriptors::Kind kind, |
| 90 LocationSummary* locs); | 88 LocationSummary* locs); |
| 91 | 89 |
| 92 void GenerateAssertAssignable(intptr_t deopt_id, | 90 void GenerateAssertAssignable(intptr_t deopt_id, |
| 93 intptr_t token_pos, | 91 intptr_t token_pos, |
| 94 intptr_t try_index, | |
| 95 const AbstractType& dst_type, | 92 const AbstractType& dst_type, |
| 96 const String& dst_name, | 93 const String& dst_name, |
| 97 LocationSummary* locs); | 94 LocationSummary* locs); |
| 98 | 95 |
| 99 void GenerateInstanceOf(intptr_t deopt_id, | 96 void GenerateInstanceOf(intptr_t deopt_id, |
| 100 intptr_t token_pos, | 97 intptr_t token_pos, |
| 101 intptr_t try_index, | |
| 102 const AbstractType& type, | 98 const AbstractType& type, |
| 103 bool negate_result, | 99 bool negate_result, |
| 104 LocationSummary* locs); | 100 LocationSummary* locs); |
| 105 | 101 |
| 106 void GenerateInstanceCall(intptr_t deopt_id, | 102 void GenerateInstanceCall(intptr_t deopt_id, |
| 107 intptr_t token_pos, | 103 intptr_t token_pos, |
| 108 intptr_t try_index, | |
| 109 const String& function_name, | 104 const String& function_name, |
| 110 intptr_t argument_count, | 105 intptr_t argument_count, |
| 111 const Array& argument_names, | 106 const Array& argument_names, |
| 112 intptr_t checked_argument_count, | 107 intptr_t checked_argument_count, |
| 113 LocationSummary* locs); | 108 LocationSummary* locs); |
| 114 | 109 |
| 115 void GenerateStaticCall(intptr_t deopt_id, | 110 void GenerateStaticCall(intptr_t deopt_id, |
| 116 intptr_t token_pos, | 111 intptr_t token_pos, |
| 117 intptr_t try_index, | |
| 118 const Function& function, | 112 const Function& function, |
| 119 intptr_t argument_count, | 113 intptr_t argument_count, |
| 120 const Array& argument_names, | 114 const Array& argument_names, |
| 121 LocationSummary* locs); | 115 LocationSummary* locs); |
| 122 | 116 |
| 123 void GenerateInlinedMathSqrt(Label* done); | 117 void GenerateInlinedMathSqrt(Label* done); |
| 124 | 118 |
| 125 void GenerateNumberTypeCheck(Register kClassIdReg, | 119 void GenerateNumberTypeCheck(Register kClassIdReg, |
| 126 const AbstractType& type, | 120 const AbstractType& type, |
| 127 Label* is_instance_lbl, | 121 Label* is_instance_lbl, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 138 Register instance_reg, | 132 Register instance_reg, |
| 139 Register temp_reg, | 133 Register temp_reg, |
| 140 Label* deopt); | 134 Label* deopt); |
| 141 | 135 |
| 142 void EmitInstanceCall(ExternalLabel* target_label, | 136 void EmitInstanceCall(ExternalLabel* target_label, |
| 143 const ICData& ic_data, | 137 const ICData& ic_data, |
| 144 const Array& arguments_descriptor, | 138 const Array& arguments_descriptor, |
| 145 intptr_t argument_count, | 139 intptr_t argument_count, |
| 146 intptr_t deopt_id, | 140 intptr_t deopt_id, |
| 147 intptr_t token_pos, | 141 intptr_t token_pos, |
| 148 intptr_t try_index, | |
| 149 LocationSummary* locs); | 142 LocationSummary* locs); |
| 150 | 143 |
| 151 void EmitTestAndCall(const ICData& ic_data, | 144 void EmitTestAndCall(const ICData& ic_data, |
| 152 Register class_id_reg, | 145 Register class_id_reg, |
| 153 intptr_t arg_count, | 146 intptr_t arg_count, |
| 154 const Array& arg_names, | 147 const Array& arg_names, |
| 155 Label* deopt, | 148 Label* deopt, |
| 156 intptr_t deopt_id, | 149 intptr_t deopt_id, |
| 157 intptr_t token_index, | 150 intptr_t token_index, |
| 158 intptr_t try_index, | |
| 159 LocationSummary* locs); | 151 LocationSummary* locs); |
| 160 | 152 |
| 161 void EmitDoubleCompareBranch(Condition true_condition, | 153 void EmitDoubleCompareBranch(Condition true_condition, |
| 162 XmmRegister left, | 154 XmmRegister left, |
| 163 XmmRegister right, | 155 XmmRegister right, |
| 164 BranchInstr* branch); | 156 BranchInstr* branch); |
| 165 void EmitDoubleCompareBool(Condition true_condition, | 157 void EmitDoubleCompareBool(Condition true_condition, |
| 166 XmmRegister left, | 158 XmmRegister left, |
| 167 XmmRegister right, | 159 XmmRegister right, |
| 168 Register result); | 160 Register result); |
| 169 | 161 |
| 170 intptr_t StackSize() const; | 162 intptr_t StackSize() const; |
| 171 | 163 |
| 172 // Returns assembler label associated with the given block entry. | 164 // Returns assembler label associated with the given block entry. |
| 173 Label* GetBlockLabel(BlockEntryInstr* block_entry) const; | 165 Label* GetBlockLabel(BlockEntryInstr* block_entry) const; |
| 174 | 166 |
| 175 // Returns true if there is a next block after the current one in | 167 // Returns true if there is a next block after the current one in |
| 176 // the block order and if it is the given block. | 168 // the block order and if it is the given block. |
| 177 bool IsNextBlock(BlockEntryInstr* block_entry) const; | 169 bool IsNextBlock(BlockEntryInstr* block_entry) const; |
| 178 | 170 |
| 179 void AddExceptionHandler(intptr_t try_index, intptr_t pc_offset); | 171 void AddExceptionHandler(intptr_t try_index, intptr_t pc_offset); |
| 180 void AddCurrentDescriptor(PcDescriptors::Kind kind, | 172 void AddCurrentDescriptor(PcDescriptors::Kind kind, |
| 181 intptr_t deopt_id, | 173 intptr_t deopt_id, |
| 182 intptr_t token_pos, | 174 intptr_t token_pos); |
| 183 intptr_t try_index); | |
| 184 | 175 |
| 185 void RecordSafepoint(LocationSummary* locs); | 176 void RecordSafepoint(LocationSummary* locs); |
| 186 | 177 |
| 187 Label* AddDeoptStub(intptr_t deopt_id, DeoptReasonId reason); | 178 Label* AddDeoptStub(intptr_t deopt_id, DeoptReasonId reason); |
| 188 | 179 |
| 189 void AddDeoptIndexAtCall(intptr_t deopt_id, intptr_t token_pos); | 180 void AddDeoptIndexAtCall(intptr_t deopt_id, intptr_t token_pos); |
| 190 | 181 |
| 191 void AddSlowPathCode(SlowPathCode* slow_path); | 182 void AddSlowPathCode(SlowPathCode* slow_path); |
| 192 | 183 |
| 193 void FinalizeExceptionHandlers(const Code& code); | 184 void FinalizeExceptionHandlers(const Code& code); |
| 194 void FinalizePcDescriptors(const Code& code); | 185 void FinalizePcDescriptors(const Code& code); |
| 195 void FinalizeDeoptInfo(const Code& code); | 186 void FinalizeDeoptInfo(const Code& code); |
| 196 void FinalizeStackmaps(const Code& code); | 187 void FinalizeStackmaps(const Code& code); |
| 197 void FinalizeVarDescriptors(const Code& code); | 188 void FinalizeVarDescriptors(const Code& code); |
| 198 void FinalizeComments(const Code& code); | 189 void FinalizeComments(const Code& code); |
| 199 | 190 |
| 200 const Bool& bool_true() const { return bool_true_; } | 191 const Bool& bool_true() const { return bool_true_; } |
| 201 const Bool& bool_false() const { return bool_false_; } | 192 const Bool& bool_false() const { return bool_false_; } |
| 202 const Class& double_class() const { return double_class_; } | 193 const Class& double_class() const { return double_class_; } |
| 203 | 194 |
| 204 // Returns true if the compiled function has a finally clause. | 195 // Returns true if the compiled function has a finally clause. |
| 205 bool HasFinally() const; | 196 bool HasFinally() const; |
| 206 | 197 |
| 207 static const int kLocalsOffsetFromFP = (-1 * kWordSize); | 198 static const int kLocalsOffsetFromFP = (-1 * kWordSize); |
| 208 | 199 |
| 209 void SaveLiveRegisters(LocationSummary* locs); | 200 void SaveLiveRegisters(LocationSummary* locs); |
| 210 void RestoreLiveRegisters(LocationSummary* locs); | 201 void RestoreLiveRegisters(LocationSummary* locs); |
| 211 | 202 |
| 203 intptr_t CurrentTryIndex() const { |
| 204 if (current_block_ == NULL) { |
| 205 return CatchClauseNode::kInvalidTryIndex; |
| 206 } |
| 207 return current_block_->try_index(); |
| 208 } |
| 209 |
| 212 private: | 210 private: |
| 213 friend class DeoptimizationStub; | 211 friend class DeoptimizationStub; |
| 214 | 212 |
| 215 void GenerateDeferredCode(); | 213 void GenerateDeferredCode(); |
| 216 | 214 |
| 217 void EmitInstructionPrologue(Instruction* instr); | 215 void EmitInstructionPrologue(Instruction* instr); |
| 218 | 216 |
| 219 // Emit code to load a Value into register 'dst'. | 217 // Emit code to load a Value into register 'dst'. |
| 220 void LoadValue(Register dst, Value* value); | 218 void LoadValue(Register dst, Value* value); |
| 221 | 219 |
| 222 void EmitStaticCall(const Function& function, | 220 void EmitStaticCall(const Function& function, |
| 223 const Array& arguments_descriptor, | 221 const Array& arguments_descriptor, |
| 224 intptr_t argument_count, | 222 intptr_t argument_count, |
| 225 intptr_t deopt_id, | 223 intptr_t deopt_id, |
| 226 intptr_t token_pos, | 224 intptr_t token_pos, |
| 227 intptr_t try_index, | |
| 228 LocationSummary* locs); | 225 LocationSummary* locs); |
| 229 | 226 |
| 230 // Type checking helper methods. | 227 // Type checking helper methods. |
| 231 void CheckClassIds(Register class_id_reg, | 228 void CheckClassIds(Register class_id_reg, |
| 232 const GrowableArray<intptr_t>& class_ids, | 229 const GrowableArray<intptr_t>& class_ids, |
| 233 Label* is_instance_lbl, | 230 Label* is_instance_lbl, |
| 234 Label* is_not_instance_lbl); | 231 Label* is_not_instance_lbl); |
| 235 | 232 |
| 236 RawSubtypeTestCache* GenerateInlineInstanceof(intptr_t token_pos, | 233 RawSubtypeTestCache* GenerateInlineInstanceof(intptr_t token_pos, |
| 237 const AbstractType& type, | 234 const AbstractType& type, |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 // that should be used when deoptimizing we store it in this variable. | 321 // that should be used when deoptimizing we store it in this variable. |
| 325 // In future AddDeoptStub should be moved out of the instruction template. | 322 // In future AddDeoptStub should be moved out of the instruction template. |
| 326 Environment* pending_deoptimization_env_; | 323 Environment* pending_deoptimization_env_; |
| 327 | 324 |
| 328 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); | 325 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); |
| 329 }; | 326 }; |
| 330 | 327 |
| 331 } // namespace dart | 328 } // namespace dart |
| 332 | 329 |
| 333 #endif // VM_FLOW_GRAPH_COMPILER_X64_H_ | 330 #endif // VM_FLOW_GRAPH_COMPILER_X64_H_ |
| OLD | NEW |