| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_COMPILER_SCHEDULER_H_ | 5 #ifndef V8_COMPILER_SCHEDULER_H_ |
| 6 #define V8_COMPILER_SCHEDULER_H_ | 6 #define V8_COMPILER_SCHEDULER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "src/v8.h" | 10 #include "src/v8.h" |
| 11 | 11 |
| 12 #include "src/compiler/opcodes.h" | 12 #include "src/compiler/opcodes.h" |
| 13 #include "src/compiler/schedule.h" | 13 #include "src/compiler/schedule.h" |
| 14 #include "src/zone-allocator.h" | 14 #include "src/zone-allocator.h" |
| 15 #include "src/zone-containers.h" | 15 #include "src/zone-containers.h" |
| 16 | 16 |
| 17 namespace v8 { | 17 namespace v8 { |
| 18 namespace internal { | 18 namespace internal { |
| 19 namespace compiler { | 19 namespace compiler { |
| 20 | 20 |
| 21 // Computes a schedule from a graph, placing nodes into basic blocks and |
| 22 // ordering the basic blocks in the special RPO order. |
| 21 class Scheduler { | 23 class Scheduler { |
| 22 public: | 24 public: |
| 23 explicit Scheduler(Zone* zone); | 25 // Create a new schedule and place all computations from the graph in it. |
| 24 Scheduler(Zone* zone, Graph* graph, Schedule* schedule); | 26 static Schedule* ComputeSchedule(Graph* graph); |
| 25 | 27 |
| 26 Schedule* NewSchedule(Graph* graph); | 28 // Compute the RPO of blocks in an existing schedule. |
| 27 | 29 static BasicBlockVector* ComputeSpecialRPO(Schedule* schedule); |
| 28 BasicBlockVector* ComputeSpecialRPO(); | |
| 29 | 30 |
| 30 private: | 31 private: |
| 31 Zone* zone_; | 32 Zone* zone_; |
| 32 Graph* graph_; | 33 Graph* graph_; |
| 33 Schedule* schedule_; | 34 Schedule* schedule_; |
| 34 NodeVector branches_; | 35 NodeVector branches_; |
| 35 NodeVector calls_; | 36 NodeVector calls_; |
| 36 NodeVector deopts_; | 37 NodeVector deopts_; |
| 37 NodeVector returns_; | 38 NodeVector returns_; |
| 38 NodeVector loops_and_merges_; | 39 NodeVector loops_and_merges_; |
| 39 BasicBlockVector node_block_placement_; | 40 BasicBlockVector node_block_placement_; |
| 40 IntVector unscheduled_uses_; | 41 IntVector unscheduled_uses_; |
| 41 NodeVectorVector scheduled_nodes_; | 42 NodeVectorVector scheduled_nodes_; |
| 42 NodeVector schedule_root_nodes_; | 43 NodeVector schedule_root_nodes_; |
| 43 IntVector schedule_early_rpo_index_; | 44 IntVector schedule_early_rpo_index_; |
| 44 | 45 |
| 46 Scheduler(Zone* zone, Graph* graph, Schedule* schedule); |
| 47 |
| 45 int GetRPONumber(BasicBlock* block) { | 48 int GetRPONumber(BasicBlock* block) { |
| 46 DCHECK(block->rpo_number_ >= 0 && | 49 DCHECK(block->rpo_number_ >= 0 && |
| 47 block->rpo_number_ < static_cast<int>(schedule_->rpo_order_.size())); | 50 block->rpo_number_ < static_cast<int>(schedule_->rpo_order_.size())); |
| 48 DCHECK(schedule_->rpo_order_[block->rpo_number_] == block); | 51 DCHECK(schedule_->rpo_order_[block->rpo_number_] == block); |
| 49 return block->rpo_number_; | 52 return block->rpo_number_; |
| 50 } | 53 } |
| 51 | 54 |
| 52 void PrepareAuxiliaryNodeData(); | 55 void PrepareAuxiliaryNodeData(); |
| 53 void PrepareAuxiliaryBlockData(); | 56 void PrepareAuxiliaryBlockData(); |
| 54 | 57 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 73 void PrepareUses(); | 76 void PrepareUses(); |
| 74 | 77 |
| 75 friend class ScheduleLateNodeVisitor; | 78 friend class ScheduleLateNodeVisitor; |
| 76 void ScheduleLate(); | 79 void ScheduleLate(); |
| 77 }; | 80 }; |
| 78 } | 81 } |
| 79 } | 82 } |
| 80 } // namespace v8::internal::compiler | 83 } // namespace v8::internal::compiler |
| 81 | 84 |
| 82 #endif // V8_COMPILER_SCHEDULER_H_ | 85 #endif // V8_COMPILER_SCHEDULER_H_ |
| OLD | NEW |