| 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_H_ | 5 #ifndef VM_FLOW_GRAPH_COMPILER_H_ |
| 6 #define VM_FLOW_GRAPH_COMPILER_H_ | 6 #define VM_FLOW_GRAPH_COMPILER_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/code_descriptors.h" | 10 #include "vm/code_descriptors.h" |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 266 |
| 267 ~FlowGraphCompiler(); | 267 ~FlowGraphCompiler(); |
| 268 | 268 |
| 269 static bool SupportsUnboxedDoubles(); | 269 static bool SupportsUnboxedDoubles(); |
| 270 static bool SupportsUnboxedMints(); | 270 static bool SupportsUnboxedMints(); |
| 271 static bool SupportsSinCos(); | 271 static bool SupportsSinCos(); |
| 272 static bool SupportsUnboxedSimd128(); | 272 static bool SupportsUnboxedSimd128(); |
| 273 | 273 |
| 274 // Accessors. | 274 // Accessors. |
| 275 Assembler* assembler() const { return assembler_; } | 275 Assembler* assembler() const { return assembler_; } |
| 276 const ParsedFunction& parsed_function() const { return parsed_function_; } | 276 ParsedFunction& parsed_function() const { return parsed_function_; } |
| 277 const GrowableArray<BlockEntryInstr*>& block_order() const { | 277 const GrowableArray<BlockEntryInstr*>& block_order() const { |
| 278 return block_order_; | 278 return block_order_; |
| 279 } | 279 } |
| 280 | 280 |
| 281 const FlowGraph& flow_graph() const { return flow_graph_; } | 281 const FlowGraph& flow_graph() const { return flow_graph_; } |
| 282 | 282 |
| 283 DescriptorList* pc_descriptors_list() const { | 283 DescriptorList* pc_descriptors_list() const { |
| 284 return pc_descriptors_list_; | 284 return pc_descriptors_list_; |
| 285 } | 285 } |
| 286 BlockEntryInstr* current_block() const { return current_block_; } | 286 BlockEntryInstr* current_block() const { return current_block_; } |
| 287 void set_current_block(BlockEntryInstr* value) { | 287 void set_current_block(BlockEntryInstr* value) { |
| 288 current_block_ = value; | 288 current_block_ = value; |
| 289 } | 289 } |
| 290 static bool CanOptimize(); | 290 static bool CanOptimize(); |
| 291 bool CanOptimizeFunction() const; | 291 bool CanOptimizeFunction() const; |
| 292 bool CanOSRFunction() const; | 292 bool CanOSRFunction() const; |
| 293 bool is_optimizing() const { return is_optimizing_; } | 293 bool is_optimizing() const { return is_optimizing_; } |
| 294 | 294 |
| 295 void EnterIntrinsicMode(); |
| 296 void ExitIntrinsicMode(); |
| 297 bool intrinsic_mode() const { return intrinsic_mode_; } |
| 298 |
| 299 Label* intrinsic_slow_path_label() { |
| 300 return &intrinsic_slow_path_label_; |
| 301 } |
| 302 |
| 295 bool ForceSlowPathForStackOverflow() const; | 303 bool ForceSlowPathForStackOverflow() const; |
| 296 | 304 |
| 297 const GrowableArray<BlockInfo*>& block_info() const { return block_info_; } | 305 const GrowableArray<BlockInfo*>& block_info() const { return block_info_; } |
| 298 ParallelMoveResolver* parallel_move_resolver() { | 306 ParallelMoveResolver* parallel_move_resolver() { |
| 299 return ¶llel_move_resolver_; | 307 return ¶llel_move_resolver_; |
| 300 } | 308 } |
| 301 | 309 |
| 302 // Constructor is lighweight, major initialization work should occur here. | 310 // Constructor is lighweight, major initialization work should occur here. |
| 303 // This makes it easier to measure time spent in the compiler. | 311 // This makes it easier to measure time spent in the compiler. |
| 304 void InitCompiler(); | 312 void InitCompiler(); |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 bool IsListClass(const Class& cls) const { | 602 bool IsListClass(const Class& cls) const { |
| 595 return cls.raw() == list_class_.raw(); | 603 return cls.raw() == list_class_.raw(); |
| 596 } | 604 } |
| 597 | 605 |
| 598 void EmitSourceLine(Instruction* instr); | 606 void EmitSourceLine(Instruction* instr); |
| 599 | 607 |
| 600 intptr_t GetOptimizationThreshold() const; | 608 intptr_t GetOptimizationThreshold() const; |
| 601 | 609 |
| 602 Isolate* isolate_; | 610 Isolate* isolate_; |
| 603 Assembler* assembler_; | 611 Assembler* assembler_; |
| 604 const ParsedFunction& parsed_function_; | 612 ParsedFunction& parsed_function_; |
| 605 const FlowGraph& flow_graph_; | 613 const FlowGraph& flow_graph_; |
| 606 const GrowableArray<BlockEntryInstr*>& block_order_; | 614 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 607 | 615 |
| 608 // Compiler specific per-block state. Indexed by postorder block number | 616 // Compiler specific per-block state. Indexed by postorder block number |
| 609 // for convenience. This is not the block's index in the block order, | 617 // for convenience. This is not the block's index in the block order, |
| 610 // which is reverse postorder. | 618 // which is reverse postorder. |
| 611 BlockEntryInstr* current_block_; | 619 BlockEntryInstr* current_block_; |
| 612 ExceptionHandlerList* exception_handlers_list_; | 620 ExceptionHandlerList* exception_handlers_list_; |
| 613 DescriptorList* pc_descriptors_list_; | 621 DescriptorList* pc_descriptors_list_; |
| 614 StackmapTableBuilder* stackmap_table_builder_; | 622 StackmapTableBuilder* stackmap_table_builder_; |
| 615 GrowableArray<BlockInfo*> block_info_; | 623 GrowableArray<BlockInfo*> block_info_; |
| 616 GrowableArray<CompilerDeoptInfo*> deopt_infos_; | 624 GrowableArray<CompilerDeoptInfo*> deopt_infos_; |
| 617 GrowableArray<SlowPathCode*> slow_path_code_; | 625 GrowableArray<SlowPathCode*> slow_path_code_; |
| 618 // Stores: [code offset, function, null(code)]. | 626 // Stores: [code offset, function, null(code)]. |
| 619 const GrowableObjectArray& static_calls_target_table_; | 627 const GrowableObjectArray& static_calls_target_table_; |
| 620 const bool is_optimizing_; | 628 const bool is_optimizing_; |
| 621 // Set to true if optimized code has IC calls. | 629 // Set to true if optimized code has IC calls. |
| 622 bool may_reoptimize_; | 630 bool may_reoptimize_; |
| 631 // True while emitting intrinsic code. |
| 632 bool intrinsic_mode_; |
| 633 Label intrinsic_slow_path_label_; |
| 623 | 634 |
| 624 const Class& double_class_; | 635 const Class& double_class_; |
| 625 const Class& mint_class_; | 636 const Class& mint_class_; |
| 626 const Class& float32x4_class_; | 637 const Class& float32x4_class_; |
| 627 const Class& float64x2_class_; | 638 const Class& float64x2_class_; |
| 628 const Class& int32x4_class_; | 639 const Class& int32x4_class_; |
| 629 const Class& list_class_; | 640 const Class& list_class_; |
| 630 | 641 |
| 631 ParallelMoveResolver parallel_move_resolver_; | 642 ParallelMoveResolver parallel_move_resolver_; |
| 632 | 643 |
| 633 // Currently instructions generate deopt stubs internally by | 644 // Currently instructions generate deopt stubs internally by |
| 634 // calling AddDeoptStub. To communicate deoptimization environment | 645 // calling AddDeoptStub. To communicate deoptimization environment |
| 635 // that should be used when deoptimizing we store it in this variable. | 646 // that should be used when deoptimizing we store it in this variable. |
| 636 // In future AddDeoptStub should be moved out of the instruction template. | 647 // In future AddDeoptStub should be moved out of the instruction template. |
| 637 Environment* pending_deoptimization_env_; | 648 Environment* pending_deoptimization_env_; |
| 638 | 649 |
| 639 intptr_t entry_patch_pc_offset_; | 650 intptr_t entry_patch_pc_offset_; |
| 640 intptr_t patch_code_pc_offset_; | 651 intptr_t patch_code_pc_offset_; |
| 641 intptr_t lazy_deopt_pc_offset_; | 652 intptr_t lazy_deopt_pc_offset_; |
| 642 | 653 |
| 643 ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data_; | 654 ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data_; |
| 644 | 655 |
| 645 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); | 656 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); |
| 646 }; | 657 }; |
| 647 | 658 |
| 648 } // namespace dart | 659 } // namespace dart |
| 649 | 660 |
| 650 #endif // VM_FLOW_GRAPH_COMPILER_H_ | 661 #endif // VM_FLOW_GRAPH_COMPILER_H_ |
| OLD | NEW |