| 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 "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/compiler/opcodes.h" | 10 #include "src/compiler/opcodes.h" |
| 11 #include "src/compiler/schedule.h" | 11 #include "src/compiler/schedule.h" |
| 12 #include "src/compiler/zone-pool.h" | 12 #include "src/compiler/zone-pool.h" |
| 13 #include "src/zone-containers.h" | 13 #include "src/zone-containers.h" |
| 14 | 14 |
| 15 namespace v8 { | 15 namespace v8 { |
| 16 namespace internal { | 16 namespace internal { |
| 17 namespace compiler { | 17 namespace compiler { |
| 18 | 18 |
| 19 class ControlEquivalence; |
| 19 class SpecialRPONumberer; | 20 class SpecialRPONumberer; |
| 20 | 21 |
| 21 // Computes a schedule from a graph, placing nodes into basic blocks and | 22 // Computes a schedule from a graph, placing nodes into basic blocks and |
| 22 // ordering the basic blocks in the special RPO order. | 23 // ordering the basic blocks in the special RPO order. |
| 23 class Scheduler { | 24 class Scheduler { |
| 24 public: | 25 public: |
| 25 // The complete scheduling algorithm. Creates a new schedule and places all | 26 // The complete scheduling algorithm. Creates a new schedule and places all |
| 26 // nodes from the graph into it. | 27 // nodes from the graph into it. |
| 27 static Schedule* ComputeSchedule(Zone* zone, Graph* graph); | 28 static Schedule* ComputeSchedule(Zone* zone, Graph* graph); |
| 28 | 29 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 41 // | 42 // |
| 42 // 1) GetPlacement(): kUnknown -> kCoupled|kSchedulable|kFixed | 43 // 1) GetPlacement(): kUnknown -> kCoupled|kSchedulable|kFixed |
| 43 // 2) UpdatePlacement(): kCoupled|kSchedulable -> kFixed|kScheduled | 44 // 2) UpdatePlacement(): kCoupled|kSchedulable -> kFixed|kScheduled |
| 44 enum Placement { kUnknown, kSchedulable, kFixed, kCoupled, kScheduled }; | 45 enum Placement { kUnknown, kSchedulable, kFixed, kCoupled, kScheduled }; |
| 45 | 46 |
| 46 // Per-node data tracked during scheduling. | 47 // Per-node data tracked during scheduling. |
| 47 struct SchedulerData { | 48 struct SchedulerData { |
| 48 BasicBlock* minimum_block_; // Minimum legal RPO placement. | 49 BasicBlock* minimum_block_; // Minimum legal RPO placement. |
| 49 int unscheduled_count_; // Number of unscheduled uses of this node. | 50 int unscheduled_count_; // Number of unscheduled uses of this node. |
| 50 bool is_connected_control_; // {true} if control-connected to the end node. | 51 bool is_connected_control_; // {true} if control-connected to the end node. |
| 51 bool is_floating_control_; // {true} if control, but not control-connected | |
| 52 // to the end node. | |
| 53 Placement placement_; // Whether the node is fixed, schedulable, | 52 Placement placement_; // Whether the node is fixed, schedulable, |
| 54 // coupled to another node, or not yet known. | 53 // coupled to another node, or not yet known. |
| 55 }; | 54 }; |
| 56 | 55 |
| 57 Zone* zone_; | 56 Zone* zone_; |
| 58 Graph* graph_; | 57 Graph* graph_; |
| 59 Schedule* schedule_; | 58 Schedule* schedule_; |
| 60 NodeVectorVector scheduled_nodes_; // Per-block list of nodes in reverse. | 59 NodeVectorVector scheduled_nodes_; // Per-block list of nodes in reverse. |
| 61 NodeVector schedule_root_nodes_; // Fixed root nodes seed the worklist. | 60 NodeVector schedule_root_nodes_; // Fixed root nodes seed the worklist. |
| 62 ZoneQueue<Node*> schedule_queue_; // Worklist of schedulable nodes. | 61 ZoneQueue<Node*> schedule_queue_; // Worklist of schedulable nodes. |
| 63 ZoneVector<SchedulerData> node_data_; // Per-node data for all nodes. | 62 ZoneVector<SchedulerData> node_data_; // Per-node data for all nodes. |
| 64 SpecialRPONumberer* special_rpo_; // Special RPO numbering of blocks. | 63 SpecialRPONumberer* special_rpo_; // Special RPO numbering of blocks. |
| 64 ControlEquivalence* equivalence_; // Control dependence equivalence. |
| 65 | 65 |
| 66 Scheduler(Zone* zone, Graph* graph, Schedule* schedule); | 66 Scheduler(Zone* zone, Graph* graph, Schedule* schedule); |
| 67 | 67 |
| 68 inline SchedulerData DefaultSchedulerData(); | 68 inline SchedulerData DefaultSchedulerData(); |
| 69 inline SchedulerData* GetData(Node* node); | 69 inline SchedulerData* GetData(Node* node); |
| 70 | 70 |
| 71 Placement GetPlacement(Node* node); | 71 Placement GetPlacement(Node* node); |
| 72 void UpdatePlacement(Node* node, Placement placement); | 72 void UpdatePlacement(Node* node, Placement placement); |
| 73 | 73 |
| 74 inline bool IsCoupledControlEdge(Node* node, int index); | 74 inline bool IsCoupledControlEdge(Node* node, int index); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 103 | 103 |
| 104 void FuseFloatingControl(BasicBlock* block, Node* node); | 104 void FuseFloatingControl(BasicBlock* block, Node* node); |
| 105 void MovePlannedNodes(BasicBlock* from, BasicBlock* to); | 105 void MovePlannedNodes(BasicBlock* from, BasicBlock* to); |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 } // namespace compiler | 108 } // namespace compiler |
| 109 } // namespace internal | 109 } // namespace internal |
| 110 } // namespace v8 | 110 } // namespace v8 |
| 111 | 111 |
| 112 #endif // V8_COMPILER_SCHEDULER_H_ | 112 #endif // V8_COMPILER_SCHEDULER_H_ |
| OLD | NEW |