| 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 |
| 11 | 11 |
| 12 namespace dart { | 12 namespace dart { |
| 13 | 13 |
| 14 class Code; | 14 class Code; |
| 15 class DeoptimizationStub; | |
| 16 class FlowGraph; | 15 class FlowGraph; |
| 17 template <typename T> class GrowableArray; | 16 template <typename T> class GrowableArray; |
| 18 class ParsedFunction; | 17 class ParsedFunction; |
| 19 | 18 |
| 20 class FlowGraphCompiler : public ValueObject { | 19 class FlowGraphCompiler : public ValueObject { |
| 21 private: | 20 private: |
| 22 struct BlockInfo : public ZoneAllocated { | 21 struct BlockInfo : public ZoneAllocated { |
| 23 public: | 22 public: |
| 24 BlockInfo() : label() { } | 23 BlockInfo() : label() { } |
| 25 Label label; | 24 Label label; |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 198 |
| 200 intptr_t CurrentTryIndex() const { | 199 intptr_t CurrentTryIndex() const { |
| 201 if (current_block_ == NULL) { | 200 if (current_block_ == NULL) { |
| 202 return CatchClauseNode::kInvalidTryIndex; | 201 return CatchClauseNode::kInvalidTryIndex; |
| 203 } | 202 } |
| 204 return current_block_->try_index(); | 203 return current_block_->try_index(); |
| 205 } | 204 } |
| 206 | 205 |
| 207 static const int kLocalsOffsetFromFP = (-1 * kWordSize); | 206 static const int kLocalsOffsetFromFP = (-1 * kWordSize); |
| 208 | 207 |
| 208 // Returns true if the generated code does not call other Dart code or |
| 209 // runtime. Only deoptimization is allowed to occur. Closures are not leaf. |
| 210 bool IsLeaf() const; |
| 211 |
| 209 private: | 212 private: |
| 210 friend class DeoptimizationStub; | |
| 211 | |
| 212 void GenerateDeferredCode(); | 213 void GenerateDeferredCode(); |
| 213 | 214 |
| 214 void EmitInstructionPrologue(Instruction* instr); | 215 void EmitInstructionPrologue(Instruction* instr); |
| 215 | 216 |
| 216 // Emit code to load a Value into register 'dst'. | 217 // Emit code to load a Value into register 'dst'. |
| 217 void LoadValue(Register dst, Value* value); | 218 void LoadValue(Register dst, Value* value); |
| 218 | 219 |
| 219 void EmitStaticCall(const Function& function, | 220 void EmitStaticCall(const Function& function, |
| 220 const Array& arguments_descriptor, | 221 const Array& arguments_descriptor, |
| 221 intptr_t argument_count, | 222 intptr_t argument_count, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 // Perform a greedy local register allocation. Consider all registers free. | 281 // Perform a greedy local register allocation. Consider all registers free. |
| 281 void AllocateRegistersLocally(Instruction* instr); | 282 void AllocateRegistersLocally(Instruction* instr); |
| 282 | 283 |
| 283 // Map a block number in a forward iteration into the block number in the | 284 // Map a block number in a forward iteration into the block number in the |
| 284 // corresponding reverse iteration. Used to obtain an index into | 285 // corresponding reverse iteration. Used to obtain an index into |
| 285 // block_order for reverse iterations. | 286 // block_order for reverse iterations. |
| 286 intptr_t reverse_index(intptr_t index) const { | 287 intptr_t reverse_index(intptr_t index) const { |
| 287 return block_order_.length() - index - 1; | 288 return block_order_.length() - index - 1; |
| 288 } | 289 } |
| 289 | 290 |
| 290 // Returns true if the generated code does not call other Dart code or | |
| 291 // runtime. Only deoptimization is allowed to occur. Closures are not leaf. | |
| 292 bool IsLeaf() const; | |
| 293 | |
| 294 class Assembler* assembler_; | 291 class Assembler* assembler_; |
| 295 const ParsedFunction& parsed_function_; | 292 const ParsedFunction& parsed_function_; |
| 296 const GrowableArray<BlockEntryInstr*>& block_order_; | 293 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 297 | 294 |
| 298 // Compiler specific per-block state. Indexed by postorder block number | 295 // Compiler specific per-block state. Indexed by postorder block number |
| 299 // for convenience. This is not the block's index in the block order, | 296 // for convenience. This is not the block's index in the block order, |
| 300 // which is reverse postorder. | 297 // which is reverse postorder. |
| 301 BlockEntryInstr* current_block_; | 298 BlockEntryInstr* current_block_; |
| 302 ExceptionHandlerList* exception_handlers_list_; | 299 ExceptionHandlerList* exception_handlers_list_; |
| 303 DescriptorList* pc_descriptors_list_; | 300 DescriptorList* pc_descriptors_list_; |
| 304 StackmapTableBuilder* stackmap_table_builder_; | 301 StackmapTableBuilder* stackmap_table_builder_; |
| 305 GrowableArray<BlockInfo*> block_info_; | 302 GrowableArray<BlockInfo*> block_info_; |
| 306 GrowableArray<DeoptimizationStub*> deopt_stubs_; | 303 GrowableArray<CompilerDeoptInfo*> deopt_infos_; |
| 307 GrowableArray<SlowPathCode*> slow_path_code_; | 304 GrowableArray<SlowPathCode*> slow_path_code_; |
| 308 const GrowableObjectArray& object_table_; | 305 const GrowableObjectArray& object_table_; |
| 309 const bool is_optimizing_; | 306 const bool is_optimizing_; |
| 310 const bool is_dart_leaf_; | 307 const bool is_dart_leaf_; |
| 311 | 308 |
| 312 const Bool& bool_true_; | 309 const Bool& bool_true_; |
| 313 const Bool& bool_false_; | 310 const Bool& bool_false_; |
| 314 const Class& double_class_; | 311 const Class& double_class_; |
| 315 | 312 |
| 316 ParallelMoveResolver parallel_move_resolver_; | 313 ParallelMoveResolver parallel_move_resolver_; |
| 317 | 314 |
| 318 // Currently instructions generate deopt stubs internally by | 315 // Currently instructions generate deopt stubs internally by |
| 319 // calling AddDeoptStub. To communicate deoptimization environment | 316 // calling AddDeoptStub. To communicate deoptimization environment |
| 320 // that should be used when deoptimizing we store it in this variable. | 317 // that should be used when deoptimizing we store it in this variable. |
| 321 // In future AddDeoptStub should be moved out of the instruction template. | 318 // In future AddDeoptStub should be moved out of the instruction template. |
| 322 Environment* pending_deoptimization_env_; | 319 Environment* pending_deoptimization_env_; |
| 323 | 320 |
| 324 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); | 321 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); |
| 325 }; | 322 }; |
| 326 | 323 |
| 327 } // namespace dart | 324 } // namespace dart |
| 328 | 325 |
| 329 #endif // VM_FLOW_GRAPH_COMPILER_IA32_H_ | 326 #endif // VM_FLOW_GRAPH_COMPILER_IA32_H_ |
| OLD | NEW |