| 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 |
| 11 | 11 |
| 12 namespace dart { | 12 namespace dart { |
| 13 | 13 |
| 14 class Code; | 14 class Code; |
| 15 class FlowGraph; | 15 class FlowGraph; |
| 16 template <typename T> class GrowableArray; | 16 template <typename T> class GrowableArray; |
| 17 class ParsedFunction; | 17 class ParsedFunction; |
| 18 | 18 |
| 19 class FlowGraphCompiler : public ValueObject { | 19 class FlowGraphCompiler : public ValueObject { |
| 20 private: | 20 private: |
| 21 struct BlockInfo : public ZoneAllocated { | 21 struct BlockInfo : public ZoneAllocated { |
| 22 public: | 22 public: |
| 23 BlockInfo() : label() { } | 23 BlockInfo() : label() { } |
| 24 Label label; | 24 Label label; |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 public: | 27 public: |
| 28 FlowGraphCompiler(Assembler* assembler, | 28 FlowGraphCompiler(Assembler* assembler, |
| 29 const FlowGraph& flow_graph, | 29 const FlowGraph& flow_graph, |
| 30 bool is_optimizing, | 30 bool is_optimizing); |
| 31 bool is_leaf); | |
| 32 | 31 |
| 33 ~FlowGraphCompiler(); | 32 ~FlowGraphCompiler(); |
| 34 | 33 |
| 35 static bool SupportsUnboxedMints(); | 34 static bool SupportsUnboxedMints(); |
| 36 | 35 |
| 37 // Accessors. | 36 // Accessors. |
| 38 Assembler* assembler() const { return assembler_; } | 37 Assembler* assembler() const { return assembler_; } |
| 39 const ParsedFunction& parsed_function() const { return parsed_function_; } | 38 const ParsedFunction& parsed_function() const { return parsed_function_; } |
| 40 const GrowableArray<BlockEntryInstr*>& block_order() const { | 39 const GrowableArray<BlockEntryInstr*>& block_order() const { |
| 41 return block_order_; | 40 return block_order_; |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 void SaveLiveRegisters(LocationSummary* locs); | 199 void SaveLiveRegisters(LocationSummary* locs); |
| 201 void RestoreLiveRegisters(LocationSummary* locs); | 200 void RestoreLiveRegisters(LocationSummary* locs); |
| 202 | 201 |
| 203 intptr_t CurrentTryIndex() const { | 202 intptr_t CurrentTryIndex() const { |
| 204 if (current_block_ == NULL) { | 203 if (current_block_ == NULL) { |
| 205 return CatchClauseNode::kInvalidTryIndex; | 204 return CatchClauseNode::kInvalidTryIndex; |
| 206 } | 205 } |
| 207 return current_block_->try_index(); | 206 return current_block_->try_index(); |
| 208 } | 207 } |
| 209 | 208 |
| 210 // Returns true if the generated code does not call other Dart code or | |
| 211 // runtime. Only deoptimization is allowed to occur. Closures are not leaf. | |
| 212 bool IsLeaf() const; | |
| 213 | |
| 214 static Condition FlipCondition(Condition condition); | 209 static Condition FlipCondition(Condition condition); |
| 215 | 210 |
| 216 static bool EvaluateCondition(Condition condition, intptr_t l, intptr_t r); | 211 static bool EvaluateCondition(Condition condition, intptr_t l, intptr_t r); |
| 217 | 212 |
| 218 private: | 213 private: |
| 219 void GenerateDeferredCode(); | 214 void GenerateDeferredCode(); |
| 220 | 215 |
| 221 void EmitInstructionPrologue(Instruction* instr); | 216 void EmitInstructionPrologue(Instruction* instr); |
| 222 void EmitInstructionEpilogue(Instruction* instr); | 217 void EmitInstructionEpilogue(Instruction* instr); |
| 223 | 218 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 // which is reverse postorder. | 299 // which is reverse postorder. |
| 305 BlockEntryInstr* current_block_; | 300 BlockEntryInstr* current_block_; |
| 306 ExceptionHandlerList* exception_handlers_list_; | 301 ExceptionHandlerList* exception_handlers_list_; |
| 307 DescriptorList* pc_descriptors_list_; | 302 DescriptorList* pc_descriptors_list_; |
| 308 StackmapTableBuilder* stackmap_table_builder_; | 303 StackmapTableBuilder* stackmap_table_builder_; |
| 309 GrowableArray<BlockInfo*> block_info_; | 304 GrowableArray<BlockInfo*> block_info_; |
| 310 GrowableArray<CompilerDeoptInfo*> deopt_infos_; | 305 GrowableArray<CompilerDeoptInfo*> deopt_infos_; |
| 311 GrowableArray<SlowPathCode*> slow_path_code_; | 306 GrowableArray<SlowPathCode*> slow_path_code_; |
| 312 const GrowableObjectArray& object_table_; | 307 const GrowableObjectArray& object_table_; |
| 313 const bool is_optimizing_; | 308 const bool is_optimizing_; |
| 314 const bool is_dart_leaf_; | |
| 315 | 309 |
| 316 const Bool& bool_true_; | 310 const Bool& bool_true_; |
| 317 const Bool& bool_false_; | 311 const Bool& bool_false_; |
| 318 const Class& double_class_; | 312 const Class& double_class_; |
| 319 | 313 |
| 320 ParallelMoveResolver parallel_move_resolver_; | 314 ParallelMoveResolver parallel_move_resolver_; |
| 321 | 315 |
| 322 // Currently instructions generate deopt stubs internally by | 316 // Currently instructions generate deopt stubs internally by |
| 323 // calling AddDeoptStub. To communicate deoptimization environment | 317 // calling AddDeoptStub. To communicate deoptimization environment |
| 324 // that should be used when deoptimizing we store it in this variable. | 318 // that should be used when deoptimizing we store it in this variable. |
| 325 // In future AddDeoptStub should be moved out of the instruction template. | 319 // In future AddDeoptStub should be moved out of the instruction template. |
| 326 Environment* pending_deoptimization_env_; | 320 Environment* pending_deoptimization_env_; |
| 327 | 321 |
| 328 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); | 322 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); |
| 329 }; | 323 }; |
| 330 | 324 |
| 331 } // namespace dart | 325 } // namespace dart |
| 332 | 326 |
| 333 #endif // VM_FLOW_GRAPH_COMPILER_X64_H_ | 327 #endif // VM_FLOW_GRAPH_COMPILER_X64_H_ |
| OLD | NEW |