| 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 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 EmitLoadIndexedGeneric(LoadIndexedComp* comp); | 144   void EmitLoadIndexedGeneric(LoadIndexedComp* comp); | 
| 152   void EmitTestAndCall(const ICData& ic_data, | 145   void EmitTestAndCall(const ICData& ic_data, | 
| 153                        Register class_id_reg, | 146                        Register class_id_reg, | 
| 154                        intptr_t arg_count, | 147                        intptr_t arg_count, | 
| 155                        const Array& arg_names, | 148                        const Array& arg_names, | 
| 156                        Label* deopt, | 149                        Label* deopt, | 
| 157                        intptr_t deopt_id, | 150                        intptr_t deopt_id, | 
| 158                        intptr_t token_index, | 151                        intptr_t token_index, | 
| 159                        intptr_t try_index, |  | 
| 160                        LocationSummary* locs); | 152                        LocationSummary* locs); | 
| 161 | 153 | 
| 162   void EmitDoubleCompareBranch(Condition true_condition, | 154   void EmitDoubleCompareBranch(Condition true_condition, | 
| 163                                XmmRegister left, | 155                                XmmRegister left, | 
| 164                                XmmRegister right, | 156                                XmmRegister right, | 
| 165                                BranchInstr* branch); | 157                                BranchInstr* branch); | 
| 166   void EmitDoubleCompareBool(Condition true_condition, | 158   void EmitDoubleCompareBool(Condition true_condition, | 
| 167                              XmmRegister left, | 159                              XmmRegister left, | 
| 168                              XmmRegister right, | 160                              XmmRegister right, | 
| 169                              Register result); | 161                              Register result); | 
| 170 | 162 | 
| 171   intptr_t StackSize() const; | 163   intptr_t StackSize() const; | 
| 172 | 164 | 
| 173   // Returns assembler label associated with the given block entry. | 165   // Returns assembler label associated with the given block entry. | 
| 174   Label* GetBlockLabel(BlockEntryInstr* block_entry) const; | 166   Label* GetBlockLabel(BlockEntryInstr* block_entry) const; | 
| 175 | 167 | 
| 176   // Returns true if there is a next block after the current one in | 168   // Returns true if there is a next block after the current one in | 
| 177   // the block order and if it is the given block. | 169   // the block order and if it is the given block. | 
| 178   bool IsNextBlock(BlockEntryInstr* block_entry) const; | 170   bool IsNextBlock(BlockEntryInstr* block_entry) const; | 
| 179 | 171 | 
| 180   void AddExceptionHandler(intptr_t try_index, intptr_t pc_offset); | 172   void AddExceptionHandler(intptr_t try_index, intptr_t pc_offset); | 
| 181   void AddCurrentDescriptor(PcDescriptors::Kind kind, | 173   void AddCurrentDescriptor(PcDescriptors::Kind kind, | 
| 182                             intptr_t deopt_id, | 174                             intptr_t deopt_id, | 
| 183                             intptr_t token_pos, | 175                             intptr_t token_pos); | 
| 184                             intptr_t try_index); |  | 
| 185 | 176 | 
| 186   void RecordSafepoint(LocationSummary* locs); | 177   void RecordSafepoint(LocationSummary* locs); | 
| 187 | 178 | 
| 188   Label* AddDeoptStub(intptr_t deopt_id, DeoptReasonId reason); | 179   Label* AddDeoptStub(intptr_t deopt_id, DeoptReasonId reason); | 
| 189 | 180 | 
| 190   void AddDeoptIndexAtCall(intptr_t deopt_id, intptr_t token_pos); | 181   void AddDeoptIndexAtCall(intptr_t deopt_id, intptr_t token_pos); | 
| 191 | 182 | 
| 192   void AddSlowPathCode(SlowPathCode* slow_path); | 183   void AddSlowPathCode(SlowPathCode* slow_path); | 
| 193 | 184 | 
| 194   void FinalizeExceptionHandlers(const Code& code); | 185   void FinalizeExceptionHandlers(const Code& code); | 
| 195   void FinalizePcDescriptors(const Code& code); | 186   void FinalizePcDescriptors(const Code& code); | 
| 196   void FinalizeDeoptInfo(const Code& code); | 187   void FinalizeDeoptInfo(const Code& code); | 
| 197   void FinalizeStackmaps(const Code& code); | 188   void FinalizeStackmaps(const Code& code); | 
| 198   void FinalizeVarDescriptors(const Code& code); | 189   void FinalizeVarDescriptors(const Code& code); | 
| 199   void FinalizeComments(const Code& code); | 190   void FinalizeComments(const Code& code); | 
| 200 | 191 | 
| 201   const Bool& bool_true() const { return bool_true_; } | 192   const Bool& bool_true() const { return bool_true_; } | 
| 202   const Bool& bool_false() const { return bool_false_; } | 193   const Bool& bool_false() const { return bool_false_; } | 
| 203   const Class& double_class() const { return double_class_; } | 194   const Class& double_class() const { return double_class_; } | 
| 204 | 195 | 
| 205   void SaveLiveRegisters(LocationSummary* locs); | 196   void SaveLiveRegisters(LocationSummary* locs); | 
| 206   void RestoreLiveRegisters(LocationSummary* locs); | 197   void RestoreLiveRegisters(LocationSummary* locs); | 
| 207 | 198 | 
| 208   // Returns true if the compiled function has a finally clause. | 199   // Returns true if the compiled function has a finally clause. | 
| 209   bool HasFinally() const; | 200   bool HasFinally() const; | 
| 210 | 201 | 
|  | 202   intptr_t CurrentTryIndex() const { | 
|  | 203     if (current_block_ == NULL) { | 
|  | 204       return CatchClauseNode::kInvalidTryIndex; | 
|  | 205     } | 
|  | 206     return current_block_->try_index(); | 
|  | 207   } | 
|  | 208 | 
| 211   static const int kLocalsOffsetFromFP = (-1 * kWordSize); | 209   static const int kLocalsOffsetFromFP = (-1 * kWordSize); | 
| 212 | 210 | 
| 213  private: | 211  private: | 
| 214   friend class DeoptimizationStub; | 212   friend class DeoptimizationStub; | 
| 215 | 213 | 
| 216   void GenerateDeferredCode(); | 214   void GenerateDeferredCode(); | 
| 217 | 215 | 
| 218   void EmitInstructionPrologue(Instruction* instr); | 216   void EmitInstructionPrologue(Instruction* instr); | 
| 219 | 217 | 
| 220   // Emit code to load a Value into register 'dst'. | 218   // Emit code to load a Value into register 'dst'. | 
| 221   void LoadValue(Register dst, Value* value); | 219   void LoadValue(Register dst, Value* value); | 
| 222 | 220 | 
| 223   void EmitStaticCall(const Function& function, | 221   void EmitStaticCall(const Function& function, | 
| 224                       const Array& arguments_descriptor, | 222                       const Array& arguments_descriptor, | 
| 225                       intptr_t argument_count, | 223                       intptr_t argument_count, | 
| 226                       intptr_t deopt_id, | 224                       intptr_t deopt_id, | 
| 227                       intptr_t token_pos, | 225                       intptr_t token_pos, | 
| 228                       intptr_t try_index, |  | 
| 229                       LocationSummary* locs); | 226                       LocationSummary* locs); | 
| 230 | 227 | 
| 231   // Type checking helper methods. | 228   // Type checking helper methods. | 
| 232   void CheckClassIds(Register class_id_reg, | 229   void CheckClassIds(Register class_id_reg, | 
| 233                      const GrowableArray<intptr_t>& class_ids, | 230                      const GrowableArray<intptr_t>& class_ids, | 
| 234                      Label* is_instance_lbl, | 231                      Label* is_instance_lbl, | 
| 235                      Label* is_not_instance_lbl); | 232                      Label* is_not_instance_lbl); | 
| 236 | 233 | 
| 237   RawSubtypeTestCache* GenerateInlineInstanceof(intptr_t token_pos, | 234   RawSubtypeTestCache* GenerateInlineInstanceof(intptr_t token_pos, | 
| 238                                                 const AbstractType& type, | 235                                                 const AbstractType& type, | 
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 325   // that should be used when deoptimizing we store it in this variable. | 322   // that should be used when deoptimizing we store it in this variable. | 
| 326   // In future AddDeoptStub should be moved out of the instruction template. | 323   // In future AddDeoptStub should be moved out of the instruction template. | 
| 327   Environment* pending_deoptimization_env_; | 324   Environment* pending_deoptimization_env_; | 
| 328 | 325 | 
| 329   DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); | 326   DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); | 
| 330 }; | 327 }; | 
| 331 | 328 | 
| 332 }  // namespace dart | 329 }  // namespace dart | 
| 333 | 330 | 
| 334 #endif  // VM_FLOW_GRAPH_COMPILER_IA32_H_ | 331 #endif  // VM_FLOW_GRAPH_COMPILER_IA32_H_ | 
| OLD | NEW | 
|---|